diff --git a/.env.example b/.env.example deleted file mode 100644 index e1ccb02..0000000 --- a/.env.example +++ /dev/null @@ -1 +0,0 @@ -API_BASE_URL=http://127.0.0.1:5000 \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index bffb357..24e1c6c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,6 @@ { - "extends": "next/core-web-vitals" + "extends": "next/core-web-vitals", + "rules": { + "react/jsx-key": "off" + } } diff --git a/.vscode/settings.json b/.vscode/settings.json index e9d4b3a..16892db 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,5 +24,25 @@ "editor.quickSuggestions": { "strings": true }, - "cSpell.words": ["DBGPT"] + "cSpell.words": [ + "DBGPT" + ], + "MicroPython.executeButton": [ + { + "text": "▶", + "tooltip": "运行", + "alignment": "left", + "command": "extension.executeFile", + "priority": 3.5 + } + ], + "MicroPython.syncButton": [ + { + "text": "$(sync)", + "tooltip": "同步", + "alignment": "left", + "command": "extension.execute", + "priority": 4 + } + ] } diff --git a/app/i18n.ts b/app/i18n.ts index d2913db..88e5527 100644 --- a/app/i18n.ts +++ b/app/i18n.ts @@ -1,3 +1,9 @@ +/* + * @Date: 2024-05-14 15:41:13 + * @LastEditors: CZH + * @LastEditTime: 2024-05-23 17:33:01 + * @FilePath: /DB-GPT-Web/app/i18n.ts + */ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; @@ -219,6 +225,32 @@ const en = { operators: 'Operators', Chinese: 'Chinese', English: 'English', + no: 'No', + yes: 'Yes', + confirm: 'Confirm', + Request_error: 'Request error', + new: 'New', + Preview: 'Preview', + add_knowledge: 'Add Knowledge', + Editor: 'Editor', + Start_a_conversation: 'Start a conversation', + Run: 'Run', + Save: 'Save', + Select_File: 'Select File', + No_flow_found: 'No flow found', + Label: 'Label', + Deploy: 'Deploy', + Copy_AWEL_Flow: 'Copy AWEL Flow', + Editable: 'Editable', + Title: 'Title', + Create_Now: 'Create Now', + Host: 'Host', + Path: 'Path', + Delete_Chat: 'Delete Chat', + DB_Name: 'DB Name', + DB_Type: 'DB Type', + Are_you_sure_delete_this_chat: 'Are you sure delete this chat?', + Do_you_Want_to_delete_the: 'Do you Want to delete the', } as const; export type I18nKeys = keyof typeof en; @@ -228,6 +260,31 @@ export interface Resources { } const zh: Resources['translation'] = { + Title: '标题', + Are_you_sure_delete_this_chat: '确认删除此对话?', + Do_you_Want_to_delete_the: '确定删除', + Host: '主机', + DB_Name: '数据库名称', + DB_Type: '数据类型', + Path: '路径', + Editable: '可编辑', + no: '否', + yes: '是', + Create_Now: '创建', + new: '新', + Run: '执行', + Save: '保存', + confirm: '确定', + Preview: '预览', + Editor: '编辑', + Label: '标签', + Deploy: '部署', + Copy_AWEL_Flow: '复制 AWEL 工作流', + No_flow_found: '暂无数据', + Select_File: '选择文件', + Start_a_conversation: '开始对话', + add_knowledge: '新增知识', + Request_error: '请求出错', Knowledge_Space: '知识库', space: '知识库', Vector: '向量', @@ -362,6 +419,7 @@ const zh: Resources['translation'] = { input_count: '共计输入', input_unit: '字', Copy: '复制', + Delete_Chat: '删除对话', Copy_success: '内容复制成功', Copy_nothing: '内容复制为空', Copry_error: '复制失败', diff --git a/client/api/index.ts b/client/api/index.ts index f6bd6fa..2cbfe96 100644 --- a/client/api/index.ts +++ b/client/api/index.ts @@ -1,3 +1,9 @@ +/* + * @Date: 2024-05-14 15:41:13 + * @LastEditors: CZH + * @LastEditTime: 2024-05-22 14:22:00 + * @FilePath: /DB-GPT-Web/client/api/index.ts + */ import axios, { AxiosRequestConfig, AxiosError, AxiosResponse } from 'axios'; export type ResponseType = { diff --git a/client/api/tools/interceptors.ts b/client/api/tools/interceptors.ts index efe940a..df96ac4 100644 --- a/client/api/tools/interceptors.ts +++ b/client/api/tools/interceptors.ts @@ -1,6 +1,7 @@ import { AxiosError } from 'axios'; import { ApiResponse, FailedTuple, SuccessTuple, ResponseType } from '../'; import { notification } from 'antd'; +import { t } from 'i18next'; /** * Response processing @@ -21,7 +22,7 @@ export const apiInterceptors = (promise: Promise(promise: Promise, content: `do you want delete the application?`, - okText: 'Yes', + okText: t('yes'), okType: 'danger', - cancelText: 'No', + cancelText: t('no'), async onOk() { await apiInterceptors(delApp({ app_code: app.app_code })); updateApps(isCollected ? { is_collected: isCollected } : undefined); diff --git a/components/chat/completion.tsx b/components/chat/completion.tsx index 1399eef..c98ebe8 100644 --- a/components/chat/completion.tsx +++ b/components/chat/completion.tsx @@ -204,7 +204,7 @@ const Completion = ({ messages, onSubmit }: Props) => { image="/empty.png" imageStyle={{ width: 320, height: 320, margin: '0 auto', maxWidth: '100%', maxHeight: '100%' }} className="flex items-center justify-center flex-col h-full w-full" - description="Start a conversation" + description={t('Start_a_conversation')} /> )} diff --git a/components/chat/db-editor.tsx b/components/chat/db-editor.tsx index 14d8c1c..2c0968d 100644 --- a/components/chat/db-editor.tsx +++ b/components/chat/db-editor.tsx @@ -9,6 +9,7 @@ import MonacoEditor from './monaco-editor'; import { sendGetRequest, sendSpacePostRequest } from '@/utils/request'; import { useSearchParams } from 'next/navigation'; import { OnChange } from '@monaco-editor/react'; +import { useTranslation } from 'react-i18next'; import Header from './header'; import Chart from '../chart'; @@ -93,6 +94,7 @@ function DbEditorContent({ editorValue, chartData, tableData, handleChange }: IP } function DbEditor() { + const { t } = useTranslation(); const [expandedKeys, setExpandedKeys] = React.useState([]); const [searchValue, setSearchValue] = React.useState(''); const [currentRound, setCurrentRound] = React.useState(); @@ -437,7 +439,7 @@ function DbEditor() { } }} > - Run + {t('Run')}
diff --git a/components/chat/header/excel-upload.tsx b/components/chat/header/excel-upload.tsx index df623ad..6cc018c 100644 --- a/components/chat/header/excel-upload.tsx +++ b/components/chat/header/excel-upload.tsx @@ -3,6 +3,7 @@ import { Upload, UploadProps, Button, message, UploadFile, Tooltip } from 'antd' import { LinkOutlined, SelectOutlined, UploadOutlined } from '@ant-design/icons'; import { apiInterceptors, postChatModeParamsFileLoad } from '@/client/api'; import { ChatContext } from '@/app/chat-context'; +import { useTranslation } from 'react-i18next'; interface Props { convUid: string; @@ -11,6 +12,7 @@ interface Props { } function ExcelUpload({ convUid, chatMode, onComplete, ...props }: PropsWithChildren) { + const { t } = useTranslation(); const [loading, setLoading] = useState(false); const [messageApi, contextHolder] = message.useMessage(); const [fileList, setFileList] = useState([]); @@ -86,7 +88,7 @@ function ExcelUpload({ convUid, chatMode, onComplete, ...props }: PropsWithChild {...props} > diff --git a/components/chat/mode-tab/index.tsx b/components/chat/mode-tab/index.tsx index 123cb51..607d9b5 100644 --- a/components/chat/mode-tab/index.tsx +++ b/components/chat/mode-tab/index.tsx @@ -1,11 +1,20 @@ +/* + * @Date: 2024-05-14 15:41:13 + * @LastEditors: CZH + * @LastEditTime: 2024-05-22 18:09:12 + * @FilePath: /DB-GPT-Web/components/chat/mode-tab/index.tsx + */ import './index.css'; import { useContext } from 'react'; import { ChatContext } from '@/app/chat-context'; import { Radio } from 'antd'; import Icon, { AppstoreFilled } from '@ant-design/icons'; import { StarsSvg } from '@/components/icons'; +import { useTranslation } from 'react-i18next'; export default function ModeTab() { + const { t } = useTranslation(); + const { isContract, setIsContract, scene } = useContext(ChatContext); const isShow = scene && ['chat_with_db_execute', 'chat_dashboard'].includes(scene as string); @@ -24,11 +33,11 @@ export default function ModeTab() { > - Preview + {t('Preview')} - Editor + {t('Editor')} ); diff --git a/components/chat/monaco-editor.tsx b/components/chat/monaco-editor.tsx index dbe48e5..1263d2e 100644 --- a/components/chat/monaco-editor.tsx +++ b/components/chat/monaco-editor.tsx @@ -1,38 +1,72 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js'; import Editor, { OnChange, loader } from '@monaco-editor/react'; import classNames from 'classnames'; -import { useMemo } from 'react'; -import { format } from 'sql-formatter'; +import { useContext, useMemo } from 'react'; +import { formatSql } from '@/utils'; +import { getModelService } from './ob-editor/service'; +import { useLatest } from 'ahooks'; +import { ChatContext } from '@/app/chat-context'; +import { github, githubDark } from './ob-editor/theme'; +import { register } from './ob-editor/ob-plugin'; loader.config({ monaco }); +export interface ISession { + getTableList: (schemaName?: string) => Promise; + getTableColumns: (tableName: string) => Promise<{ columnName: string; columnType: string }[]>; + getSchemaList: () => Promise; +} + interface MonacoEditorProps { className?: string; value: string; language: string; onChange?: OnChange; thoughts?: string; + session?: ISession; + } -export default function MonacoEditor({ className, value, language = 'mysql', onChange, thoughts }: MonacoEditorProps) { +let plugin = null; +monaco.editor.defineTheme('github', github as any); +monaco.editor.defineTheme('githubDark', githubDark as any); + +export default function MonacoEditor({ className, value, language = 'mysql', onChange, thoughts, session }: MonacoEditorProps) { // merge value and thoughts const editorValue = useMemo(() => { if (language !== 'mysql') { return value; } if (thoughts && thoughts.length > 0) { - return format(`-- ${thoughts} \n${value}`); + return formatSql(`-- ${thoughts} \n${value}`); } - return format(value); + return formatSql(value); }, [value, thoughts]); + const sessionRef = useLatest(session); + + const context = useContext(ChatContext); + + async function pluginRegister(editor: monaco.editor.IStandaloneCodeEditor) { + const plugin = await register() + plugin.setModelOptions( + editor.getModel()?.id || '', + getModelService({ + modelId: editor.getModel()?.id || '', + delimiter: ';', + }, () => sessionRef.current || null) + ) + } + + return ( { + window.obMonaco = { + getWorkerUrl: (type: string) => { + switch (type) { + case 'mysql': { + return location.origin + '/_next/static/ob-workers/mysql.js' + } + case 'obmysql': { + return location.origin + '/_next/static/ob-workers/obmysql.js' + } + case 'oboracle': { + return location.origin + '/_next/static/ob-workers/oracle.js' + } + } + return ""; + } + } + const module = await import('@oceanbase-odc/monaco-plugin-ob') + const Plugin = module.default; + if (plugin) { + return plugin; + } + plugin = new Plugin(); + plugin.setup(["mysql"]); + return plugin; +} diff --git a/components/chat/ob-editor/service.ts b/components/chat/ob-editor/service.ts new file mode 100644 index 0000000..21f1b18 --- /dev/null +++ b/components/chat/ob-editor/service.ts @@ -0,0 +1,21 @@ +import type { IModelOptions } from '@oceanbase-odc/monaco-plugin-ob/dist/type'; +import { ISession } from '../monaco-editor'; + + +export function getModelService( + { modelId, delimiter }: { modelId: string; delimiter: string }, + session?: () => ISession | null +): IModelOptions { + return { + delimiter, + async getTableList(schemaName?: string) { + return session?.()?.getTableList(schemaName) || [] + }, + async getTableColumns(tableName: string, dbName?: string) { + return session?.()?.getTableColumns(tableName) || [] + }, + async getSchemaList() { + return session?.()?.getSchemaList() || [] + }, + }; +} diff --git a/components/chat/ob-editor/theme.ts b/components/chat/ob-editor/theme.ts new file mode 100644 index 0000000..159ccaf --- /dev/null +++ b/components/chat/ob-editor/theme.ts @@ -0,0 +1,698 @@ +export const github = { + base: 'vs', + inherit: true, + rules: [ + { + background: 'ffffff', + token: '', + }, + { + foreground: '6a737d', + token: 'comment', + }, + { + foreground: '6a737d', + token: 'punctuation.definition.comment', + }, + { + foreground: '6a737d', + token: 'string.comment', + }, + { + foreground: '005cc5', + token: 'constant', + }, + { + foreground: '005cc5', + token: 'entity.name.constant', + }, + { + foreground: '005cc5', + token: 'variable.other.constant', + }, + { + foreground: '005cc5', + token: 'variable.language', + }, + { + foreground: '6f42c1', + token: 'entity', + }, + { + foreground: '6f42c1', + token: 'entity.name', + }, + { + foreground: '24292e', + token: 'variable.parameter.function', + }, + { + foreground: '22863a', + token: 'entity.name.tag', + }, + { + foreground: 'd73a49', + token: 'keyword', + }, + { + foreground: 'd73a49', + token: 'storage', + }, + { + foreground: 'd73a49', + token: 'storage.type', + }, + { + foreground: '24292e', + token: 'storage.modifier.package', + }, + { + foreground: '24292e', + token: 'storage.modifier.import', + }, + { + foreground: '24292e', + token: 'storage.type.java', + }, + { + foreground: '032f62', + token: 'string', + }, + { + foreground: '032f62', + token: 'punctuation.definition.string', + }, + { + foreground: '032f62', + token: 'string punctuation.section.embedded source', + }, + { + foreground: '005cc5', + token: 'support', + }, + { + foreground: '005cc5', + token: 'meta.property-name', + }, + { + foreground: 'e36209', + token: 'variable', + }, + { + foreground: '24292e', + token: 'variable.other', + }, + { + foreground: 'b31d28', + fontStyle: 'bold italic underline', + token: 'invalid.broken', + }, + { + foreground: 'b31d28', + fontStyle: 'bold italic underline', + token: 'invalid.deprecated', + }, + { + foreground: 'fafbfc', + background: 'b31d28', + fontStyle: 'italic underline', + token: 'invalid.illegal', + }, + { + foreground: 'fafbfc', + background: 'd73a49', + fontStyle: 'italic underline', + token: 'carriage-return', + }, + { + foreground: 'b31d28', + fontStyle: 'bold italic underline', + token: 'invalid.unimplemented', + }, + { + foreground: 'b31d28', + token: 'message.error', + }, + { + foreground: '24292e', + token: 'string source', + }, + { + foreground: '005cc5', + token: 'string variable', + }, + { + foreground: '032f62', + token: 'source.regexp', + }, + { + foreground: '032f62', + token: 'string.regexp', + }, + { + foreground: '032f62', + token: 'string.regexp.character-class', + }, + { + foreground: '032f62', + token: 'string.regexp constant.character.escape', + }, + { + foreground: '032f62', + token: 'string.regexp source.ruby.embedded', + }, + { + foreground: '032f62', + token: 'string.regexp string.regexp.arbitrary-repitition', + }, + { + foreground: '22863a', + fontStyle: 'bold', + token: 'string.regexp constant.character.escape', + }, + { + foreground: '005cc5', + token: 'support.constant', + }, + { + foreground: '005cc5', + token: 'support.variable', + }, + { + foreground: '005cc5', + token: 'meta.module-reference', + }, + { + foreground: '735c0f', + token: 'markup.list', + }, + { + foreground: '005cc5', + fontStyle: 'bold', + token: 'markup.heading', + }, + { + foreground: '005cc5', + fontStyle: 'bold', + token: 'markup.heading entity.name', + }, + { + foreground: '22863a', + token: 'markup.quote', + }, + { + foreground: '24292e', + fontStyle: 'italic', + token: 'markup.italic', + }, + { + foreground: '24292e', + fontStyle: 'bold', + token: 'markup.bold', + }, + { + foreground: '005cc5', + token: 'markup.raw', + }, + { + foreground: 'b31d28', + background: 'ffeef0', + token: 'markup.deleted', + }, + { + foreground: 'b31d28', + background: 'ffeef0', + token: 'meta.diff.header.from-file', + }, + { + foreground: 'b31d28', + background: 'ffeef0', + token: 'punctuation.definition.deleted', + }, + { + foreground: '22863a', + background: 'f0fff4', + token: 'markup.inserted', + }, + { + foreground: '22863a', + background: 'f0fff4', + token: 'meta.diff.header.to-file', + }, + { + foreground: '22863a', + background: 'f0fff4', + token: 'punctuation.definition.inserted', + }, + { + foreground: 'e36209', + background: 'ffebda', + token: 'markup.changed', + }, + { + foreground: 'e36209', + background: 'ffebda', + token: 'punctuation.definition.changed', + }, + { + foreground: 'f6f8fa', + background: '005cc5', + token: 'markup.ignored', + }, + { + foreground: 'f6f8fa', + background: '005cc5', + token: 'markup.untracked', + }, + { + foreground: '6f42c1', + fontStyle: 'bold', + token: 'meta.diff.range', + }, + { + foreground: '005cc5', + token: 'meta.diff.header', + }, + { + foreground: '005cc5', + fontStyle: 'bold', + token: 'meta.separator', + }, + { + foreground: '005cc5', + token: 'meta.output', + }, + { + foreground: '586069', + token: 'brackethighlighter.tag', + }, + { + foreground: '586069', + token: 'brackethighlighter.curly', + }, + { + foreground: '586069', + token: 'brackethighlighter.round', + }, + { + foreground: '586069', + token: 'brackethighlighter.square', + }, + { + foreground: '586069', + token: 'brackethighlighter.angle', + }, + { + foreground: '586069', + token: 'brackethighlighter.quote', + }, + { + foreground: 'b31d28', + token: 'brackethighlighter.unmatched', + }, + { + foreground: 'b31d28', + token: 'sublimelinter.mark.error', + }, + { + foreground: 'e36209', + token: 'sublimelinter.mark.warning', + }, + { + foreground: '959da5', + token: 'sublimelinter.gutter-mark', + }, + { + foreground: '032f62', + fontStyle: 'underline', + token: 'constant.other.reference.link', + }, + { + foreground: '032f62', + fontStyle: 'underline', + token: 'string.other.link', + }, + ], + colors: { + 'editor.foreground': '#24292e', + 'editor.background': '#ffffff', + 'editor.selectionBackground': '#c8c8fa', + 'editor.inactiveSelectionBackground': '#fafbfc', + 'editor.lineHighlightBackground': '#fafbfc', + 'editorCursor.foreground': '#24292e', + 'editorWhitespace.foreground': '#959da5', + 'editorIndentGuide.background': '#959da5', + 'editorIndentGuide.activeBackground': '#24292e', + 'editor.selectionHighlightBorder': '#fafbfc', + }, + }; + + export const githubDark = { + base: 'vs-dark', + inherit: true, + rules: [ + { + background: '24292e', + token: '', + }, + { + foreground: '959da5', + token: 'comment', + }, + { + foreground: '959da5', + token: 'punctuation.definition.comment', + }, + { + foreground: '959da5', + token: 'string.comment', + }, + { + foreground: 'c8e1ff', + token: 'constant', + }, + { + foreground: 'c8e1ff', + token: 'entity.name.constant', + }, + { + foreground: 'c8e1ff', + token: 'variable.other.constant', + }, + { + foreground: 'c8e1ff', + token: 'variable.language', + }, + { + foreground: 'b392f0', + token: 'entity', + }, + { + foreground: 'b392f0', + token: 'entity.name', + }, + { + foreground: 'f6f8fa', + token: 'variable.parameter.function', + }, + { + foreground: '7bcc72', + token: 'entity.name.tag', + }, + { + foreground: 'ea4a5a', + token: 'keyword', + }, + { + foreground: 'ea4a5a', + token: 'storage', + }, + { + foreground: 'ea4a5a', + token: 'storage.type', + }, + { + foreground: 'f6f8fa', + token: 'storage.modifier.package', + }, + { + foreground: 'f6f8fa', + token: 'storage.modifier.import', + }, + { + foreground: 'f6f8fa', + token: 'storage.type.java', + }, + { + foreground: '79b8ff', + token: 'string', + }, + { + foreground: '79b8ff', + token: 'punctuation.definition.string', + }, + { + foreground: '79b8ff', + token: 'string punctuation.section.embedded source', + }, + { + foreground: 'c8e1ff', + token: 'support', + }, + { + foreground: 'c8e1ff', + token: 'meta.property-name', + }, + { + foreground: 'fb8532', + token: 'variable', + }, + { + foreground: 'f6f8fa', + token: 'variable.other', + }, + { + foreground: 'd73a49', + fontStyle: 'bold italic underline', + token: 'invalid.broken', + }, + { + foreground: 'd73a49', + fontStyle: 'bold italic underline', + token: 'invalid.deprecated', + }, + { + foreground: 'fafbfc', + background: 'd73a49', + fontStyle: 'italic underline', + token: 'invalid.illegal', + }, + { + foreground: 'fafbfc', + background: 'd73a49', + fontStyle: 'italic underline', + token: 'carriage-return', + }, + { + foreground: 'd73a49', + fontStyle: 'bold italic underline', + token: 'invalid.unimplemented', + }, + { + foreground: 'd73a49', + token: 'message.error', + }, + { + foreground: 'f6f8fa', + token: 'string source', + }, + { + foreground: 'c8e1ff', + token: 'string variable', + }, + { + foreground: '79b8ff', + token: 'source.regexp', + }, + { + foreground: '79b8ff', + token: 'string.regexp', + }, + { + foreground: '79b8ff', + token: 'string.regexp.character-class', + }, + { + foreground: '79b8ff', + token: 'string.regexp constant.character.escape', + }, + { + foreground: '79b8ff', + token: 'string.regexp source.ruby.embedded', + }, + { + foreground: '79b8ff', + token: 'string.regexp string.regexp.arbitrary-repitition', + }, + { + foreground: '7bcc72', + fontStyle: 'bold', + token: 'string.regexp constant.character.escape', + }, + { + foreground: 'c8e1ff', + token: 'support.constant', + }, + { + foreground: 'c8e1ff', + token: 'support.variable', + }, + { + foreground: 'c8e1ff', + token: 'meta.module-reference', + }, + { + foreground: 'fb8532', + token: 'markup.list', + }, + { + foreground: '0366d6', + fontStyle: 'bold', + token: 'markup.heading', + }, + { + foreground: '0366d6', + fontStyle: 'bold', + token: 'markup.heading entity.name', + }, + { + foreground: 'c8e1ff', + token: 'markup.quote', + }, + { + foreground: 'f6f8fa', + fontStyle: 'italic', + token: 'markup.italic', + }, + { + foreground: 'f6f8fa', + fontStyle: 'bold', + token: 'markup.bold', + }, + { + foreground: 'c8e1ff', + token: 'markup.raw', + }, + { + foreground: 'b31d28', + background: 'ffeef0', + token: 'markup.deleted', + }, + { + foreground: 'b31d28', + background: 'ffeef0', + token: 'meta.diff.header.from-file', + }, + { + foreground: 'b31d28', + background: 'ffeef0', + token: 'punctuation.definition.deleted', + }, + { + foreground: '176f2c', + background: 'f0fff4', + token: 'markup.inserted', + }, + { + foreground: '176f2c', + background: 'f0fff4', + token: 'meta.diff.header.to-file', + }, + { + foreground: '176f2c', + background: 'f0fff4', + token: 'punctuation.definition.inserted', + }, + { + foreground: 'b08800', + background: 'fffdef', + token: 'markup.changed', + }, + { + foreground: 'b08800', + background: 'fffdef', + token: 'punctuation.definition.changed', + }, + { + foreground: '2f363d', + background: '959da5', + token: 'markup.ignored', + }, + { + foreground: '2f363d', + background: '959da5', + token: 'markup.untracked', + }, + { + foreground: 'b392f0', + fontStyle: 'bold', + token: 'meta.diff.range', + }, + { + foreground: 'c8e1ff', + token: 'meta.diff.header', + }, + { + foreground: '0366d6', + fontStyle: 'bold', + token: 'meta.separator', + }, + { + foreground: '0366d6', + token: 'meta.output', + }, + { + foreground: 'ffeef0', + token: 'brackethighlighter.tag', + }, + { + foreground: 'ffeef0', + token: 'brackethighlighter.curly', + }, + { + foreground: 'ffeef0', + token: 'brackethighlighter.round', + }, + { + foreground: 'ffeef0', + token: 'brackethighlighter.square', + }, + { + foreground: 'ffeef0', + token: 'brackethighlighter.angle', + }, + { + foreground: 'ffeef0', + token: 'brackethighlighter.quote', + }, + { + foreground: 'd73a49', + token: 'brackethighlighter.unmatched', + }, + { + foreground: 'd73a49', + token: 'sublimelinter.mark.error', + }, + { + foreground: 'fb8532', + token: 'sublimelinter.mark.warning', + }, + { + foreground: '6a737d', + token: 'sublimelinter.gutter-mark', + }, + { + foreground: '79b8ff', + fontStyle: 'underline', + token: 'constant.other.reference.link', + }, + { + foreground: '79b8ff', + fontStyle: 'underline', + token: 'string.other.link', + }, + ], + colors: { + 'editor.foreground': '#f6f8fa', + 'editor.background': '#24292e', + 'editor.selectionBackground': '#4c2889', + 'editor.inactiveSelectionBackground': '#444d56', + 'editor.lineHighlightBackground': '#444d56', + 'editorCursor.foreground': '#ffffff', + 'editorWhitespace.foreground': '#6a737d', + 'editorIndentGuide.background': '#6a737d', + 'editorIndentGuide.activeBackground': '#f6f8fa', + 'editor.selectionHighlightBorder': '#444d56', + }, + }; + \ No newline at end of file diff --git a/components/database/form-dialog.tsx b/components/database/form-dialog.tsx index 4e7fcb6..fcffd06 100644 --- a/components/database/form-dialog.tsx +++ b/components/database/form-dialog.tsx @@ -79,43 +79,43 @@ function FormDialog({ open, choiceDBType, dbTypeList, editValue, dbNames, onClos return (
- + {fileDb === true && ( - + )} {fileDb === false && ( <> - + - + - + - + )} - + diff --git a/components/flow/flow-card.tsx b/components/flow/flow-card.tsx index 63e5ee4..96d074b 100644 --- a/components/flow/flow-card.tsx +++ b/components/flow/flow-card.tsx @@ -59,9 +59,9 @@ const FlowCard: React.FC = ({ flow, onCopy, deleteCallback }) => title: t('Tips'), icon: , content: t('delete_flow_confirm'), - okText: 'Yes', + okText: t('yes'), okType: 'danger', - cancelText: 'No', + cancelText: t('no'), async onOk() { deleteFlow(); }, diff --git a/components/knowledge/doc-panel.tsx b/components/knowledge/doc-panel.tsx index 7f73b51..5cb408e 100644 --- a/components/knowledge/doc-panel.tsx +++ b/components/knowledge/doc-panel.tsx @@ -38,9 +38,9 @@ export default function DocPanel(props: IProps) { title: t('Tips'), icon: , content: `${t('Del_Document_Tips')}?`, - okText: 'Yes', + okText: t('yes'), okType: 'danger', - cancelText: 'No', + cancelText: t('no'), async onOk() { await handleDelete(row); }, @@ -195,7 +195,7 @@ export default function DocPanel(props: IProps) { return ( ); @@ -208,7 +208,7 @@ export default function DocPanel(props: IProps) { {t('Add_Datasource')} diff --git a/components/knowledge/segmentation.tsx b/components/knowledge/segmentation.tsx index 7615764..8fa55ad 100644 --- a/components/knowledge/segmentation.tsx +++ b/components/knowledge/segmentation.tsx @@ -121,7 +121,7 @@ export default function Segmentation(props: IProps) { function renderStrategy() { if (!strategies || !strategies.length) { - return ; + return ; } return ( diff --git a/components/knowledge/space-card.tsx b/components/knowledge/space-card.tsx index 1a10ebf..e9082c9 100644 --- a/components/knowledge/space-card.tsx +++ b/components/knowledge/space-card.tsx @@ -27,9 +27,9 @@ export default function SpaceCard(props: IProps) { title: t('Tips'), icon: , content: `${t('Del_Knowledge_Tips')}?`, - okText: 'Yes', + okText: t('yes'), okType: 'danger', - cancelText: 'No', + cancelText: t('no'), async onOk() { await apiInterceptors(delSpace({ name: space?.name })); getSpaces(); diff --git a/components/layout/side-bar.tsx b/components/layout/side-bar.tsx index b6afc91..133f949 100644 --- a/components/layout/side-bar.tsx +++ b/components/layout/side-bar.tsx @@ -181,8 +181,8 @@ function SideBar() { const handleDelChat = useCallback( (dialogue: IChatDialogueSchema) => { Modal.confirm({ - title: 'Delete Chat', - content: 'Are you sure delete this chat?', + title: t('Delete_Chat'), + content: t('Are_you_sure_delete_this_chat'), width: '276px', centered: true, onOk() { diff --git a/components/model/model-form.tsx b/components/model/model-form.tsx index 91f4e13..eba5e8d 100644 --- a/components/model/model-form.tsx +++ b/components/model/model-form.tsx @@ -66,7 +66,7 @@ function ModelForm({ onCancel, onSuccess }: { onCancel: () => void; onSuccess: ( return (
- + = () => { > - +