Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: external links #31

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
You are a personal assistant.

# audience
The user name is {person}.
The user name is {person}. He is a senior software developer.

# style
Be straight forward and concise. Only give explanation if asked.
When asked about code questions, give code example.
If an existing library (or many libraries) already exist for the question, provide it. Always provide sources and give an URL to the library reference.
"""

system_prompt_template = """{role}
Expand Down
11 changes: 7 additions & 4 deletions webapp/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"request": true
},
"shell": {
"all": true,
"all": false,
"execute": true,
"sidecar": true,
"open": true,
"open": false,
"scope": [
{
"name": "bin/core",
Expand Down Expand Up @@ -69,7 +69,10 @@
}
},
"security": {
"csp": null
"csp": {
"default-src": "'self' customprotocol: asset:",
"connect-src": "ipc: http://ipc.localhost"
}
},
"updater": {
"active": false
Expand All @@ -84,4 +87,4 @@
}
]
}
}
}
5 changes: 4 additions & 1 deletion webapp/src/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import LibMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { Prism } from 'react-syntax-highlighter';
import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';

import { ExternalLink } from 'lucide-react';

interface Props {
children?: string
Expand Down Expand Up @@ -41,6 +41,9 @@ export function Markdown({ children }: Props) {
blockquote({ children }) {
return <blockquote className="border-l-4 border-gray-300 pl-4">{children}</blockquote>;
},
a({ href, children }) {
return <a target='_blank' href={href} className="text-blue-600 cursor-pointer inline-block"><div className='flex gap-1'>{children} <ExternalLink className='w-4 h-4'/></div></a>;
},
code(props) {
const { children, className, node, ...rest } = props;
const match = /language-(\w+)/.exec(className || '');
Expand Down