update markdown

This commit is contained in:
Zhang Minghan 2023-11-05 11:35:40 +08:00
parent 5a20c5282e
commit 1313b861e8
4 changed files with 18 additions and 8 deletions

View File

@ -61,8 +61,10 @@ func NewChatInstanceFromModel(props *InstanceProps) *ChatInstance {
return NewChatInstanceFromConfig("subscribe")
}
return NewChatInstanceFromConfig("gpt3")
case globals.Dalle2:
return NewChatInstanceFromConfig("gpt3")
default:
return NewChatInstanceFromConfig("gpt3")
}

View File

@ -32,6 +32,14 @@ function doAction(dispatch: AppDispatch, url: string): boolean {
return false;
}
const LanguageMap: Record<string, string> = {
"html": "htmlbars",
"js": "javascript",
"ts": "typescript",
"rs": "rust",
};
function Markdown({ children, className }: MarkdownProps) {
const dispatch = useDispatch();
const { t } = useTranslation();
@ -70,8 +78,8 @@ function Markdown({ children, className }: MarkdownProps) {
},
code({ inline, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || "");
if (match && match[1] === "file")
return parseFile(children.toString());
const language = match ? match[1] : "";
if (language) return parseFile(children.toString());
return !inline && match ? (
<div className={`markdown-syntax`}>
<div className={`markdown-syntax-header`}>
@ -84,13 +92,13 @@ function Markdown({ children, className }: MarkdownProps) {
});
}}
/>
<p>{match[1]}</p>
<p>{language}</p>
</div>
<SyntaxHighlighter
{...props}
children={String(children).replace(/\n$/, "")}
style={style}
language={match[1]}
language={LanguageMap[language] || language}
PreTag="div"
wrapLongLines={true}
wrapLines={true}

View File

@ -8,7 +8,7 @@ import {
} from "@/utils/env.ts";
import { getMemory } from "@/utils/memory.ts";
export const version = "3.6.11";
export const version = "3.6.12";
export const dev: boolean = getDev();
export const deploy: boolean = true;
export let rest_api: string = getRestApi(deploy);
@ -21,7 +21,7 @@ export const supportModels: Model[] = [
{ id: "gpt-3.5-turbo-0613", name: "GPT-3.5", free: true, auth: false },
{ id: "gpt-3.5-turbo-16k-0613", name: "GPT-3.5-16k", free: true, auth: true },
{ id: "gpt-4-0613", name: "GPT-4", free: false, auth: true },
{ id: "gpt-4v", name: "GPT-4V", free: false, auth: true },
{ id: "gpt-4-v", name: "gpt-4-v", free: false, auth: true },
{ id: "gpt-4-dalle", name: "DALLE3", free: false, auth: true },
// anthropic models
@ -64,7 +64,7 @@ export const largeContextModels = [
export const planModels = [
"gpt-4-0613",
"gpt-4v",
"gpt-4-v",
"gpt-4-dalle",
"claude-2-100k",
];

View File

@ -46,7 +46,7 @@ const (
GPT3Turbo16k0613 = "gpt-3.5-turbo-16k-0613"
GPT3Turbo16k0301 = "gpt-3.5-turbo-16k-0301"
GPT4 = "gpt-4"
GPT4Vision = "gpt-4v"
GPT4Vision = "gpt-4-v"
GPT40314 = "gpt-4-0314"
GPT40613 = "gpt-4-0613"
GPT432k = "gpt-4-32k"