feat(web): 🎨 Unified color theme, AntV light/dark theme switching, Antd first-screen style loading. (#1020)

Co-authored-by: 黄振洪 <hzh01509324@alibaba-inc.com>
Co-authored-by: Aralhi <xiaoping0501@gmail.com>
This commit is contained in:
Hzh_97 2024-01-12 09:44:52 +08:00 committed by GitHub
parent 2706e27ae5
commit 99ea6ac1a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
99 changed files with 1125 additions and 1410 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
self.__BUILD_MANIFEST=function(s,c,a,e,t,n,f,k,b,d,h,i,u,j){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/29107295-90b90cb30c825230.js",s,c,e,a,f,k,b,h,"static/chunks/861-78929b4f98dbbfd6.js","static/chunks/161-96143606b49cf4a1.js","static/chunks/pages/index-b30059f0329edf15.js"],"/_error":["static/chunks/pages/_error-dee72aff9b2e2c12.js"],"/agent":[s,c,a,t,f,n,"static/chunks/pages/agent-a2599efbeb46e056.js"],"/chat":["static/chunks/pages/chat-8b763b43883b00b9.js"],"/database":[s,c,e,a,t,n,b,d,"static/chunks/643-467e61c6d77597ec.js","static/chunks/pages/database-7eb9981fa487ec35.js"],"/knowledge":[i,s,c,a,t,f,n,b,u,d,h,"static/chunks/510-6b065a4e7b3cafae.js","static/chunks/pages/knowledge-c7727428949d032f.js"],"/knowledge/chunk":[s,e,t,k,n,"static/chunks/pages/knowledge/chunk-dfe9414f9931a610.js"],"/models":[i,s,c,e,a,j,d,"static/chunks/pages/models-ea9125060607276a.js"],"/prompt":[s,c,e,a,j,k,u,"static/chunks/346-8340afd21e100a59.js","static/chunks/607-ecec81b815dc298b.js","static/chunks/pages/prompt-fca5ed813d5018b1.js"],sortedPages:["/","/_app","/_error","/agent","/chat","/database","/knowledge","/knowledge/chunk","/models","/prompt"]}}("static/chunks/113-15fc0b8bd2b5b9a1.js","static/chunks/17-26dc9ac6c4adec30.js","static/chunks/479-784a3b3622f6eb73.js","static/chunks/9-31700d34ab596955.js","static/chunks/442-d388a67ef689277f.js","static/chunks/813-cce9482e33f2430c.js","static/chunks/553-a89ad624ca0f1ffa.js","static/chunks/810-120b98a5da95cba3.js","static/chunks/411-b5d3e7f64bee2335.js","static/chunks/928-5a69f9ff4dc4129f.js","static/chunks/234-42f62dc360b2d9e4.js","static/chunks/75fc9c18-a784766a129ec5fb.js","static/chunks/45-9ff739c09925ea35.js","static/chunks/947-67d02f4a972e8fe4.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
self.__BUILD_MANIFEST=function(s,c,a,e,t,n,d,f,k,b,h,i,u,j){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/29107295-90b90cb30c825230.js",s,c,e,a,d,f,k,h,"static/chunks/861-78929b4f98dbbfd6.js","static/chunks/161-96143606b49cf4a1.js","static/chunks/pages/index-ba9785759e4fc934.js"],"/_error":["static/chunks/pages/_error-dee72aff9b2e2c12.js"],"/agent":[s,c,a,t,d,n,"static/chunks/pages/agent-a2599efbeb46e056.js"],"/chat":["static/chunks/pages/chat-47a20abbae16e858.js"],"/chat/[scene]/[id]":["static/chunks/pages/chat/[scene]/[id]-8df445f91cde33fa.js"],"/database":[s,c,e,a,t,n,k,b,"static/chunks/643-d8f53f40dd3c5b40.js","static/chunks/pages/database-d36f41810fc357a6.js"],"/knowledge":[i,s,c,a,t,d,n,k,u,b,h,"static/chunks/10-f02ccef88f814547.js","static/chunks/pages/knowledge-921c3cd06909a8e5.js"],"/knowledge/chunk":[s,e,t,f,n,"static/chunks/pages/knowledge/chunk-652744b9d90c26c9.js"],"/models":[i,s,c,e,a,j,b,"static/chunks/pages/models-1145859ba0e2f20a.js"],"/prompt":[s,c,e,a,j,f,u,"static/chunks/346-b0aea1c99abd6f1e.js","static/chunks/607-2dedaf19149304c0.js","static/chunks/pages/prompt-fca5ed813d5018b1.js"],sortedPages:["/","/_app","/_error","/agent","/chat","/chat/[scene]/[id]","/database","/knowledge","/knowledge/chunk","/models","/prompt"]}}("static/chunks/113-15fc0b8bd2b5b9a1.js","static/chunks/17-d6c52cecd9ecc451.js","static/chunks/479-33b3ebe9be79a971.js","static/chunks/9-bb2c54d5c06ba4bf.js","static/chunks/442-197e6cbc1e54109a.js","static/chunks/813-cce9482e33f2430c.js","static/chunks/553-a89ad624ca0f1ffa.js","static/chunks/810-84757da754c6f3fc.js","static/chunks/411-b5d3e7f64bee2335.js","static/chunks/928-74244889bd7f2699.js","static/chunks/234-42f62dc360b2d9e4.js","static/chunks/75fc9c18-a784766a129ec5fb.js","static/chunks/45-9ff739c09925ea35.js","static/chunks/947-5980a3ff49069ddd.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

9
web/.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"tabWidth": 2,
"printWidth": 150,
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"jsxSingleQuote": false,
"arrowParens": "always"
}

View File

@ -3,8 +3,12 @@ import { apiInterceptors, getDialogueList, getUsableModels } from '@/client/api'
import { useRequest } from 'ahooks';
import { ChatHistoryResponse, DialogueListResponse, IChatDialogueSchema } from '@/types/chat';
import { useSearchParams } from 'next/navigation';
import { STORAGE_THEME_KEY } from '@/utils';
type ThemeMode = 'dark' | 'light';
interface IChatContext {
mode: ThemeMode;
isContract?: boolean;
isMenuExpand?: boolean;
scene: IChatDialogueSchema['chat_mode'] | (string & {});
@ -14,6 +18,7 @@ interface IChatContext {
modelList: Array<string>;
agentList: string[];
dialogueList?: DialogueListResponse;
setMode: (mode: ThemeMode) => void;
setAgentList?: (val: string[]) => void;
setModel: (val: string) => void;
setIsContract: (val: boolean) => void;
@ -28,7 +33,14 @@ interface IChatContext {
setDocId: (docId: number) => void;
}
function getDefaultTheme(): ThemeMode {
const theme = localStorage.getItem(STORAGE_THEME_KEY) as ThemeMode;
if (theme) return theme;
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
const ChatContext = createContext<IChatContext>({
mode: 'light',
scene: '',
chatId: '',
modelList: [],
@ -43,6 +55,7 @@ const ChatContext = createContext<IChatContext>({
setDbParam: () => void 0,
queryDialogueList: () => {},
refreshDialogList: () => {},
setMode: () => void 0,
history: [],
setHistory: () => {},
docId: undefined,
@ -54,6 +67,7 @@ const ChatContextProvider = ({ children }: { children: React.ReactElement }) =>
const chatId = searchParams?.get('id') ?? '';
const scene = searchParams?.get('scene') ?? '';
const db_param = searchParams?.get('db_param') ?? '';
const [isContract, setIsContract] = useState(false);
const [model, setModel] = useState<string>('');
const [isMenuExpand, setIsMenuExpand] = useState<boolean>(scene !== 'chat_dashboard');
@ -61,6 +75,7 @@ const ChatContextProvider = ({ children }: { children: React.ReactElement }) =>
const [agentList, setAgentList] = useState<string[]>([]);
const [history, setHistory] = useState<ChatHistoryResponse>([]);
const [docId, setDocId] = useState<number>();
const [mode, setMode] = useState<ThemeMode>();
const {
run: queryDialogueList,
@ -80,6 +95,11 @@ const ChatContextProvider = ({ children }: { children: React.ReactElement }) =>
const [, res] = await apiInterceptors(getUsableModels());
return res ?? [];
});
useEffect(() => {
setMode(getDefaultTheme());
}, []);
useEffect(() => {
setModel(modelList[0]);
}, [modelList, modelList?.length]);
@ -95,6 +115,8 @@ const ChatContextProvider = ({ children }: { children: React.ReactElement }) =>
dbParam: dbParam || db_param,
dialogueList,
agentList,
mode,
setMode,
setAgentList,
setModel,
setIsContract,

View File

@ -1,377 +1,390 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
const resources = {
en: {
translation: {
Knowledge_Space: 'Knowledge',
space: 'space',
Vector: 'Vector',
Owner: 'Owner',
Count: 'Count',
File_type_Invalid: 'The file type is invalid',
Knowledge_Space_Config: 'Space Config',
Choose_a_Datasource_type: 'Datasource type',
Segmentation: 'Segmentation',
No_parameter: `No segementation parameter required.`,
Knowledge_Space_Name: 'Knowledge Space Name',
Please_input_the_name: 'Please input the name',
Please_input_the_owner: 'Please input the owner',
Please_select_file: 'Please select one file',
Description: 'Description',
Please_input_the_description: 'Please input the description',
Next: 'Next',
the_name_can_only_contain: 'the name can only contain numbers, letters, Chinese characters, "-" and "_"',
Text: 'Text',
'Fill your raw text': 'Fill your raw text',
URL: 'URL',
Fetch_the_content_of_a_URL: 'Fetch the content of a URL',
Document: 'Document',
Upload_a_document: 'Upload a document, document type can be PDF, CSV, Text, PowerPoint, Word, Markdown',
Name: 'Name',
Text_Source: 'Text Source(Optional)',
Please_input_the_text_source: 'Please input the text source',
Sync: 'Sync',
Back: 'Back',
Finish: 'Finish',
Web_Page_URL: 'Web Page URL',
Please_input_the_Web_Page_URL: 'Please input the Web Page URL',
Select_or_Drop_file: 'Select or Drop file',
Documents: 'Documents',
Chat: 'Chat',
Add_Datasource: 'Add Datasource',
Arguments: 'Arguments',
Type: 'Type',
Size: 'Size',
Last_Sync: 'Last Sync',
Status: 'Status',
Result: 'Result',
Details: 'Details',
Delete: 'Delete',
Operation: 'Operation',
Submit: 'Submit',
Chunks: 'Chunks',
Content: 'Content',
Meta_Data: 'Meta Data',
Please_select_a_file: 'Please select a file',
Please_input_the_text: 'Please input the text',
Embedding: 'Embedding',
topk: 'topk',
the_top_k_vectors: 'the top k vectors based on similarity score',
recall_score: 'recall_score',
Set_a_threshold_score: 'Set a threshold score for the retrieval of similar vectors',
recall_type: 'recall_type',
model: 'model',
A_model_used: 'A model used to create vector representations of text or other data',
Automatic: 'Automatic',
Process: 'Process',
Automatic_desc: 'Automatically set segmentation and preprocessing rules.',
chunk_size: 'chunk_size',
The_size_of_the_data_chunks: 'The size of the data chunks used in processing',
chunk_overlap: 'chunk_overlap',
The_amount_of_overlap: 'The amount of overlap between adjacent data chunks',
Prompt: 'Prompt',
scene: 'scene',
A_contextual_parameter: 'A contextual parameter used to define the setting or environment in which the prompt is being used',
template: 'template',
structure_or_format:
'A pre-defined structure or format for the prompt, which can help ensure that the AI system generates responses that are consistent with the desired style or tone.',
max_token: 'max_token',
max_iteration: 'max_iteration',
concurrency_limit: 'concurrency_limit',
The_maximum_number_of_tokens: 'The maximum number of tokens or words allowed in a prompt',
Theme: 'Theme',
Port: 'Port',
Username: 'Username',
Password: 'Password',
Remark: 'Remark',
Edit: 'Edit',
Database: 'Database',
Data_Source: 'Data Center',
Close_Sidebar: 'Fold',
Show_Sidebar: 'UnFold',
language: 'Language',
choose_model: 'Please choose a model',
data_center_desc: 'DB-GPT also offers a user-friendly data center management interface for efficient data maintenance.',
create_database: 'Create Database',
create_knowledge: 'Create Knowledge',
path: 'Path',
model_manage: 'Models',
stop_model_success: 'Stop model success',
create_model: 'Create Model',
model_select_tips: 'Please select a model',
submit: 'Submit',
close: 'Close',
start_model_success: 'Start model success',
download_model_tip: 'Please download model first.',
Plugins: 'Plugins',
try_again: 'Try again',
no_data: 'No data',
Open_Sidebar: 'Unfold',
cancel: 'Cancel',
Edit_Success: 'Edit Success',
Add: 'Add',
Add_Success: 'Add Success',
Error_Message: 'Something Error',
Please_Input: 'Please Input',
Prompt_Info_Scene: 'Scene',
Prompt_Info_Sub_Scene: 'Sub Scene',
Prompt_Info_Name: 'Name',
Prompt_Info_Content: 'Content',
Public: 'Public',
Private: 'Private',
Lowest: 'Lowest',
Missed: 'Missed',
Lost: 'Lost',
Incorrect: 'Incorrect',
Verbose: 'Verbose',
Best: 'Best',
Rating: 'Rating',
Q_A_Category: 'Q&A Category',
Q_A_Rating: 'Q&A Rating',
feed_back_desc:
'0: No results\n' +
'1: Results exist, but they are irrelevant, the question is not understood\n' +
'2: Results exist, the question is understood, but it indicates that the question cannot be answered\n' +
'3: Results exist, the question is understood, and an answer is given, but the answer is incorrect\n' +
'4: Results exist, the question is understood, the answer is correct, but it is verbose and lacks a summary\n' +
'5: Results exist, the question is understood, the answer is correct, the reasoning is correct, and a summary is provided, concise and to the point\n',
input_count: 'Total input',
input_unit: 'characters',
Copy: 'Copy',
Copy_success: 'Content copied successfully',
Copy_nothing: 'Content copied is empty',
Copry_error: 'Copy failed',
Click_Select: 'Click&Select',
Quick_Start: 'Quick Start',
Select_Plugins: 'Select Plugins',
Search: 'Search',
Update_From_Github: 'Upload From Github',
Reset: 'Reset',
Upload: 'Upload',
Market_Plugins: 'Market Plugin',
My_Plugins: 'My Plugins',
Del_Knowledge_Tips: 'Do you want delete the Space',
Del_Document_Tips: 'Do you want delete the Document',
Tips: 'Tips',
Limit_Upload_File_Count_Tips: 'Only one file can be uploaded at a time',
To_Plugin_Market: 'Go to the Plugin Market',
Summary: 'Summary',
stacked_column_chart: 'Stacked Column',
column_chart: 'Column',
percent_stacked_column_chart: 'Percent Stacked Column',
grouped_column_chart: 'Grouped Column',
time_column: 'Time Column',
pie_chart: 'Pie',
line_chart: 'Line',
area_chart: 'Area',
stacked_area_chart: 'Stacked Area',
scatter_plot: 'Scatter',
bubble_chart: 'Bubble',
stacked_bar_chart: 'Stacked Bar',
bar_chart: 'Bar',
percent_stacked_bar_chart: 'Percent Stacked Bar',
grouped_bar_chart: 'Grouped Bar',
water_fall_chart: 'Waterfall',
table: 'Table',
multi_line_chart: 'Multi Line',
multi_measure_column_chart: 'Multi Measure Column',
multi_measure_line_chart: 'Multi Measure Line',
Advices: 'Advices',
Retry: 'Retry',
Load_more: 'load more',
},
},
zh: {
translation: {
Knowledge_Space: '知识库',
space: '知识库',
Vector: '向量',
Owner: '创建人',
Count: '文档数',
File_type_Invalid: '文件类型错误',
Knowledge_Space_Config: '知识库配置',
Choose_a_Datasource_type: '知识库类型',
Segmentation: '分片',
No_parameter: '不需要配置分片参数',
Setup_the_Datasource: '处理',
Knowledge_Space_Name: '知识库名称',
Please_input_the_name: '请输入名称',
Please_input_the_owner: '请输入创建人',
Please_select_file: '请至少选择一个文件',
Description: '描述',
Please_input_the_description: '请输入描述',
Next: '下一步',
the_name_can_only_contain: '名称只能包含数字、字母、中文字符、-或_',
Text: '文本',
'Fill your raw text': '填写您的原始文本',
URL: '网址',
Fetch_the_content_of_a_URL: '获取 URL 的内容',
Document: '文档',
Upload_a_document: '上传文档文档类型可以是PDF、CSV、Text、PowerPoint、Word、Markdown',
Name: '名称',
Text_Source: '文本来源(可选)',
Please_input_the_text_source: '请输入文本来源',
Sync: '同步',
Back: '上一步',
Finish: '完成',
Web_Page_URL: '网页网址',
Please_input_the_Web_Page_URL: '请输入网页网址',
Select_or_Drop_file: '选择或拖拽文件',
Documents: '文档',
Chat: '对话',
Add_Datasource: '添加数据源',
Arguments: '参数',
Type: '类型',
Size: '切片',
Last_Sync: '上次同步时间',
Status: '状态',
Result: '结果',
Details: '明细',
Delete: '删除',
Operation: '操作',
Submit: '提交',
close: '关闭',
Chunks: '切片',
Content: '内容',
Meta_Data: '元数据',
Please_select_a_file: '请上传一个文件',
Please_input_the_text: '请输入文本',
Embedding: '嵌入',
topk: 'TopK',
the_top_k_vectors: '基于相似度得分的前 k 个向量',
recall_score: '召回分数',
Set_a_threshold_score: '设置相似向量检索的阈值分数',
recall_type: '召回类型',
model: '模型',
A_model_used: '用于创建文本或其他数据的矢量表示的模型',
Automatic: '自动切片',
Process: '切片处理',
Automatic_desc: '自动设置分割和预处理规则。',
chunk_size: '块大小',
The_size_of_the_data_chunks: '处理中使用的数据块的大小',
chunk_overlap: '块重叠',
The_amount_of_overlap: '相邻数据块之间的重叠量',
scene: '场景',
A_contextual_parameter: '用于定义使用提示的设置或环境的上下文参数',
template: '模板',
structure_or_format: '预定义的提示结构或格式,有助于确保人工智能系统生成与所需风格或语气一致的响应。',
max_token: '最大令牌',
max_iteration: '最大迭代',
concurrency_limit: '并发限制',
The_maximum_number_of_tokens: '提示中允许的最大标记或单词数',
Theme: '主题',
Port: '端口',
Username: '用户名',
Password: '密码',
Remark: '备注',
Edit: '编辑',
Database: '数据库',
Data_Source: '数据中心',
Close_Sidebar: '收起',
Show_Sidebar: '展开',
language: '语言',
choose_model: '请选择一个模型',
data_center_desc: 'DB-GPT支持数据库交互和基于文档的对话它还提供了一个用户友好的数据中心管理界面。',
create_database: '创建数据库',
create_knowledge: '创建知识库',
path: '路径',
model_manage: '模型管理',
stop_model_success: '模型停止成功',
create_model: '创建模型',
model_select_tips: '请选择一个模型',
submit: '提交',
start_model_success: '启动模型成功',
download_model_tip: '请先下载模型!',
Plugins: '插件列表',
try_again: '刷新重试',
no_data: '暂无数据',
Prompt: '提示语',
Open_Sidebar: '展开',
cancel: '取消',
Edit_Success: '编辑成功',
Add: '新增',
Add_Success: '新增成功',
Error_Message: '出错了',
Please_Input: '请输入',
Prompt_Info_Scene: '场景',
Prompt_Info_Sub_Scene: '次级场景',
Prompt_Info_Name: '名称',
Prompt_Info_Content: '内容',
Public: '公共',
Private: '私有',
Lowest: '渣渣',
Missed: '没理解',
Lost: '答不了',
Incorrect: '答错了',
Verbose: '较啰嗦',
Best: '真棒',
Rating: '评分',
Q_A_Category: '问答类别',
Q_A_Rating: '问答评分',
feed_back_desc:
'0: 无结果\n' +
'1: 有结果,但是在文不对题,没有理解问题\n' +
'2: 有结果,理解了问题,但是提示回答不了这个问题\n' +
'3: 有结果,理解了问题,并做出回答,但是回答的结果错误\n' +
'4: 有结果,理解了问题,回答结果正确,但是比较啰嗦,缺乏总结\n' +
'5: 有结果,理解了问题,回答结果正确,推理正确,并给出了总结,言简意赅\n',
input_count: '共计输入',
input_unit: '字',
Copy: '复制',
Copy_success: '内容复制成功',
Copy_nothing: '内容复制为空',
Copry_error: '复制失败',
Click_Select: '点击选择',
Quick_Start: '快速开始',
Select_Plugins: '选择插件',
Search: '搜索',
Reset: '重置',
Update_From_Github: '更新Github插件',
Upload: '上传',
Market_Plugins: '插件市场',
My_Plugins: '我的插件',
Del_Knowledge_Tips: '你确定删除该知识库吗',
Del_Document_Tips: '你确定删除该文档吗',
Tips: '提示',
Limit_Upload_File_Count_Tips: '一次只能上传一个文件',
To_Plugin_Market: '前往插件市场',
Summary: '总结',
stacked_column_chart: '堆叠柱状图',
column_chart: '柱状图',
percent_stacked_column_chart: '百分比堆叠柱状图',
grouped_column_chart: '簇形柱状图',
time_column: '簇形柱状图',
pie_chart: '饼图',
line_chart: '折线图',
area_chart: '面积图',
stacked_area_chart: '堆叠面积图',
scatter_plot: '散点图',
bubble_chart: '气泡图',
stacked_bar_chart: '堆叠条形图',
bar_chart: '条形图',
percent_stacked_bar_chart: '百分比堆叠条形图',
grouped_bar_chart: '簇形条形图',
water_fall_chart: '瀑布图',
table: '表格',
multi_line_chart: '多折线图',
multi_measure_column_chart: '多指标柱形图',
multi_measure_line_chart: '多指标折线图',
Advices: '自动推荐',
Retry: '重试',
Load_more: '加载更多',
},
},
};
const en = {
Knowledge_Space: 'Knowledge',
space: 'space',
Vector: 'Vector',
Owner: 'Owner',
Count: 'Count',
File_type_Invalid: 'The file type is invalid',
Knowledge_Space_Config: 'Space Config',
Choose_a_Datasource_type: 'Datasource type',
Segmentation: 'Segmentation',
No_parameter: `No segementation parameter required.`,
Knowledge_Space_Name: 'Knowledge Space Name',
Please_input_the_name: 'Please input the name',
Please_input_the_owner: 'Please input the owner',
Please_select_file: 'Please select one file',
Description: 'Description',
Please_input_the_description: 'Please input the description',
Next: 'Next',
the_name_can_only_contain: 'the name can only contain numbers, letters, Chinese characters, "-" and "_"',
Text: 'Text',
'Fill your raw text': 'Fill your raw text',
URL: 'URL',
Fetch_the_content_of_a_URL: 'Fetch the content of a URL',
Document: 'Document',
Upload_a_document: 'Upload a document, document type can be PDF, CSV, Text, PowerPoint, Word, Markdown',
Name: 'Name',
Text_Source: 'Text Source(Optional)',
Please_input_the_text_source: 'Please input the text source',
Sync: 'Sync',
Back: 'Back',
Finish: 'Finish',
Web_Page_URL: 'Web Page URL',
Please_input_the_Web_Page_URL: 'Please input the Web Page URL',
Select_or_Drop_file: 'Select or Drop file',
Documents: 'Documents',
Chat: 'Chat',
Add_Datasource: 'Add Datasource',
Arguments: 'Arguments',
Type: 'Type',
Size: 'Size',
Last_Sync: 'Last Sync',
Status: 'Status',
Result: 'Result',
Details: 'Details',
Delete: 'Delete',
Operation: 'Operation',
Submit: 'Submit',
Chunks: 'Chunks',
Content: 'Content',
Meta_Data: 'Meta Data',
Please_select_a_file: 'Please select a file',
Please_input_the_text: 'Please input the text',
Embedding: 'Embedding',
topk: 'topk',
the_top_k_vectors: 'the top k vectors based on similarity score',
recall_score: 'recall_score',
Set_a_threshold_score: 'Set a threshold score for the retrieval of similar vectors',
recall_type: 'recall_type',
model: 'model',
A_model_used: 'A model used to create vector representations of text or other data',
Automatic: 'Automatic',
Process: 'Process',
Automatic_desc: 'Automatically set segmentation and preprocessing rules.',
chunk_size: 'chunk_size',
The_size_of_the_data_chunks: 'The size of the data chunks used in processing',
chunk_overlap: 'chunk_overlap',
The_amount_of_overlap: 'The amount of overlap between adjacent data chunks',
Prompt: 'Prompt',
scene: 'scene',
A_contextual_parameter: 'A contextual parameter used to define the setting or environment in which the prompt is being used',
template: 'template',
structure_or_format:
'A pre-defined structure or format for the prompt, which can help ensure that the AI system generates responses that are consistent with the desired style or tone.',
max_token: 'max_token',
max_iteration: 'max_iteration',
concurrency_limit: 'concurrency_limit',
The_maximum_number_of_tokens: 'The maximum number of tokens or words allowed in a prompt',
Theme: 'Theme',
Port: 'Port',
Username: 'Username',
Password: 'Password',
Remark: 'Remark',
Edit: 'Edit',
Database: 'Database',
Data_Source: 'Data Center',
Close_Sidebar: 'Fold',
Show_Sidebar: 'UnFold',
language: 'Language',
choose_model: 'Please choose a model',
data_center_desc: 'DB-GPT also offers a user-friendly data center management interface for efficient data maintenance.',
create_database: 'Create Database',
create_knowledge: 'Create Knowledge',
path: 'Path',
model_manage: 'Models',
stop_model_success: 'Stop model success',
create_model: 'Create Model',
model_select_tips: 'Please select a model',
submit: 'Submit',
close: 'Close',
start_model_success: 'Start model success',
download_model_tip: 'Please download model first.',
Plugins: 'Plugins',
try_again: 'Try again',
no_data: 'No data',
Open_Sidebar: 'Unfold',
cancel: 'Cancel',
Edit_Success: 'Edit Success',
Add: 'Add',
Add_Success: 'Add Success',
Error_Message: 'Something Error',
Please_Input: 'Please Input',
Prompt_Info_Scene: 'Scene',
Prompt_Info_Sub_Scene: 'Sub Scene',
Prompt_Info_Name: 'Name',
Prompt_Info_Content: 'Content',
Public: 'Public',
Private: 'Private',
Lowest: 'Lowest',
Missed: 'Missed',
Lost: 'Lost',
Incorrect: 'Incorrect',
Verbose: 'Verbose',
Best: 'Best',
Rating: 'Rating',
Q_A_Category: 'Q&A Category',
Q_A_Rating: 'Q&A Rating',
feed_back_desc:
'0: No results\n' +
'1: Results exist, but they are irrelevant, the question is not understood\n' +
'2: Results exist, the question is understood, but it indicates that the question cannot be answered\n' +
'3: Results exist, the question is understood, and an answer is given, but the answer is incorrect\n' +
'4: Results exist, the question is understood, the answer is correct, but it is verbose and lacks a summary\n' +
'5: Results exist, the question is understood, the answer is correct, the reasoning is correct, and a summary is provided, concise and to the point\n',
input_count: 'Total input',
input_unit: 'characters',
Copy: 'Copy',
Copy_success: 'Content copied successfully',
Copy_nothing: 'Content copied is empty',
Copry_error: 'Copy failed',
Click_Select: 'Click&Select',
Quick_Start: 'Quick Start',
Select_Plugins: 'Select Plugins',
Search: 'Search',
Update_From_Github: 'Upload From Github',
Reset: 'Reset',
Upload: 'Upload',
Market_Plugins: 'Market Plugin',
My_Plugins: 'My Plugins',
Del_Knowledge_Tips: 'Do you want delete the Space',
Del_Document_Tips: 'Do you want delete the Document',
Tips: 'Tips',
Limit_Upload_File_Count_Tips: 'Only one file can be uploaded at a time',
To_Plugin_Market: 'Go to the Plugin Market',
Summary: 'Summary',
stacked_column_chart: 'Stacked Column',
column_chart: 'Column',
percent_stacked_column_chart: 'Percent Stacked Column',
grouped_column_chart: 'Grouped Column',
time_column: 'Time Column',
pie_chart: 'Pie',
line_chart: 'Line',
area_chart: 'Area',
stacked_area_chart: 'Stacked Area',
scatter_plot: 'Scatter',
bubble_chart: 'Bubble',
stacked_bar_chart: 'Stacked Bar',
bar_chart: 'Bar',
percent_stacked_bar_chart: 'Percent Stacked Bar',
grouped_bar_chart: 'Grouped Bar',
water_fall_chart: 'Waterfall',
table: 'Table',
multi_line_chart: 'Multi Line',
multi_measure_column_chart: 'Multi Measure Column',
multi_measure_line_chart: 'Multi Measure Line',
Advices: 'Advices',
Retry: 'Retry',
Load_more: 'load more',
new_chat: 'New Chat',
} as const;
type I18nKeys = keyof typeof en;
export interface Resources {
translation: Record<I18nKeys, string>;
}
const zh: Resources['translation'] = {
Knowledge_Space: '知识库',
space: '知识库',
Vector: '向量',
Owner: '创建人',
Count: '文档数',
File_type_Invalid: '文件类型错误',
Knowledge_Space_Config: '知识库配置',
Choose_a_Datasource_type: '知识库类型',
Segmentation: '分片',
No_parameter: '不需要配置分片参数',
Knowledge_Space_Name: '知识库名称',
Please_input_the_name: '请输入名称',
Please_input_the_owner: '请输入创建人',
Please_select_file: '请至少选择一个文件',
Description: '描述',
Please_input_the_description: '请输入描述',
Next: '下一步',
the_name_can_only_contain: '名称只能包含数字、字母、中文字符、-或_',
Text: '文本',
'Fill your raw text': '填写您的原始文本',
URL: '网址',
Fetch_the_content_of_a_URL: '获取 URL 的内容',
Document: '文档',
Upload_a_document: '上传文档文档类型可以是PDF、CSV、Text、PowerPoint、Word、Markdown',
Name: '名称',
Text_Source: '文本来源(可选)',
Please_input_the_text_source: '请输入文本来源',
Sync: '同步',
Back: '上一步',
Finish: '完成',
Web_Page_URL: '网页网址',
Please_input_the_Web_Page_URL: '请输入网页网址',
Select_or_Drop_file: '选择或拖拽文件',
Documents: '文档',
Chat: '对话',
Add_Datasource: '添加数据源',
Arguments: '参数',
Type: '类型',
Size: '切片',
Last_Sync: '上次同步时间',
Status: '状态',
Result: '结果',
Details: '明细',
Delete: '删除',
Operation: '操作',
Submit: '提交',
close: '关闭',
Chunks: '切片',
Content: '内容',
Meta_Data: '元数据',
Please_select_a_file: '请上传一个文件',
Please_input_the_text: '请输入文本',
Embedding: '嵌入',
topk: 'TopK',
the_top_k_vectors: '基于相似度得分的前 k 个向量',
recall_score: '召回分数',
Set_a_threshold_score: '设置相似向量检索的阈值分数',
recall_type: '召回类型',
model: '模型',
A_model_used: '用于创建文本或其他数据的矢量表示的模型',
Automatic: '自动切片',
Process: '切片处理',
Automatic_desc: '自动设置分割和预处理规则。',
chunk_size: '块大小',
The_size_of_the_data_chunks: '处理中使用的数据块的大小',
chunk_overlap: '块重叠',
The_amount_of_overlap: '相邻数据块之间的重叠量',
scene: '场景',
A_contextual_parameter: '用于定义使用提示的设置或环境的上下文参数',
template: '模板',
structure_or_format: '预定义的提示结构或格式,有助于确保人工智能系统生成与所需风格或语气一致的响应。',
max_token: '最大令牌',
max_iteration: '最大迭代',
concurrency_limit: '并发限制',
The_maximum_number_of_tokens: '提示中允许的最大标记或单词数',
Theme: '主题',
Port: '端口',
Username: '用户名',
Password: '密码',
Remark: '备注',
Edit: '编辑',
Database: '数据库',
Data_Source: '数据中心',
Close_Sidebar: '收起',
Show_Sidebar: '展开',
language: '语言',
choose_model: '请选择一个模型',
data_center_desc: 'DB-GPT支持数据库交互和基于文档的对话它还提供了一个用户友好的数据中心管理界面。',
create_database: '创建数据库',
create_knowledge: '创建知识库',
path: '路径',
model_manage: '模型管理',
stop_model_success: '模型停止成功',
create_model: '创建模型',
model_select_tips: '请选择一个模型',
submit: '提交',
start_model_success: '启动模型成功',
download_model_tip: '请先下载模型!',
Plugins: '插件列表',
try_again: '刷新重试',
no_data: '暂无数据',
Prompt: '提示语',
Open_Sidebar: '展开',
cancel: '取消',
Edit_Success: '编辑成功',
Add: '新增',
Add_Success: '新增成功',
Error_Message: '出错了',
Please_Input: '请输入',
Prompt_Info_Scene: '场景',
Prompt_Info_Sub_Scene: '次级场景',
Prompt_Info_Name: '名称',
Prompt_Info_Content: '内容',
Public: '公共',
Private: '私有',
Lowest: '渣渣',
Missed: '没理解',
Lost: '答不了',
Incorrect: '答错了',
Verbose: '较啰嗦',
Best: '真棒',
Rating: '评分',
Q_A_Category: '问答类别',
Q_A_Rating: '问答评分',
feed_back_desc:
'0: 无结果\n' +
'1: 有结果,但是在文不对题,没有理解问题\n' +
'2: 有结果,理解了问题,但是提示回答不了这个问题\n' +
'3: 有结果,理解了问题,并做出回答,但是回答的结果错误\n' +
'4: 有结果,理解了问题,回答结果正确,但是比较啰嗦,缺乏总结\n' +
'5: 有结果,理解了问题,回答结果正确,推理正确,并给出了总结,言简意赅\n',
input_count: '共计输入',
input_unit: '字',
Copy: '复制',
Copy_success: '内容复制成功',
Copy_nothing: '内容复制为空',
Copry_error: '复制失败',
Click_Select: '点击选择',
Quick_Start: '快速开始',
Select_Plugins: '选择插件',
Search: '搜索',
Reset: '重置',
Update_From_Github: '更新Github插件',
Upload: '上传',
Market_Plugins: '插件市场',
My_Plugins: '我的插件',
Del_Knowledge_Tips: '你确定删除该知识库吗',
Del_Document_Tips: '你确定删除该文档吗',
Tips: '提示',
Limit_Upload_File_Count_Tips: '一次只能上传一个文件',
To_Plugin_Market: '前往插件市场',
Summary: '总结',
stacked_column_chart: '堆叠柱状图',
column_chart: '柱状图',
percent_stacked_column_chart: '百分比堆叠柱状图',
grouped_column_chart: '簇形柱状图',
time_column: '簇形柱状图',
pie_chart: '饼图',
line_chart: '折线图',
area_chart: '面积图',
stacked_area_chart: '堆叠面积图',
scatter_plot: '散点图',
bubble_chart: '气泡图',
stacked_bar_chart: '堆叠条形图',
bar_chart: '条形图',
percent_stacked_bar_chart: '百分比堆叠条形图',
grouped_bar_chart: '簇形条形图',
water_fall_chart: '瀑布图',
table: '表格',
multi_line_chart: '多折线图',
multi_measure_column_chart: '多指标柱形图',
multi_measure_line_chart: '多指标折线图',
Advices: '自动推荐',
Retry: '重试',
Load_more: '加载更多',
new_chat: '创建会话',
} as const;
i18n.use(initReactI18next).init({
resources,
resources: {
en: {
translation: en,
},
zh: {
translation: zh,
},
},
lng: 'en',
interpolation: {
escapeValue: false,
},
});
export type I18nKeyMapper = (typeof resources)['en']['translation'];
export default i18n;
declare module 'i18next' {
interface CustomTypeOptions {
resources: Resources;
}
}

View File

@ -1,19 +1,21 @@
import { Empty, Row, Col, Select, Tooltip } from 'antd';
import { Advice, Advisor } from '@antv/ava';
import { Chart } from '@berryv/g2-react';
import { DownOutlined } from '@ant-design/icons';
import i18n from '@/app/i18n';
import { customizeAdvisor, getVisAdvices } from './advisor/pipeline';
import { useEffect, useMemo, useState } from 'react';
import { useContext, useEffect, useMemo, useState } from 'react';
import { defaultAdvicesFilter } from './advisor/utils';
import { AutoChartProps, ChartType, CustomAdvisorConfig, CustomChart, Specification } from './types';
import { customCharts } from './charts';
import { ChatContext } from '@/app/chat-context';
const { Option } = Select;
export const AutoChart = (props: AutoChartProps) => {
const { data, chartType, scopeOfCharts, ruleConfig } = props;
const { mode } = useContext(ChatContext);
const [advisor, setAdvisor] = useState<Advisor>();
const [advices, setAdvices] = useState<Advice[]>([]);
const [renderChartType, setRenderChartType] = useState<ChartType>();
@ -54,7 +56,15 @@ export const AutoChart = (props: AutoChartProps) => {
const chartTypeInput = renderChartType ?? advices[0].type;
const spec: Specification = advices?.find((item: Advice) => item.type === chartTypeInput)?.spec ?? undefined;
if (spec) {
return <Chart key={chartTypeInput} options={spec} />;
return (
<Chart
key={chartTypeInput}
options={{
...spec,
theme: mode,
}}
/>
);
}
}
}, [advices, renderChartType]);
@ -62,13 +72,13 @@ export const AutoChart = (props: AutoChartProps) => {
if (renderChartType) {
return (
<div>
<Row justify="start">
<Row justify="start" className="mb-2">
<Col>{i18n.t('Advices')}</Col>
<Col style={{ marginLeft: 24 }}>
<Select
className="w-52"
value={renderChartType}
placeholder={'Chart Switcher'}
style={{ width: '180px' }}
onChange={(value) => setRenderChartType(value)}
size={'small'}
>
@ -78,10 +88,7 @@ export const AutoChart = (props: AutoChartProps) => {
return (
<Option key={item.type} value={item.type}>
<Tooltip title={name} placement={'right'}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<DownOutlined />
<div style={{ marginLeft: '2px' }}>{name}</div>
</div>
<div>{name}</div>
</Tooltip>
</Option>
);

View File

@ -1,36 +1,34 @@
import { ChatContext } from '@/app/chat-context';
import { ChartData } from '@/types/chat';
import { Chart } from '@berryv/g2-react';
import { Card, CardContent, Typography } from '@mui/joy';
import { useContext } from 'react';
export default function BarChart({ chart }: { key: string; chart: ChartData }) {
const { mode } = useContext(ChatContext);
return (
<div className="flex-1 min-w-0">
<Card className="h-full" sx={{ background: 'transparent' }}>
<CardContent className="h-full">
<Typography gutterBottom component="div">
{chart.chart_name}
</Typography>
<Typography gutterBottom level="body3">
{chart.chart_desc}
</Typography>
<div className="h-[300px]">
<Chart
style={{ height: '100%' }}
options={{
autoFit: true,
type: 'interval',
data: chart.values,
encode: { x: 'name', y: 'value', color: 'type' },
axis: {
x: {
labelAutoRotate: false,
},
<div className="flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded">
<div className="h-full">
<div className="mb-2">{chart.chart_name}</div>
<div className="opacity-80 text-sm mb-2">{chart.chart_desc}</div>
<div className="h-[300px]">
<Chart
style={{ height: '100%' }}
options={{
autoFit: true,
theme: mode,
type: 'interval',
data: chart.values,
encode: { x: 'name', y: 'value', color: 'type' },
axis: {
x: {
labelAutoRotate: false,
},
}}
/>
</div>
</CardContent>
</Card>
},
}}
/>
</div>
</div>
</div>
);
}

View File

@ -1,59 +1,57 @@
import { ChartData } from '@/types/chat';
import { Card, CardContent, Typography } from '@mui/joy';
import { Chart } from '@berryv/g2-react';
import { useContext } from 'react';
import { ChatContext } from '@/app/chat-context';
export default function LineChart({ chart }: { chart: ChartData }) {
const { mode } = useContext(ChatContext);
return (
<div className="flex-1 min-w-0">
<Card className="h-full" sx={{ background: 'transparent' }}>
<CardContent className="h-full">
<Typography gutterBottom component="div">
{chart.chart_name}
</Typography>
<Typography gutterBottom level="body3">
{chart.chart_desc}
</Typography>
<div className="h-[300px]">
<Chart
style={{ height: '100%' }}
options={{
autoFit: true,
type: 'view',
data: chart.values,
children: [
{
type: 'line',
encode: {
x: 'name',
y: 'value',
color: 'type',
shape: 'smooth',
},
},
{
type: 'area',
encode: {
x: 'name',
y: 'value',
color: 'type',
shape: 'smooth',
},
legend: false,
style: {
fillOpacity: 0.15,
},
},
],
axis: {
x: {
labelAutoRotate: false,
<div className="flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded">
<div className="h-full">
<div className="mb-2">{chart.chart_name}</div>
<div className="opacity-80 text-sm mb-2">{chart.chart_desc}</div>
<div className="h-[300px]">
<Chart
style={{ height: '100%' }}
options={{
autoFit: true,
theme: mode,
type: 'view',
data: chart.values,
children: [
{
type: 'line',
encode: {
x: 'name',
y: 'value',
color: 'type',
shape: 'smooth',
},
},
}}
/>
</div>
</CardContent>
</Card>
{
type: 'area',
encode: {
x: 'name',
y: 'value',
color: 'type',
shape: 'smooth',
},
legend: false,
style: {
fillOpacity: 0.15,
},
},
],
axis: {
x: {
labelAutoRotate: false,
},
},
}}
/>
</div>
</div>
</div>
);
}

View File

@ -1,41 +1,36 @@
import { ChartData } from '@/types/chat';
import { Card, CardContent, Typography, Table } from '@mui/joy';
import { Table } from '@mui/joy';
import { groupBy } from 'lodash';
export default function TableChart({ chart }: { key: string; chart: ChartData }) {
const data = groupBy(chart.values, 'type');
return (
<div className="flex-1 min-w-0">
<Card className="h-full overflow-auto" sx={{ background: 'transparent' }}>
<CardContent className="h-full">
<Typography gutterBottom component="div">
{chart.chart_name}
</Typography>
<Typography gutterBottom level="body3">
{chart.chart_desc}
</Typography>
<div className="flex-1">
<Table aria-label="basic table" stripe="odd" hoverRow borderAxis="bothBetween">
<thead>
<tr>
{Object.keys(data).map((key) => (
<th key={key}>{key}</th>
<div className="flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded">
<div className="h-full">
<div className="mb-2">{chart.chart_name}</div>
<div className="opacity-80 text-sm mb-2">{chart.chart_desc}</div>
<div className="flex-1">
<Table aria-label="basic table" stripe="odd" hoverRow borderAxis="bothBetween">
<thead>
<tr>
{Object.keys(data).map((key) => (
<th key={key}>{key}</th>
))}
</tr>
</thead>
<tbody>
{Object.values(data)?.[0]?.map((value, i) => (
<tr key={i}>
{Object.keys(data)?.map((k) => (
<td key={k}>{data?.[k]?.[i].value || ''}</td>
))}
</tr>
</thead>
<tbody>
{Object.values(data)?.[0]?.map((value, i) => (
<tr key={i}>
{Object.keys(data)?.map((k) => (
<td key={k}>{data?.[k]?.[i].value || ''}</td>
))}
</tr>
))}
</tbody>
</Table>
</div>
</CardContent>
</Card>
))}
</tbody>
</Table>
</div>
</div>
</div>
);
}

View File

@ -109,7 +109,7 @@ const ChatContainer = () => {
/>
<div className="px-4 flex flex-1 flex-wrap overflow-hidden relative">
{!!chartsData?.length && (
<div className="w-full xl:w-3/4 h-3/5 xl:pr-4 xl:h-full overflow-y-auto">
<div className="w-full pb-4 xl:w-3/4 h-3/5 xl:pr-4 xl:h-full overflow-y-auto">
<Chart chartsData={chartsData} />
</div>
)}
@ -122,8 +122,8 @@ const ChatContainer = () => {
)}
{/** chat panel */}
<div
className={classNames('flex flex-1 flex-col overflow-hidden', {
'px-0 xl:pl-4 h-2/5 xl:h-full border-t xl:border-t-0 xl:border-l': scene === 'chat_dashboard',
className={classNames('flex flex-1 flex-col', {
'px-0 xl:pl-4 h-2/5 w-full xl:w-auto xl:h-full border-t xl:border-t-0 xl:border-l dark:border-gray-800': scene === 'chat_dashboard',
'h-full lg:px-8': scene !== 'chat_dashboard',
})}
>

View File

@ -1,10 +1,13 @@
import { Button, message } from 'antd';
import { CopyOutlined } from '@ant-design/icons';
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { oneDark, coldarkDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import copy from 'copy-to-clipboard';
import { useColorScheme } from '@mui/joy';
export function CodePreview({ code, language }: { code: string; language: string }) {
const { mode } = useColorScheme();
return (
<div className="relative">
<Button
@ -16,7 +19,7 @@ export function CodePreview({ code, language }: { code: string; language: string
message[success ? 'success' : 'error'](success ? 'Copy success' : 'Copy failed');
}}
/>
<SyntaxHighlighter language={language} style={oneDark}>
<SyntaxHighlighter language={language} style={mode === 'dark' ? coldarkDark : oneDark}>
{code}
</SyntaxHighlighter>
</div>

View File

@ -37,10 +37,10 @@ const basicComponents: MarkdownComponent = {
return (
<>
{!inline && match ? (
{!inline ? (
<CodePreview code={context} language={match?.[1] ?? 'javascript'} />
) : (
<code {...props} style={style} className="px-[6px] py-[2px] rounded bg-gray-700 text-gray-100 dark:bg-gray-100 dark:text-gray-800 text-sm">
<code {...props} style={style} className="p-1 mx-1 rounded bg-theme-light dark:bg-theme-dark text-sm">
{children}
</code>
)}

View File

@ -136,22 +136,22 @@ function ChatContent({ children, content, isChartChat, onLinkClick }: PropsWithC
return (
<div
className={classNames('relative flex flex-wrap w-full px-2 sm:px-4 py-2 sm:py-4 rounded-xl break-words', {
'bg-slate-100 dark:bg-[#353539]': isRobot,
className={classNames('relative flex flex-wrap w-full p-2 md:p-4 rounded-xl break-words', {
'bg-white dark:bg-[#232734]': isRobot,
'lg:w-full xl:w-full pl-0': ['chat_with_db_execute', 'chat_dashboard'].includes(scene),
})}
>
<div className="mr-2 flex flex-shrink-0 items-center justify-center h-7 w-7 rounded-full text-lg sm:mr-4">
{isRobot ? renderModelIcon(model_name) || <RobotOutlined /> : <UserOutlined />}
</div>
<div className="flex-1 overflow-hidden items-center text-md leading-8">
<div className="flex-1 overflow-hidden items-center text-md leading-8 pb-2">
{/* User Input */}
{!isRobot && typeof context === 'string' && context}
{/* Render Report */}
{isRobot && isChartChat && typeof context === 'object' && (
<div>
{`[${context.template_name}]: `}
<span className="text-[#1677ff] cursor-pointer" onClick={onLinkClick}>
<span className="text-theme-primary cursor-pointer" onClick={onLinkClick}>
<CodeOutlined className="mr-1" />
{context.template_introduce || 'More Details'}
</span>

View File

@ -156,7 +156,7 @@ const Completion = ({ messages, onSubmit }: Props) => {
}}
>
{content.role === 'view' && (
<div className="flex w-full pt-2 md:pt-4 border-t border-gray-200 mt-2 md:mt-4 pl-2">
<div className="flex w-full border-t border-gray-200 dark:border-theme-dark">
{scene === 'chat_knowledge' && content.retry ? (
<Button onClick={handleRetry} slots={{ root: IconButton }} slotProps={{ root: { variant: 'plain', color: 'primary' } }}>
<RedoOutlined />
@ -198,7 +198,7 @@ const Completion = ({ messages, onSubmit }: Props) => {
</div>
<div
className={classNames(
'relative after:absolute after:-top-8 after:h-8 after:w-full after:bg-gradient-to-t after:from-white after:to-transparent dark:after:from-[#212121]',
'relative after:absolute after:-top-8 after:h-8 after:w-full after:bg-gradient-to-t after:from-theme-light after:to-transparent dark:after:from-theme-dark',
{
'cursor-not-allowed': scene === 'chat_excel' && !currentDialogue?.select_param,
},

View File

@ -18,7 +18,7 @@ function Header({ refreshHistory, modelChange }: Props) {
const { scene, refreshDialogList } = useContext(ChatContext);
return (
<div className="w-full py-2 px-4 md:px-4 flex flex-wrap items-center justify-center border-b border-gray-100 gap-1 md:gap-4">
<div className="w-full py-2 px-4 md:px-4 flex flex-wrap items-center justify-center gap-1 md:gap-4">
{/* Models Selector */}
<ModelSelector onChange={modelChange} />
{/* DB Selector */}

View File

@ -78,7 +78,7 @@ function CompletionInput({ children, loading, onSubmit, handleFinish, ...props }
}}
/>
<Button
className="ml-2 flex items-center justify-center absolute right-2 bottom-0"
className="ml-2 flex items-center justify-center absolute right-0 bottom-0"
size="large"
type="text"
loading={loading}

View File

@ -16,8 +16,8 @@ function DBCard({ info, onClick }: Props) {
return (
<div
className={`relative flex flex-col py-4 px-4 w-72 h-32 cursor-pointer rounded-lg justify-between text-black bg-white border-gray-200 border hover:shadow-md dark:border-gray-600 dark:bg-black dark:text-white dark:hover:border-white transition-all ${
info.disabled ? 'grayscale cursor-no-drop' : ''
className={`relative flex flex-col p-4 w-72 h-32 rounded justify-between text-black bg-white shadow-[0_8px_16px_-10px_rgba(100,100,100,.08)] hover:shadow-[0_14px_20px_-10px_rgba(100,100,100,.15)] dark:bg-[#232734] dark:text-white dark:hover:border-white transition-[transfrom_shadow] duration-300 hover:-translate-y-1 ${
info.disabled ? 'grayscale cursor-no-drop' : 'cursor-pointer'
}`}
onClick={handleClick}
>

View File

@ -0,0 +1,33 @@
function ColorfulChat() {
return (
<svg className="w-full h-full" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path
d="M416.9549913 314.32347826h297.42302609a119.56758261 119.56758261 0 0 1 119.56758261 119.56758261v179.19109565a196.71485217 196.71485217 0 0 1-196.71485217 196.71485218H416.9549913a119.56758261 119.56758261 0 0 1-119.5675826-119.56758261v-256.44521739A119.56758261 119.56758261 0 0 1 416.9549913 314.32347826z"
fill="#F5384A"
p-id="1186"
></path>
<path
d="M716.24793043 314.32347826H415.03165217a117.5373913 117.5373913 0 0 0-117.5373913 117.53739131v260.18504347c0 3.84667826 0 7.69335652 0.58768696 11.43318261a345.7202087 345.7202087 0 0 0 502.9531826-353.19986087A117.1634087 117.1634087 0 0 0 716.24793043 314.32347826z"
fill="#F54F5C"
p-id="1187"
></path>
<path
d="M318.91812174 594.54330435a345.7202087 345.7202087 0 0 0 420.73043478-249.07241739c2.35074783-9.18928696 4.22066087-18.432 5.82344348-27.67471305a117.10998261 117.10998261 0 0 0-29.22406957-3.63297391H415.03165217a117.5373913 117.5373913 0 0 0-117.5373913 117.5373913v156.43158261c6.9453913 2.35074783 14.10448696 4.54121739 21.42386087 6.41113044z"
fill="#F66C73"
p-id="1188"
></path>
<path
d="M630.17850435 314.32347826H415.03165217a117.5373913 117.5373913 0 0 0-117.5373913 117.53739131v48.08347826a346.14761739 346.14761739 0 0 0 332.68424348-165.62086957z"
fill="#F78989"
p-id="1189"
></path>
<path
d="M859.85725217 354.76702609h-25.53766956C802.26393043 200.52591304 669.92751304 84.59130435 512 84.59130435S221.73606957 200.52591304 189.68041739 354.76702609h-25.53766956a139.6557913 139.6557913 0 0 0-139.44208696 139.49551304v79.872a139.6557913 139.6557913 0 0 0 139.44208696 139.49551304h27.62128695a54.65488696 54.65488696 0 0 0 54.60146087-54.60146087V427.10594783C246.36549565 273.6128 365.50566957 148.7026087 512 148.7026087s265.63450435 124.9101913 265.63450435 278.40333913v159.3165913c0 116.09488696-74.79652174 219.47436522-181.38156522 251.42316522a30.23916522 30.23916522 0 0 0-3.09871304 1.06852174 60.15777391 60.15777391 0 1 0 18.05801739 61.06601739 23.50747826 23.50747826 0 0 0 3.36584348-0.69453913c93.12166957-27.88841739 166.63596522-98.67798261 203.01913043-187.79269565a54.92201739 54.92201739 0 0 0 14.90587826 2.13704347h27.62128696a139.6557913 139.6557913 0 0 0 139.44208696-139.49551304V494.26253913a139.6557913 139.6557913 0 0 0-139.7092174-139.49551304zM182.2541913 649.51874783h-18.11144347a75.43763478 75.43763478 0 0 1-75.33078261-75.3842087V494.26253913a75.43763478 75.43763478 0 0 1 75.33078261-75.3842087h18.11144347v230.6404174z m752.93384348-75.3842087a75.43763478 75.43763478 0 0 1-75.33078261 75.3842087h-18.11144347V418.87833043h18.11144347a75.43763478 75.43763478 0 0 1 75.33078261 75.3842087z"
fill="#444444"
p-id="1190"
></path>
</svg>
);
}
export default ColorfulChat;

View File

@ -1,43 +1,26 @@
function ColorfulDashboard() {
return (
<svg viewBox="0 0 1059 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11020" className="w-full h-full">
<svg viewBox="0 0 1116 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1581" className="w-full h-full">
<path
d="M617.931034 971.034483H335.448276c62.834759 0 70.62069-140.994207 70.62069-211.862069h247.172413c0 70.867862 7.785931 211.862069 70.62069 211.862069h-105.931035z"
fill="#4DB5E3"
p-id="11021"
d="M80.75 80.75m67.14674945 0l805.76099677 0q67.14674945 0 67.14674947 67.14674945l0 604.32074759q0 67.14674945-67.14674947 67.14674945l-805.76099677 0q-67.14674945 0-67.14674945-67.14674945l0-604.32074759q0-67.14674945 67.14674945-67.14674945Z"
fill="#36CFC9"
p-id="1582"
></path>
<path
d="M282.482759 953.37931h512a35.310345 35.310345 0 0 1 0 70.62069H282.482759a35.310345 35.310345 0 0 1 0-70.62069z"
fill="#47C5FC"
p-id="11022"
d="M1020.80449568 685.07074759v67.14674945a67.14674945 67.14674945 0 0 1-67.14674946 67.14674945h-308.20358111l91.3195796 100.72012459-24.84429735 22.49416172L600.46584251 819.36424649h-100.72012459L389.62504831 943.25 364.78075097 920.08437108l91.31957961-100.72012459H147.89674945a67.14674945 67.14674945 0 0 1-67.14674945-67.14674945v-67.14674946z"
fill="#08979C"
p-id="1583"
></path>
<path
d="M0 0m73.145379 0l913.019587 0q73.145379 0 73.145379 73.145379l0 683.502345q0 73.145379-73.145379 73.145379l-913.019587 0q-73.145379 0-73.145379-73.145379l0-683.502345q0-73.145379 73.145379-73.145379Z"
fill="#47C5FC"
p-id="11023"
></path>
<path d="M52.965517 52.965517h953.379311v723.862069H52.965517z" fill="#FFFFFF" p-id="11024"></path>
<path
d="M600.275862 564.965517h335.448276a17.655172 17.655172 0 0 1 0 35.310345H600.275862a17.655172 17.655172 0 0 1 0-35.310345z m0 88.275862h205.78869a17.655172 17.655172 0 0 1 0 35.310345H600.275862a17.655172 17.655172 0 0 1 0-35.310345z m278.068966 0H935.724138a17.655172 17.655172 0 0 1 0 35.310345h-57.37931a17.655172 17.655172 0 0 1 0-35.310345z"
fill="#C7EAF9"
p-id="11025"
d="M416.48374894 282.19024919v335.7337481H315.76362434V282.19024919z m167.86687404 134.29349975v201.44024834h-100.72012459v-201.44024834z m167.86687406 67.14674945v134.2934989h-100.7201246v-134.2934989z m-225.94881252-302.16037379v141.34390829h201.4402492V272.11823698L819.36424649 341.27938889l-91.3195796 63.45367858V356.38740719h-239.71389641V215.04349975H315.76362434V181.4701246z"
fill="#B5F5EC"
p-id="1584"
></path>
<path
d="M194.206897 211.862069h282.482758a17.655172 17.655172 0 1 1 0 35.310345H194.206897a17.655172 17.655172 0 1 1 0-35.310345z m0 88.275862h171.59062a17.655172 17.655172 0 1 1 0 35.310345H194.206897a17.655172 17.655172 0 1 1 0-35.310345z m238.344827 0H476.689655a17.655172 17.655172 0 1 1 0 35.310345h-44.137931a17.655172 17.655172 0 1 1 0-35.310345z"
fill="#C7EAF9"
p-id="11026"
d="M550.77724783 752.21749704m-33.57337513 0a33.57337515 33.57337515 0 1 0 67.14675028 0 33.57337515 33.57337515 0 1 0-67.14675028 0Z"
fill="#FFFFFF"
p-id="1585"
></path>
<path
d="M194.206897 176.551724H141.241379v52.965517a17.655172 17.655172 0 1 1-35.310345 0V158.896552a17.655172 17.655172 0 0 1 17.655173-17.655173h70.62069a17.655172 17.655172 0 0 1 0 35.310345z"
fill="#C7EAF9"
p-id="11027"
></path>
<path d="M317.793103 564.965517h141.24138a141.241379 141.241379 0 1 1-141.24138-141.241379v141.241379z" fill="#47C5FC" p-id="11028"></path>
<path d="M335.448276 406.068966a141.241379 141.241379 0 0 1 141.241379 141.241379h-141.241379v-141.241379z" fill="#FFDE21" p-id="11029"></path>
<path d="M582.62069 176.551724h52.965517v247.172414h-52.965517z" fill="#FFDE21" p-id="11030"></path>
<path d="M688.551724 247.172414h52.965517v176.551724h-52.965517z" fill="#47C5FC" p-id="11031"></path>
<path d="M794.482759 300.137931h52.965517v123.586207h-52.965517z" fill="#47C5FC" p-id="11032"></path>
<path d="M900.413793 353.103448h52.965517v70.62069h-52.965517z" fill="#FFDE21" p-id="11033"></path>
</svg>
);
}

View File

@ -1,82 +1,31 @@
function ColorfulData() {
return (
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13568" className="w-full h-full">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1722" className="w-full h-full">
<path
d="M185.66 459H70.5c-5.54 0-10 4.48-10 10v373.26c0 5.52 4.46 10 10 10h115.16c5.52 0 10-4.48 10-10V469c0-5.52-4.48-10-10-10z m-10 373.26H80.5V479h95.16v353.26z"
fill="#23130D"
p-id="13569"
></path>
<path d="M80.5 479h95.16v353.26H80.5z" fill="#F9C139" p-id="13570"></path>
<path d="M80.5 479H100v353.26h-19.5z" fill="#FFFFFF" opacity=".4" p-id="13571"></path>
<path d="M156.16 479h19.5v353.26h-19.5z" fill="#1C1817" opacity=".2" p-id="13572"></path>
<path
d="M377.62 556.06h-115.16c-5.54 0-10 4.48-10 10v276.2c0 5.52 4.46 10 10 10h115.16c5.54 0 10-4.48 10-10v-276.2c0-5.52-4.46-10-10-10z m-10 276.2h-95.16v-256.2h95.16v256.2z"
fill="#23130D"
p-id="13573"
></path>
<path d="M272.46 576.06h95.16v256.2h-95.16z" fill="#EC7063" p-id="13574"></path>
<path
d="M569.58 358.02h-115.16c-5.54 0-10 4.48-10 10v474.24c0 5.52 4.46 10 10 10h115.16c5.54 0 10-4.48 10-10V368.02c0-5.52-4.46-10-10-10z m-10 474.24h-95.16V378.02h95.16v454.24z"
fill="#23130D"
p-id="13575"
></path>
<path d="M464.42 378.02h95.16v454.24h-95.16z" fill="#72AF5F" p-id="13576"></path>
<path
d="M761.54 419.62h-115.16c-5.54 0-10 4.48-10 10v412.64c0 5.52 4.46 10 10 10h115.16c5.54 0 10-4.48 10-10V429.62c0-5.52-4.46-10-10-10z m-10 412.64h-95.16V439.62h95.16v392.64z"
fill="#23130D"
p-id="13577"
></path>
<path d="M656.38 439.62h95.16v392.64h-95.16z" fill="#EC7063" p-id="13578"></path>
<path
d="M953.5 281.94h-115.16c-5.52 0-10 4.48-10 10v550.32c0 5.52 4.48 10 10 10h115.16c5.54 0 10-4.48 10-10V291.94c0-5.52-4.46-10-10-10z m-10 550.32h-95.16V301.94h95.16v530.32z"
fill="#23130D"
p-id="13579"
></path>
<path d="M848.34 301.94h95.16v530.32h-95.16z" fill="#72AF5F" p-id="13580"></path>
<path
d="M953.51 883.768H70.49a10 10 0 1 0 0 20h883.02c5.524 0 10-4.476 10-10s-4.476-10-10-10zM895.92 120.24c-36.72 0-66.62 29.88-66.62 66.6 0 10.8 2.6 21 7.2 30.04l-84.72 60.34c-12.12-12.5-29.08-20.3-47.82-20.3-26.08 0-48.7 15.08-59.64 36.96l-66.56-21.38c0.56-3.46 0.86-7 0.86-10.62 0-36.72-29.88-66.6-66.62-66.6s-66.62 29.88-66.62 66.6c0 14.88 4.92 28.64 13.18 39.74l-99.32 100.32a66.24 66.24 0 0 0-39.2-12.8c-22.16 0-41.8 10.88-53.92 27.56l-75.9-39.12c2.26-6.7 3.5-13.84 3.5-21.28 0-36.72-29.88-66.6-66.62-66.6-36.72 0-66.6 29.88-66.6 66.6 0 36.74 29.88 66.62 66.6 66.62 22.16 0 41.82-10.88 53.94-27.58l75.9 39.14a66.316 66.316 0 0 0-3.52 21.28c0 36.72 29.88 66.6 66.62 66.6s66.62-29.88 66.62-66.6c0-14.9-4.92-28.64-13.2-39.76l99.32-100.32a66.18 66.18 0 0 0 39.22 12.82c26.08 0 48.7-15.08 59.62-36.96l66.58 21.38c-0.56 3.46-0.86 7-0.86 10.6 0 36.74 29.88 66.62 66.62 66.62s66.62-29.88 66.62-66.62c0-10.8-2.6-21-7.18-30.02l84.7-60.34c12.12 12.5 29.08 20.3 47.82 20.3 36.74 0 66.62-29.88 66.62-66.62 0-36.72-29.88-66.6-66.62-66.6zM127.1 402.92c-25.7 0-46.6-20.92-46.6-46.62 0-25.7 20.9-46.6 46.6-46.6 25.7 0 46.62 20.9 46.62 46.6 0 25.7-20.92 46.62-46.62 46.62z m192.94 99.44c-25.7 0-46.62-20.9-46.62-46.6 0-25.72 20.92-46.62 46.62-46.62 25.7 0 46.62 20.9 46.62 46.62 0 25.7-20.92 46.6-46.62 46.6zM512 308.5c-25.7 0-46.62-20.92-46.62-46.62s20.92-46.6 46.62-46.6 46.62 20.9 46.62 46.6-20.92 46.62-46.62 46.62z m191.96 61.64c-25.7 0-46.62-20.9-46.62-46.62 0-4.94 0.8-9.72 2.22-14.2l0.02-0.02v-0.02c6.04-18.76 23.64-32.36 44.38-32.36 25.7 0 46.62 20.9 46.62 46.6 0 25.72-20.92 46.62-46.62 46.62z m191.96-136.68c-25.7 0-46.62-20.9-46.62-46.62 0-25.7 20.92-46.6 46.62-46.6 25.7 0 46.62 20.9 46.62 46.6 0 25.72-20.92 46.62-46.62 46.62z"
fill="#23130D"
p-id="13581"
d="M207.83 962c-5.4 0-10.88-1.17-16.08-3.67-18.55-8.89-26.39-31.13-17.5-49.69l77.22-161.26c8.9-18.58 31.14-26.41 49.7-17.51 18.55 8.89 26.39 31.13 17.5 49.69l-77.22 161.26c-6.4 13.38-19.74 21.18-33.62 21.18zM821.57 962c-13.88 0-27.21-7.8-33.62-21.17l-77.24-161.26c-8.9-18.55-1.06-40.8 17.5-49.69 18.57-8.87 40.8-1.07 49.7 17.51l77.24 161.26c8.9 18.55 1.06 40.8-17.5 49.69a37.266 37.266 0 0 1-16.08 3.66z"
fill="#12926E"
p-id="1723"
></path>
<path
d="M942.54 186.84c0 25.72-20.92 46.62-46.62 46.62-25.7 0-46.62-20.9-46.62-46.62 0-25.7 20.92-46.6 46.62-46.6 25.7 0 46.62 20.9 46.62 46.6z"
fill="#72AF5F"
p-id="13582"
d="M156.74 105.14h710.51c50.7 0 91.8 41.1 91.8 91.8v525.82c0 50.7-41.1 91.8-91.8 91.8H156.74c-50.7 0-91.8-41.1-91.8-91.8V196.93c0.01-50.69 41.11-91.79 91.8-91.79z"
fill="#39E2A0"
p-id="1724"
></path>
<path
d="M750.58 323.52c0 25.72-20.92 46.62-46.62 46.62-25.7 0-46.62-20.9-46.62-46.62 0-4.94 0.8-9.72 2.22-14.2l0.02-0.02v-0.02c6.04-18.76 23.64-32.36 44.38-32.36 25.7 0 46.62 20.9 46.62 46.6z"
fill="#EC7063"
p-id="13583"
d="M835.65 686.01h-614.7c-5.14 0-9.31-4.17-9.31-9.31 0-5.14 4.17-9.31 9.31-9.31h614.7c5.14 0 9.31 4.17 9.31 9.31 0 5.14-4.17 9.31-9.31 9.31z"
fill="#D3F8EA"
p-id="1725"
></path>
<path
d="M558.62 261.88c0 25.7-20.92 46.62-46.62 46.62s-46.62-20.92-46.62-46.62 20.92-46.6 46.62-46.6 46.62 20.9 46.62 46.6z"
fill="#72AF5F"
p-id="13584"
d="M699.31 631.94H624.8V454.95c0-11.28 9.14-20.42 20.42-20.42h33.67c11.28 0 20.42 9.14 20.42 20.42v176.99zM846.22 631.94h-74.51V346.76c0-11.28 9.14-20.42 20.42-20.42h33.67c11.28 0 20.42 9.14 20.42 20.42v285.18zM289.51 631.94H215V417.69c0-11.28 9.14-20.42 20.42-20.42h33.67c11.28 0 20.42 9.14 20.42 20.42v214.25zM436.42 631.94h-74.51V495.77c0-11.28 9.14-20.42 20.42-20.42H416c11.28 0 20.42 9.14 20.42 20.42v136.17z"
fill="#FFFFFF"
p-id="1726"
></path>
<path
d="M366.66 455.76c0 25.7-20.92 46.6-46.62 46.6-25.7 0-46.62-20.9-46.62-46.6 0-25.72 20.92-46.62 46.62-46.62 25.7 0 46.62 20.9 46.62 46.62z"
fill="#EC7063"
p-id="13585"
d="M715.4 173.76H308.6c-11.11 0-20.12-9.01-20.12-20.12V82.12c0-11.11 9.01-20.12 20.12-20.12h406.8c11.11 0 20.12 9.01 20.12 20.12v71.52c0.01 11.11-9 20.12-20.12 20.12z"
fill="#12926E"
p-id="1727"
></path>
<path
d="M173.72 356.3c0 25.7-20.92 46.62-46.62 46.62-25.7 0-46.6-20.92-46.6-46.62 0-25.7 20.9-46.6 46.6-46.6 25.7 0 46.62 20.9 46.62 46.6z"
fill="#F9C139"
p-id="13586"
></path>
<path
d="M173.72 356.3c0 25.7-20.92 46.62-46.62 46.62a45.6 45.6 0 0 1-12-1.58c19.9-5.3 34.62-23.48 34.62-45.04s-14.72-39.74-34.62-45.04c3.82-1.02 7.84-1.56 12-1.56 25.7 0 46.62 20.9 46.62 46.6zM366.66 455.74c0 25.7-20.92 46.62-46.62 46.62a45.6 45.6 0 0 1-12-1.58c19.9-5.3 34.62-23.48 34.62-45.04s-14.72-39.74-34.62-45.04c3.82-1.02 7.84-1.56 12-1.56 25.7 0 46.62 20.9 46.62 46.6zM558.62 261.88c0 25.7-20.92 46.62-46.62 46.62a45.6 45.6 0 0 1-12-1.58c19.9-5.3 34.62-23.48 34.62-45.04s-14.72-39.74-34.62-45.04c3.82-1.02 7.84-1.56 12-1.56 25.7 0 46.62 20.9 46.62 46.6zM750.58 323.52c0 25.7-20.92 46.62-46.62 46.62a45.6 45.6 0 0 1-12-1.58c19.9-5.3 34.62-23.48 34.62-45.04s-14.72-39.74-34.62-45.04c3.82-1.02 7.84-1.56 12-1.56 25.7 0 46.62 20.9 46.62 46.6zM943.5 186.84c0 25.7-20.92 46.62-46.62 46.62a45.6 45.6 0 0 1-12-1.58c19.9-5.3 34.62-23.48 34.62-45.04s-14.72-39.74-34.62-45.04c3.82-1.02 7.84-1.56 12-1.56 25.7 0 46.62 20.9 46.62 46.6z"
fill="#1C1817"
opacity=".2"
p-id="13587"
></path>
<path d="M272.46 575.06h19.5v257.2h-19.5z" fill="#FFFFFF" opacity=".4" p-id="13588"></path>
<path d="M348.12 575.06h19.5v257.2h-19.5z" fill="#1C1817" opacity=".2" p-id="13589"></path>
<path d="M463.94 378.746h19.5V832.26h-19.5z" fill="#FFFFFF" opacity=".4" p-id="13590"></path>
<path d="M539.6 378.746h19.5V832.26h-19.5z" fill="#1C1817" opacity=".2" p-id="13591"></path>
<path d="M656.38 438.7h19.5v393.56h-19.5z" fill="#FFFFFF" opacity=".4" p-id="13592"></path>
<path d="M732.04 438.7h19.5v393.56h-19.5z" fill="#1C1817" opacity=".2" p-id="13593"></path>
<path d="M848.34 302.306h19.5V832.26h-19.5z" fill="#FFFFFF" opacity=".4" p-id="13594"></path>
<path d="M924 302.306h19.5V832.26H924z" fill="#1C1817" opacity=".2" p-id="13595"></path>
</svg>
);
}

View File

@ -1,10 +1,64 @@
function ColorfulDB() {
return (
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4946" className="w-full h-full">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1129" className="w-full h-full">
<path d="M226.3 70.4C151.1 91.6 91.6 151.1 70.4 226.3L226.3 70.4z" fill="#FFA65A" p-id="1130"></path>
<path d="M277.9 62.2c-116.5 4.7-211 99.1-215.7 215.7L277.9 62.2z" fill="#FFA659" p-id="1131"></path>
<path d="M321.5 62H287C163.3 62 62 163.3 62 287v34.5L321.5 62z" fill="#FFA558" p-id="1132"></path>
<path d="M365 62h-78C163.3 62 62 163.3 62 287v78L365 62z" fill="#FFA557" p-id="1133"></path>
<path d="M408.4 62H287C163.3 62 62 163.3 62 287v121.4L408.4 62z" fill="#FFA556" p-id="1134"></path>
<path d="M451.8 62H287c-35.9 0-69.8 8.5-100 23.6L85.6 187C70.5 217.2 62 251.1 62 287v164.8L451.8 62z" fill="#FFA555" p-id="1135"></path>
<path d="M495.3 62H287c-12.2 0-24.2 1-35.9 2.9L64.9 251.1C63 262.8 62 274.8 62 287v208.3L495.3 62z" fill="#FFA454" p-id="1136"></path>
<path d="M62 538.7L538.7 62H297.5L62 297.5z" fill="#FFA453" p-id="1137"></path>
<path d="M62 582.1L582.1 62H340.9L62 340.9z" fill="#FFA452" p-id="1138"></path>
<path d="M62 625.6L625.6 62H384.3L62 384.3z" fill="#FFA451" p-id="1139"></path>
<path d="M62 427.8V669L669 62H427.8z" fill="#FFA450" p-id="1140"></path>
<path d="M62 471.2v241.2L712.4 62H471.2z" fill="#FFA34F" p-id="1141"></path>
<path d="M737 62H514.6L62 514.6V737c0 6.1 0.3 12.1 0.7 18.1L755.1 62.7c-6-0.4-12-0.7-18.1-0.7z" fill="#FFA34E" p-id="1142"></path>
<path d="M737 62H558.1L62 558.1V737c0 19.1 2.4 37.6 6.9 55.4L792.4 68.9C774.6 64.4 756.1 62 737 62z" fill="#FFA34D" p-id="1143"></path>
<path d="M737 62H601.5L62 601.5V737c0 31.1 6.4 60.8 17.9 87.8L824.8 79.9C797.8 68.4 768.1 62 737 62z" fill="#FFA34C" p-id="1144"></path>
<path d="M853.5 94.7C819.4 74 779.5 62 737 62h-92.1L62 644.9V737c0 42.5 12 82.4 32.7 116.5L853.5 94.7z" fill="#FFA24B" p-id="1145"></path>
<path
d="M512 128C323.413333 128 170.666667 204.373333 170.666667 298.666667s152.746667 170.666667 341.333333 170.666666 341.333333-76.373333 341.333333-170.666666-152.746667-170.666667-341.333333-170.666667M170.666667 384v128c0 94.293333 152.746667 170.666667 341.333333 170.666667s341.333333-76.373333 341.333333-170.666667V384c0 94.293333-152.746667 170.666667-341.333333 170.666667s-341.333333-76.373333-341.333333-170.666667m0 213.333333v128c0 94.293333 152.746667 170.666667 341.333333 170.666667s341.333333-76.373333 341.333333-170.666667v-128c0 94.293333-152.746667 170.666667-341.333333 170.666667s-341.333333-76.373333-341.333333-170.666667z"
fill="#FFCA28"
p-id="4947"
d="M878.9 112.7C840.1 81.1 790.7 62 737 62h-48.6L62 688.4V737c0 53.7 19.1 103.1 50.7 141.9l766.2-766.2z"
fill="#FFA24A"
p-id="1146"
></path>
<path d="M737 62h-5.2L62 731.8v5.2c0 64.7 27.7 123.2 71.7 164.3l767.6-767.6C860.2 89.7 801.7 62 737 62z" fill="#FFA249" p-id="1147"></path>
<path d="M64.8 772.4c9.8 61 44.3 114.1 92.8 148.4l763.2-763.2c-34.3-48.6-87.4-83.1-148.4-92.8L64.8 772.4z" fill="#FFA248" p-id="1148"></path>
<path d="M73.3 807.3c18.7 56.4 59.2 103 111.3 129.9l752.6-752.6C910.4 132.5 863.7 92 807.3 73.3l-734 734z" fill="#FFA247" p-id="1149"></path>
<path d="M86.1 838c26.5 52.3 72.9 93.1 129.1 112.2l735-735C931.1 159 890.3 112.6 838 86.1L86.1 838z" fill="#FFA147" p-id="1150"></path>
<path d="M102.4 865.2c34 48.7 86.7 83.5 147.5 93.7l709-709c-10.2-60.8-45-113.5-93.7-147.5L102.4 865.2z" fill="#FFA146" p-id="1151"></path>
<path d="M962 287c0-65.2-28.1-124.1-72.7-165.3L121.7 889.3C162.9 933.9 221.8 962 287 962h3.2L962 290.2V287z" fill="#FFA145" p-id="1152"></path>
<path d="M962 287c0-54.2-19.4-104-51.6-143L144 910.4c39 32.2 88.8 51.6 143 51.6h46.6L962 333.6V287z" fill="#FFA144" p-id="1153"></path>
<path d="M962 287c0-43.1-12.3-83.4-33.5-117.7L169.3 928.5C203.6 949.7 243.9 962 287 962h90.1L962 377.1V287z" fill="#FFA143" p-id="1154"></path>
<path d="M287 962h133.5L962 420.5V287c0-31.6-6.6-61.8-18.5-89.2L197.8 943.4c27.4 12 57.6 18.6 89.2 18.6z" fill="#FFA042" p-id="1155"></path>
<path d="M287 962h176.9L962 463.9V287c0-19.7-2.6-38.7-7.4-56.9L230.1 954.6c18.2 4.8 37.2 7.4 56.9 7.4z" fill="#FFA041" p-id="1156"></path>
<path d="M287 962h220.4L962 507.4V287c0-6.7-0.3-13.4-0.9-20L267 961.1c6.6 0.6 13.3 0.9 20 0.9z" fill="#FFA040" p-id="1157"></path>
<path d="M550.8 962L962 550.8V309.6L309.6 962z" fill="#FFA03F" p-id="1158"></path>
<path d="M594.2 962L962 594.2V353L353 962z" fill="#FF9F3E" p-id="1159"></path>
<path d="M637.7 962L962 637.7V396.4L396.4 962z" fill="#FF9F3D" p-id="1160"></path>
<path d="M681.1 962L962 681.1V439.9L439.9 962z" fill="#FF9F3C" p-id="1161"></path>
<path d="M724.5 962L962 724.5V483.3L483.3 962z" fill="#FF9F3B" p-id="1162"></path>
<path d="M962 737V526.7L526.7 962H737c11.4 0 22.5-0.9 33.5-2.5l189-189c1.6-11 2.5-22.1 2.5-33.5z" fill="#FF9F3A" p-id="1163"></path>
<path d="M962 737V570.2L570.2 962H737c34.3 0 66.9-7.8 96.1-21.7l107.2-107.2c13.9-29.2 21.7-61.8 21.7-96.1z" fill="#FF9E39" p-id="1164"></path>
<path d="M962 613.6L613.6 962H737c123.8 0 225-101.3 225-225V613.6z" fill="#FF9E38" p-id="1165"></path>
<path d="M962 657L657 962h80c123.8 0 225-101.3 225-225v-80z" fill="#FF9E37" p-id="1166"></path>
<path d="M962 700.5L700.5 962H737c123.8 0 225-101.3 225-225v-36.5z" fill="#FF9E36" p-id="1167"></path>
<path d="M961.9 744L744 961.9c118.2-3.7 214.2-99.7 217.9-217.9z" fill="#FF9D35" p-id="1168"></path>
<path d="M954.4 795L795 954.4c77.4-20.8 138.6-82 159.4-159.4z" fill="#FF9D34" p-id="1169"></path>
<path
d="M736.3 622.9L523.5 747.3c-5.6 3.3-12.4 3.3-18 0.1L287.8 622.6c-12.2-7-12-24.6 0.3-31.4l212.8-116.7c5.3-2.9 11.8-3 17.2-0.1l217.7 117c12.3 6.7 12.6 24.4 0.5 31.5z"
fill="#FFD9C0"
p-id="1170"
></path>
<path
d="M736.3 523.9L523.5 648.3c-5.6 3.3-12.4 3.3-18 0.1L287.8 523.6c-12.2-7-12-24.6 0.3-31.4l212.8-116.7c5.3-2.9 11.8-3 17.2-0.1l217.7 117c12.3 6.7 12.6 24.4 0.5 31.5z"
fill="#FFE8D9"
p-id="1171"
></path>
<path
d="M736.3 424.9L523.5 549.3c-5.6 3.3-12.4 3.3-18 0.1L287.8 424.6c-12.2-7-12-24.6 0.3-31.4l212.8-116.7c5.3-2.9 11.8-3 17.2-0.1l217.7 117c12.3 6.7 12.6 24.4 0.5 31.5z"
fill="#FFF6F0"
p-id="1172"
></path>
</svg>
);

View File

@ -1,40 +1,15 @@
function ColorfulDoc() {
return (
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27999" className="w-full h-full">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1300" className="w-full h-full">
<path
d="M701.781333 199.68a22.869333 22.869333 0 0 1 22.698667 22.186667v349.696h45.738667l34.133333-392.533334a22.698667 22.698667 0 0 0-20.650667-24.576L315.221333 113.834667A22.869333 22.869333 0 0 0 290.133333 134.656l-5.632 65.024z"
fill="#FFC670"
p-id="28000"
d="M197.99492187 62v900h-34.18066406C124.57285156 962 92.76171875 930.18886719 92.76171875 890.94746094V133.05253906C92.76171875 93.81113281 124.57285156 62 163.81425781 62h34.18066406z m662.19082032 0C899.42714844 62 931.23828125 93.81113281 931.23828125 133.05253906v757.89492188c0 39.24140625-31.81113281 71.05253906-71.05253906 71.05253906H276.92070312V62h583.26503907z"
fill="#19A05F"
p-id="1301"
></path>
<path
d="M313.002667 674.816A25.6 25.6 0 0 1 338.773333 648.533333h154.965334a51.2 51.2 0 0 0 32.085333-11.264l69.12-54.954666a51.2 51.2 0 0 1 32.085333-11.264h97.450667V221.866667a22.869333 22.869333 0 0 0-22.698667-22.869334H231.253333A22.869333 22.869333 0 0 0 208.554667 221.866667v638.805333a22.698667 22.698667 0 0 0 22.698666 22.698667h81.749334z"
fill="#FFF6E6"
p-id="28001"
></path>
<path
d="M724.48 571.562667v-94.890667a472.234667 472.234667 0 0 1-38.570667 94.890667zM313.002667 757.418667a514.56 514.56 0 0 1-104.448-15.36v119.466666a22.698667 22.698667 0 0 0 22.698666 22.698667h81.749334z"
fill="#FFEBCC"
p-id="28002"
></path>
<path
d="M594.944 582.826667l-69.12 54.954666a51.2 51.2 0 0 1-32.085333 11.264h-154.965334a25.6 25.6 0 0 0-25.770666 25.770667v209.578667a25.770667 25.770667 0 0 0 25.770666 25.770666h450.901334a25.941333 25.941333 0 0 0 25.770666-25.770666V597.333333a25.941333 25.941333 0 0 0-25.770666-25.770666h-162.645334a51.2 51.2 0 0 0-32.085333 11.264z"
fill="#96DDFF"
p-id="28003"
></path>
<path
d="M564.224 840.874667a971.776 971.776 0 0 1-251.221333-31.402667v74.922667a25.770667 25.770667 0 0 0 25.770666 25.770666h450.901334a25.941333 25.941333 0 0 0 25.770666-25.770666v-74.922667a971.776 971.776 0 0 1-251.221333 31.402667z"
fill="#69BAF9"
p-id="28004"
></path>
<path
d="M789.674667 554.496h-0.853334l32.768-373.418667A39.936 39.936 0 0 0 785.066667 137.898667l-468.48-40.96A40.106667 40.106667 0 0 0 273.066667 133.12l-4.266667 49.664h-37.546667A39.765333 39.765333 0 0 0 191.488 221.866667v638.805333a39.765333 39.765333 0 0 0 39.765333 39.765333h68.266667a43.178667 43.178667 0 0 0 39.765333 26.794667h450.389334a43.008 43.008 0 0 0 42.837333-42.837333V597.333333a43.008 43.008 0 0 0-42.837333-42.837333zM307.2 136.533333a5.632 5.632 0 0 1 6.144-5.12l468.650667 40.96a5.632 5.632 0 0 1 5.12 6.144l-32.597334 375.978667h-12.970666V221.866667a39.765333 39.765333 0 0 0-39.765334-39.765334H303.445333z m-11.605333 538.794667v190.976h-64.341334a5.632 5.632 0 0 1-5.632-5.632V221.866667a5.632 5.632 0 0 1 5.632-5.632h470.528a5.632 5.632 0 0 1 5.632 5.632v332.629333h-80.384a68.266667 68.266667 0 0 0-42.666666 15.018667l-69.12 54.954666a34.133333 34.133333 0 0 1-21.504 7.509334h-154.965334a42.837333 42.837333 0 0 0-42.837333 42.837333z m502.784 209.066667a8.704 8.704 0 0 1-8.704 8.704H338.773333a8.704 8.704 0 0 1-8.704-8.704V674.816a8.704 8.704 0 0 1 8.704-8.704h154.965334a68.266667 68.266667 0 0 0 42.837333-15.018667l68.266667-54.954666a35.328 35.328 0 0 1 21.504-7.509334h162.645333a8.704 8.704 0 0 1 8.704 8.704z"
fill="#3D3D63"
p-id="28005"
></path>
<path
d="M744.789333 823.808h-64.341333a17.066667 17.066667 0 0 0 0 34.133333h64.341333a17.066667 17.066667 0 0 0 0-34.133333zM421.546667 309.248H512a17.066667 17.066667 0 0 0 0-34.133333h-90.453333a17.066667 17.066667 0 0 0 0 34.133333zM324.266667 406.016h283.989333a17.066667 17.066667 0 0 0 0-34.133333H324.266667a17.066667 17.066667 0 0 0 0 34.133333zM625.322667 474.965333a17.066667 17.066667 0 0 0-17.066667-17.066666H324.266667a17.066667 17.066667 0 0 0 0 34.133333h283.989333a17.066667 17.066667 0 0 0 17.066667-17.066667z"
fill="#3D3D63"
p-id="28006"
d="M577.0390625 62l0.33222656 220.3875 111.2475586-108.80771484L800.19951172 284.36328125V62zM425.40224609 508.18554688h377.05078125v50.94404296h-377.05078125V508.18554688z m0 101.88720703h377.05078125v50.94316406h-377.05078125v-50.94316406z"
fill="#FFFFFF"
p-id="1302"
></path>
</svg>
);

View File

@ -1,25 +1,25 @@
function ColorfulExcel() {
return (
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7028" className="w-full h-full">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2006" className="w-full h-full">
<path
d="M163.560759 0.702493A152.675051 152.675051 0 0 0 11.822365 153.377544v632.243311a152.675051 152.675051 0 0 0 151.738394 151.738395h476.055797a152.675051 152.675051 0 0 0 152.675052-152.675052V314.950835A57.136062 57.136062 0 0 0 775.197622 274.674594L519.256163 17.093986a58.072719 58.072719 0 0 0-41.212898-17.093986z"
fill="#41CC8B"
p-id="7029"
d="M701.95942066 37.1014489H250.80579673a142.46956521 142.46956521 0 0 0-142.46956522 142.46956523v664.85797174a142.46956521 142.46956521 0 0 0 142.46956522 142.46956523h522.38840654a142.46956521 142.46956521 0 0 0 142.46956522-142.46956523V274.55072501L701.95942066 37.1014489z"
fill="#53D39C"
p-id="2007"
></path>
<path
d="M775.197622 274.674594L519.256163 17.093986a57.604391 57.604391 0 0 0-29.738852-15.689001 5.854105 5.854105 0 0 0-6.790762 5.854105V131.834439a178.433112 178.433112 0 0 0 178.433113 178.433112H784.564189a5.854105 5.854105 0 0 0 5.854105-6.790762A55.965241 55.965241 0 0 0 775.197622 274.674594z"
fill="#05B25F"
p-id="7030"
d="M444.2794663 392.18309566l69.64387283 117.72735109h2.70692174l69.97630108-117.70360654h82.4661337l-105.40373371 172.67311305 107.77822609 172.6968587h-83.98580869l-70.83111847-117.89356521h-2.70692174L443.09222066 737.57681196h-83.65338045l108.11065544-172.6968587-106.09233586-172.6968576h82.82230651z"
fill="#25BF79"
p-id="2008"
></path>
<path
d="M667.482095 281.69952h114.03796a51.98445 51.98445 0 0 0-6.322433-7.024926L519.256163 17.093986l-7.727418-6.322433v114.506288A156.187514 156.187514 0 0 0 667.482095 281.69952z"
fill="#B0F9D7"
p-id="7031"
d="M444.2794663 380.31063151l69.64387283 117.7273511h2.70692174l69.97630108-117.70360543h82.4661337l-105.40373371 172.67311305L671.44718803 725.70434783h-83.98580869l-70.83111847-117.89356522h-2.70692174L443.09222066 725.70434783h-83.65338045l108.11065544-172.6968576-106.09233586-172.69685872h82.82230651z"
fill="#FFFFFF"
p-id="2009"
></path>
<path
d="M92.140681 419.856391h117.082095v28.333867H128.904459v39.807913h67.205123v28.802195H128.904459v46.832838h81.957466v28.802195H92.140681zM274.554585 523.825292L232.639195 462.005946h40.510405l14.284015 23.416419q6.322433 11.239881 12.644867 21.777269l5.151612-10.771553 6.322433-11.005716 11.942374-23.416419H363.068649l-41.91539 66.268465 44.72536 63.69266h-40.978733l-15.923165-23.416419L302.185959 555.671621l-7.024925-11.239881-7.024926 11.239881-6.088269 11.70821-13.347359 23.416419H229.829225zM400.534919 576.980563a65.565973 65.565973 0 0 1-19.903956-50.111137 64.629316 64.629316 0 0 1 21.777269-50.813629 76.57169 76.57169 0 0 1 51.047794-17.796478 66.50263 66.50263 0 0 1 41.681225 14.518179l-17.796478 22.011434a35.124628 35.124628 0 0 0-22.011434-8.664075 33.251315 33.251315 0 0 0-26.226389 11.239881 41.447062 41.447062 0 0 0-10.303224 29.504688 40.978733 40.978733 0 0 0 10.06906 28.802195 32.782987 32.782987 0 0 0 25.523896 11.005717 46.832838 46.832838 0 0 0 27.865539-11.005717l14.752344 23.416419a72.590899 72.590899 0 0 1-46.832838 15.689001 70.249257 70.249257 0 0 1-49.642808-17.796478zM535.88182 576.746398a63.926824 63.926824 0 0 1-20.840613-49.876972 67.439287 67.439287 0 0 1 20.372285-50.345301 65.565973 65.565973 0 0 1 46.832838-18.264806 57.838555 57.838555 0 0 1 44.72536 17.562314 65.331809 65.331809 0 0 1 14.986508 44.72536 51.047793 51.047793 0 0 1-1.873313 15.454836h-88.514064a35.827121 35.827121 0 0 0 13.113195 23.416419 40.276241 40.276241 0 0 0 26.460553 8.429911 62.990167 62.990167 0 0 0 32.080494-9.132403l12.87903 21.074777a93.665676 93.665676 0 0 1-50.111136 14.284015 71.420078 71.420078 0 0 1-50.111137-17.32815z m73.527556-63.224331c0-19.201464-9.132403-28.802195-27.163046-28.802195a29.504688 29.504688 0 0 0-20.138121 7.25909 33.719643 33.719643 0 0 0-11.005716 21.543105zM672.399543 555.671621v-149.396752h37.232106V555.671621a10.771553 10.771553 0 0 0 2.575806 7.961583 6.322433 6.322433 0 0 0 5.151612 2.341642h5.151612l4.44912 25.289732a53.857764 53.857764 0 0 1-19.435628 3.044135c-23.416419 0.468328-35.124628-12.644866-35.124628-38.637092z"
fill="#F5F6FA"
p-id="7032"
d="M701.95942066 37.1014489l160.27826087 178.08695653L915.66376849 274.55072501h-142.46956522a71.23478261 71.23478261 0 0 1-71.23478261-71.23478261V37.1014489z"
fill="#25BF79"
p-id="2010"
></path>
</svg>
);

View File

@ -1,46 +1,10 @@
function ColorfulPlugin() {
return (
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="34873" className="w-full h-full">
<path d="M392.32 403.84a48 48 0 0 1-48 48h-96a48 48 0 0 1-48-48V236.16h192z" fill="#EA5E5A" p-id="34874"></path>
<path d="M259.84 176h24.32v24.32h-24.32zM307.84 176h24.32v24.32h-24.32z" fill="#34303D" p-id="34875"></path>
<path d="M380.16 236.16h-24.32V152.32H236.16v83.84h-24.32V128h168.32v108.16z" fill="#34303D" p-id="34876"></path>
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2147" className="w-full h-full">
<path
d="M344.32 464h-96a60.16 60.16 0 0 1-60.16-60.16V224h215.68v179.84a60.16 60.16 0 0 1-60.16 60.16zM211.84 248.32v155.52a35.84 35.84 0 0 0 35.84 35.84h96a35.84 35.84 0 0 0 35.84-35.84V248.32z"
fill="#34303D"
p-id="34877"
></path>
<path
d="M236.16 272h120.32v24.32H236.16zM236.16 320h120.32v24.32H236.16zM320 512h-48a24.32 24.32 0 0 1-23.68-23.68v-36.48h24.32v35.84H320v-35.84h24.32v35.84A24.32 24.32 0 0 1 320 512z"
fill="#34303D"
p-id="34878"
></path>
<path d="M632.32 620.16a48 48 0 0 1 48-48h96a48 48 0 0 1 48 48v168.32h-192z" fill="#EA5E5A" p-id="34879"></path>
<path d="M739.84 824.32h24.32v24.32h-24.32zM691.84 824.32h24.32v24.32h-24.32z" fill="#34303D" p-id="34880"></path>
<path d="M812.16 896h-168.32v-108.16h24.32v84.48h119.68v-84.48h24.32V896z" fill="#34303D" p-id="34881"></path>
<path
d="M835.84 800H620.16V620.16a60.16 60.16 0 0 1 60.16-60.16h96a60.16 60.16 0 0 1 60.16 60.16z m-192-23.68h168.32V620.16a35.84 35.84 0 0 0-35.84-35.84h-96a35.84 35.84 0 0 0-35.84 35.84z"
fill="#34303D"
p-id="34882"
></path>
<path
d="M668.16 680.32h120.32v24.32h-120.32zM668.16 728.32h120.32v24.32h-120.32zM776.32 572.16h-23.68v-35.84H704v35.84h-23.68v-35.84A24.32 24.32 0 0 1 704 512h48a24.32 24.32 0 0 1 24.32 24.32z"
fill="#34303D"
p-id="34883"
></path>
<path
d="M403.84 848a120.32 120.32 0 0 1-119.68-119.68V499.84h24.32v227.84a96 96 0 0 0 192 0V296.32a120.32 120.32 0 0 1 240 0v227.84h-23.68V296.32a96 96 0 0 0-192 0v432a120.32 120.32 0 0 1-119.68 120.32z"
fill="#34303D"
p-id="34884"
></path>
<path
d="M608 284.16h24.32v24.32H608zM608 332.16h24.32v24.32H608zM608 380.16h24.32v24.32H608zM392.32 620.16h24.32v24.32h-24.32zM392.32 668.16h24.32v24.32h-24.32zM392.32 716.16h24.32v24.32h-24.32z"
fill="#34303D"
p-id="34885"
></path>
<path
d="M691.84 296.32h-23.68a48 48 0 0 0-96 0h-24.32a72.32 72.32 0 0 1 144 0zM403.84 800a72.32 72.32 0 0 1-71.68-71.68h24.32a48 48 0 0 0 96 0h24.32a72.32 72.32 0 0 1-72.96 71.68z"
fill="#34303D"
p-id="34886"
d="M688.51536688 447.75428656l-2.39993719 1.25996719a200.75473031 200.75473031 0 0 1-7.19981156 38.03900156l-47.33875688 166.43563031 110.45710031-59.63843437-47.03876531-114.41699625a108.2971575 108.2971575 0 0 1-6.47982937-31.67916844z m194.87488406-200.99472375l-96.35747063-58.55846344-354.77068687 217.43429251a70.01816156 70.01816156 0 0 0-32.51914688 59.57843624v193.97490844l-158.99582625-98.09742562V362.67651969a69.4181775 69.4181775 0 0 1 33.95910844-60.41841375l358.67058469-206.99456625 13.55964469 7.97979L544.75914031 41.26495719a62.75835281 62.75835281 0 0 0-65.63827687 0L140.54975094 246.75956281a69.89816531 69.89816531 0 0 0-32.81913844 59.75843063v410.98921218c-0.11999719 24.47935781 12.2996775 47.1587625 32.81913844 59.81842969l338.5711125 205.49460563c20.21946937 12.23967844 45.35880937 12.23967844 65.63827687 0l338.69110875-205.49460563c20.33946563-12.41967375 32.87913656-35.09907844 32.8791375-59.81842968v-410.98921219a69.77816813 69.77816813 0 0 0-32.93913562-59.75843063z m-89.51764969 477.88745532l-31.01918625-75.65801438-150.53604844 81.35786438-30.47919937 108.95713968-95.81748563 51.7186425 151.61602032-485.20726312 103.79727562-56.09852719 148.73609531 322.97152219-96.29747156 51.95863594z m0-1e-8"
fill="#0F6CF9"
p-id="2148"
></path>
</svg>
);

View File

@ -4,6 +4,7 @@ import ColorfulDB from './colorful-db';
import ColorfulDoc from './colorful-doc';
import ColorfulExcel from './colorful-excel';
import ColorfulPlugin from './colorful-plugin';
import ColorfulChat from './colorful-chat';
import DarkSvg from './dark-svg';
import DBSvg from './db-svg';
import ModelSvg from './model-svg';
@ -24,6 +25,7 @@ export {
ColorfulDoc,
ColorfulExcel,
ColorfulPlugin,
ColorfulChat,
DarkSvg,
DBSvg,
ModelSvg,

View File

@ -185,7 +185,7 @@ export default function DocPanel(props: IProps) {
{hasMore && (
<Divider>
<span className="cursor-pointer" onClick={loadMoreDocuments}>
{t('Load_More')}
{t('Load_more')}
</span>
</Divider>
)}

View File

@ -82,7 +82,7 @@ export default function Segmentation(props: IProps) {
}
const strategy = strategies.filter((item) => item.strategy === name)[0];
const newParam: any = {
chunk_strategy: item.chunk_parameters.chunk_strategy,
chunk_strategy: item?.chunk_parameters?.chunk_strategy,
};
if (strategy && strategy.parameters) {
// remove unused parameter, otherwise api will failed.

View File

@ -1,7 +1,7 @@
import { Popover, ConfigProvider, Button, Modal, Badge } from 'antd';
import { useRouter } from 'next/router';
import Image from 'next/image';
import { DeleteTwoTone, MessageTwoTone, WarningOutlined } from '@ant-design/icons';
import { DeleteFilled, MessageTwoTone, WarningOutlined } from '@ant-design/icons';
import { ISpace } from '@/types/knowledge';
import DocPanel from './doc-panel';
import moment from 'moment';
@ -76,25 +76,24 @@ export default function SpaceCard(props: IProps) {
}}
>
<Popover
className="dark:hover:border-white transition-all hover:shadow-md bg-[#FFFFFF] dark:bg-[#484848] cursor-pointer rounded-[10px] border border-gray-200 border-solid"
className="transition-all bg-white dark:bg-theme-dark-container cursor-pointer rounded"
placement="bottom"
trigger="click"
content={<DocPanel space={space} onAddDoc={props.onAddDoc} onDeleteDoc={onDeleteDoc} />}
>
<Badge className="mr-4 mb-4 min-w-[200px] sm:w-60 lg:w-72" count={space.docs || 0}>
<Badge className="mb-4 min-w-[200px] sm:w-60 lg:w-72" count={space.docs || 0}>
<div className="flex justify-between mx-6 mt-3">
<div className="text-lg font-bold text-black truncate">
{renderVectorIcon(space.vector_type)}
<span className="dark:text-white ml-2">{space?.name}</span>
</div>
<DeleteTwoTone
<DeleteFilled
className="text-[#ff1b2e] !text-lg"
onClick={(e) => {
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
showDeleteConfirm();
}}
twoToneColor="#CD2029"
className="!text-2xl"
/>
</div>
<div className="text-sm mt-2 p-6 pt-2 h-40">

View File

@ -1,333 +0,0 @@
'use client';
import React, { useState, useEffect, useMemo, useContext } from 'react';
import { usePathname, useRouter } from 'next/navigation';
import Link from 'next/link';
import { Modal } from 'antd';
import {
Box,
List,
ListItem,
ListItemButton,
ListItemDecorator,
ListItemContent,
Typography,
Button,
useColorScheme,
IconButton,
Tooltip,
} from '@mui/joy';
import Article from '@mui/icons-material/Article';
import DarkModeIcon from '@mui/icons-material/DarkMode';
import WbSunnyIcon from '@mui/icons-material/WbSunny';
import SmsOutlinedIcon from '@mui/icons-material/SmsOutlined';
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
import Image from 'next/image';
import classNames from 'classnames';
import MenuIcon from '@mui/icons-material/Menu';
import DatasetIcon from '@mui/icons-material/Dataset';
import ExpandIcon from '@mui/icons-material/Expand';
import LanguageIcon from '@mui/icons-material/Language';
import ChatIcon from '@mui/icons-material/Chat';
import ModelTrainingIcon from '@mui/icons-material/ModelTraining';
import { useTranslation } from 'react-i18next';
import { ChatContext } from '@/app/chat-context';
import { DialogueListResponse } from '@/types/chat';
import { apiInterceptors, delDialogue } from '@/client/api';
const LeftSide = () => {
const pathname = usePathname();
const { t, i18n } = useTranslation();
const router = useRouter();
const [logoPath, setLogoPath] = useState('/LOGO_1.png');
const { dialogueList, chatId, queryDialogueList, refreshDialogList, isMenuExpand, setIsMenuExpand } = useContext(ChatContext);
const { mode, setMode } = useColorScheme();
const menus = useMemo(() => {
return [
{
label: t('Prompt'),
route: '/prompt',
icon: <ChatIcon fontSize="small" />,
tooltip: t('Prompt'),
active: pathname === '/prompt',
},
{
label: t('Data_Source'),
route: '/database',
icon: <DatasetIcon fontSize="small" />,
tooltip: t('Data_Source'),
active: pathname === '/database',
},
{
label: t('Knowledge_Space'),
route: '/knowledge',
icon: <Article fontSize="small" />,
tooltip: t('Knowledge_Space'),
active: pathname === '/knowledge',
},
{
label: t('model_manage'),
route: '/models',
icon: <ModelTrainingIcon fontSize="small" />,
tooltip: t('model_manage'),
active: pathname === '/models',
},
];
}, [pathname, i18n.language]);
function handleChangeTheme() {
if (mode === 'light') {
setMode('dark');
} else {
setMode('light');
}
}
const handleChangeLanguage = () => {
const language = i18n.language === 'en' ? 'zh' : 'en';
i18n.changeLanguage(language);
window.localStorage.setItem('db_gpt_lng', language);
};
useEffect(() => {
if (mode === 'light') {
setLogoPath('/LOGO_1.png');
} else {
setLogoPath('/WHITE_LOGO.png');
}
}, [mode]);
useEffect(() => {
(async () => {
await queryDialogueList();
})();
}, []);
function expandMenu() {
return (
<>
<Box className="p-2 gap-2 flex flex-row justify-between items-center">
<div className="flex items-center gap-3">
<Link href={'/'}>
<Image src={logoPath} alt="DB-GPT" width={633} height={157} className="w-full max-w-full" />
</Link>
</div>
</Box>
<Box className="p-2">
<Link href={`/`}>
<Button
color="primary"
className="w-full bg-gradient-to-r from-[#31afff] to-[#1677ff] dark:bg-gradient-to-r dark:from-[#6a6a6a] dark:to-[#80868f]"
style={{
color: '#fff',
}}
>
+ New Chat
</Button>
</Link>
</Box>
<Box className="p-2 hidden xs:block sm:inline-block max-h-full overflow-auto">
<List size="sm" sx={{ '--ListItem-radius': '8px' }}>
<ListItem nested>
<List
size="sm"
aria-labelledby="nav-list-browse"
sx={{
'& .JoyListItemButton-root': { p: '8px' },
gap: '4px',
}}
>
{(dialogueList || []).map((dialogue: DialogueListResponse[0]) => {
const isSelect = (pathname === `/chat` || pathname === '/chat/') && chatId === dialogue.conv_uid;
return (
<ListItem key={dialogue.conv_uid}>
<ListItemButton
selected={isSelect}
variant={isSelect ? 'soft' : 'plain'}
sx={{
'&:hover .del-btn': {
visibility: 'visible',
},
}}
>
<ListItemContent>
<Link href={`/chat?id=${dialogue.conv_uid}&scene=${dialogue?.chat_mode}`} className="flex items-center justify-between">
<Typography fontSize={14} noWrap={true}>
<SmsOutlinedIcon style={{ marginRight: '0.5rem' }} />
{dialogue?.user_name || dialogue?.user_input || 'undefined'}
</Typography>
<IconButton
color="neutral"
variant="plain"
size="sm"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
Modal.confirm({
title: 'Delete Chat',
content: 'Are you sure delete this chat?',
width: '276px',
centered: true,
async onOk() {
await apiInterceptors(delDialogue(dialogue.conv_uid));
await refreshDialogList();
if (pathname === `/chat` && chatId === dialogue.conv_uid) {
router.push('/');
}
},
});
}}
className="del-btn invisible"
>
<DeleteOutlineOutlinedIcon />
</IconButton>
</Link>
</ListItemContent>
</ListItemButton>
</ListItem>
);
})}
</List>
</ListItem>
</List>
</Box>
<div className="flex flex-col justify-end flex-1">
<Box className="p-2 pt-3 pb-6 border-t border-divider xs:block sticky bottom-0 z-100">
<List size="sm" sx={{ '--ListItem-radius': '8px' }}>
<ListItem nested>
<List
size="sm"
aria-labelledby="nav-list-browse"
sx={{
'& .JoyListItemButton-root': { p: '8px' },
}}
>
{menus.map((menu) => (
<Link key={menu.route} href={menu.route}>
<ListItem>
<ListItemButton
color="neutral"
sx={{ marginBottom: 1, height: '2.5rem' }}
selected={menu.active}
variant={menu.active ? 'soft' : 'plain'}
>
<ListItemDecorator
sx={{
color: menu.active ? 'inherit' : 'neutral.500',
}}
>
{menu.icon}
</ListItemDecorator>
<ListItemContent>{menu.label}</ListItemContent>
</ListItemButton>
</ListItem>
</Link>
))}
</List>
</ListItem>
<ListItem>
<ListItemButton className="h-10" onClick={handleChangeTheme}>
<Tooltip title={t('Theme')}>
<ListItemDecorator>{mode === 'dark' ? <DarkModeIcon fontSize="small" /> : <WbSunnyIcon fontSize="small" />}</ListItemDecorator>
</Tooltip>
<ListItemContent>{t('Theme')}</ListItemContent>
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton className="h-10" onClick={handleChangeLanguage}>
<Tooltip title={t('language')}>
<ListItemDecorator className="text-2xl">
<LanguageIcon fontSize="small" />
</ListItemDecorator>
</Tooltip>
<ListItemContent>{t('language')}</ListItemContent>
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton
className="h-10"
onClick={() => {
setIsMenuExpand(false);
}}
>
<Tooltip title={t('Close_Sidebar')}>
<ListItemDecorator className="text-2xl">
<ExpandIcon className="transform rotate-90" fontSize="small" />
</ListItemDecorator>
</Tooltip>
<ListItemContent>{t('Close_Sidebar')}</ListItemContent>
</ListItemButton>
</ListItem>
</List>
</Box>
</div>
</>
);
}
function notExpandMenu() {
return (
<Box className="h-full py-6 flex flex-col justify-between">
<Box className="flex justify-center items-center">
<Tooltip title="Menu">
<MenuIcon
className="cursor-pointer text-2xl"
onClick={() => {
setIsMenuExpand(true);
}}
/>
</Tooltip>
</Box>
<Box className="flex flex-col gap-4 justify-center items-center">
{menus.map((menu, index) => (
<div className="flex justify-center text-2xl cursor-pointer" key={`menu_${index}`}>
<Tooltip title={menu.tooltip}>{menu.icon}</Tooltip>
</div>
))}
<ListItem>
<ListItemButton onClick={handleChangeTheme}>
<Tooltip title={t('Theme')}>
<ListItemDecorator className="text-2xl">
{mode === 'dark' ? <DarkModeIcon fontSize="small" /> : <WbSunnyIcon fontSize="small" />}
</ListItemDecorator>
</Tooltip>
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton onClick={handleChangeLanguage}>
<Tooltip title={t('language')}>
<ListItemDecorator className="text-2xl">
<LanguageIcon fontSize="small" />
</ListItemDecorator>
</Tooltip>
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton
onClick={() => {
setIsMenuExpand(true);
}}
>
<Tooltip title={t('Open_Sidebar')}>
<ListItemDecorator className="text-2xl">
<ExpandIcon className="transform rotate-90" fontSize="small" />
</ListItemDecorator>
</Tooltip>
</ListItemButton>
</ListItem>
</Box>
</Box>
);
}
return (
<>
<nav className={classNames('grid max-h-screen h-full max-md:hidden')}>
<Box className="flex flex-col border-r border-divider max-h-screen sticky left-0 top-0 overflow-hidden">
{isMenuExpand ? expandMenu() : notExpandMenu()}
</Box>
</nav>
</>
);
};
export default LeftSide;

View File

@ -2,7 +2,6 @@ import { ChatContext } from '@/app/chat-context';
import { apiInterceptors, delDialogue } from '@/client/api';
import { STORAGE_LANG_KEY, STORAGE_THEME_KEY } from '@/utils';
import { DarkSvg, SunnySvg, ModelSvg } from '@/components/icons';
import { useColorScheme } from '@mui/joy';
import { IChatDialogueSchema } from '@/types/chat';
import Icon, {
ConsoleSqlOutlined,
@ -43,22 +42,21 @@ type RouteItem = {
};
function menuItemStyle(active?: boolean) {
return `flex items-center px-2 h-8 hover:bg-slate-100 dark:hover:bg-[#353539] text-base w-full my-2 rounded transition-colors whitespace-nowrap ${
active ? 'bg-slate-100 dark:bg-[#353539]' : ''
return `flex items-center h-12 hover:bg-[#F1F5F9] dark:hover:bg-theme-dark text-base w-full transition-colors whitespace-nowrap px-4 ${
active ? 'bg-[#F1F5F9] dark:bg-theme-dark' : ''
}`;
}
function smallMenuItemStyle(active?: boolean) {
return `flex items-center justify-center mx-auto w-12 h-12 text-xl rounded hover:bg-slate-100 dark:hover:bg-[#353539] cursor-pointer ${
active ? 'bg-slate-100 dark:bg-[#353539]' : ''
return `flex items-center justify-center mx-auto rounded w-14 h-14 text-xl hover:bg-[#F1F5F9] dark:hover:bg-theme-dark transition-colors cursor-pointer ${
active ? 'bg-[#F1F5F9] dark:bg-theme-dark' : ''
}`;
}
function SideBar() {
const { chatId, scene, isMenuExpand, dialogueList, queryDialogueList, refreshDialogList, setIsMenuExpand } = useContext(ChatContext);
const { chatId, scene, isMenuExpand, dialogueList, queryDialogueList, refreshDialogList, setIsMenuExpand, mode, setMode } = useContext(ChatContext);
const { pathname, replace } = useRouter();
const { t, i18n } = useTranslation();
const { mode, setMode } = useColorScheme();
const [logo, setLogo] = useState<string>('/LOGO_1.png');
@ -195,7 +193,7 @@ function SideBar() {
);
const copyLink = useCallback((item: IChatDialogueSchema) => {
const success = copy(`${location.origin}/chat/${item.chat_mode}/${item.conv_uid}`);
const success = copy(`${location.origin}/chat?scene=${item.chat_mode}&id=${item.conv_uid}`);
message[success ? 'success' : 'error'](success ? 'Copy success' : 'Copy failed');
}, []);
@ -209,20 +207,17 @@ function SideBar() {
if (!isMenuExpand) {
return (
<div className="flex flex-col justify-between h-screen border-r dark:bg-[#1A1E26] animate-fade animate-duration-300">
<div className="flex flex-col justify-between h-screen bg-white dark:bg-[#232734] animate-fade animate-duration-300">
<Link href="/" className="px-2 py-3">
<Image src="/LOGO_SMALL.png" alt="DB-GPT" width={63} height={46} className="w-[63px] h-[46px]" />
</Link>
<div className="border-t border-dashed">
<Link
href="/"
className="flex items-center justify-center my-4 mx-auto w-12 h-12 bg-gradient-to-r from-[#31afff] to-[#1677ff] dark:bg-gradient-to-r dark:from-[#6a6a6a] dark:to-[#80868f] border-none rounded-full text-white"
>
<div>
<Link href="/" className="flex items-center justify-center my-4 mx-auto w-12 h-12 bg-theme-primary rounded-full text-white">
<PlusOutlined className="text-lg" />
</Link>
</div>
{/* Chat List */}
<div className="flex-1 overflow-y-scroll py-4 border-t border-dashed space-y-2">
<div className="flex-1 overflow-y-scroll py-4 space-y-2">
{dialogueList?.map((item) => {
const active = item.conv_uid === chatId && item.chat_mode === scene;
@ -235,7 +230,7 @@ function SideBar() {
);
})}
</div>
<div className="py-4 space-y-2 border-t">
<div className="py-4">
<Dropdown menu={{ items: dropDownRoutes }} placement="topRight">
<div className={smallMenuItemStyle()}>
<MenuOutlined />
@ -261,20 +256,17 @@ function SideBar() {
}
return (
<div className="flex flex-col h-screen border-r dark:border-gray-700">
<div className="flex flex-col h-screen bg-white dark:bg-[#232734]">
{/* LOGO */}
<Link href="/" className="p-2">
<Image src={logo} alt="DB-GPT" width={239} height={60} className="w-full h-full" />
</Link>
<Link
href="/"
className="flex items-center justify-center mb-4 mx-4 h-11 bg-gradient-to-r from-[#31afff] to-[#1677ff] dark:bg-gradient-to-r dark:from-[#6a6a6a] dark:to-[#80868f] border-none rounded text-white"
>
<Link href="/" className="flex items-center justify-center mb-4 mx-4 h-11 bg-theme-primary rounded text-white">
<PlusOutlined className="mr-2" />
<span>New Chat</span>
<span>{t('new_chat')}</span>
</Link>
{/* Chat List */}
<div className="flex-1 overflow-y-scroll py-4 px-2 border-t dark:border-gray-700">
<div className="flex-1 overflow-y-scroll">
{dialogueList?.map((item) => {
const active = item.conv_uid === chatId && item.chat_mode === scene;
@ -305,18 +297,18 @@ function SideBar() {
})}
</div>
{/* Settings */}
<div className="py-2 border-t dark:border-gray-700">
<div className="px-2">
<div className="pt-4">
<div className="max-h-52 overflow-y-auto">
{routes.map((item) => (
<Link key={item.key} href={item.path} className={`${menuItemStyle(pathname === item.path)}`}>
<Link key={item.key} href={item.path} className={`${menuItemStyle(pathname === item.path)} overflow-hidden`}>
<>
{item.icon}
<span className="ml-2 text-sm">{item.name}</span>
<span className="ml-3 text-sm">{item.name}</span>
</>
</Link>
))}
</div>
<div className="flex items-center justify-around py-4 border-t border-dashed dark:border-gray-700">
<div className="flex items-center justify-around py-4 mt-2">
{settings.map((item) => (
<Tooltip key={item.key} title={item.name}>
<div className="flex-1 flex items-center justify-center cursor-pointer text-xl" onClick={item.onClick}>

View File

@ -37,8 +37,8 @@ function ModelCard({ info }: Props) {
}
}
return (
<div className="relative flex flex-col p-1 md:p-2 sm:w-1/2 lg:w-1/3">
<div className="relative flex items-center p-4 min-w-min rounded-lg justify-between bg-white border-gray-200 border hover:shadow-md dark:border-gray-600 dark:bg-black dark:hover:border-white transition-all text-black dark:text-white">
<div className="relative flex flex-col p-1 md:p-2 sm:w-1/2 lg:w-1/4">
<div className="relative flex items-center p-4 min-w-min rounded-lg justify-between bg-white dark:bg-theme-dark-container">
<div className="flex flex-col">
{info.healthy && (
<Tooltip title="Healthy">

View File

@ -17,11 +17,11 @@ export const joyTheme = extendTheme({
plainHoverColor: '#131318',
plainHoverBg: '#EBEBEF',
plainActiveBg: '#D8D8DF',
plainDisabledColor: '#B9B9C6'
plainDisabledColor: '#B9B9C6',
},
background: {
body: '#fff',
surface: '#fff'
body: '#F7F7F7',
surface: '#fff',
},
text: {
primary: '#505050',
@ -46,15 +46,15 @@ export const joyTheme = extendTheme({
plainActiveBg: '#434356',
plainDisabledColor: '#434356',
outlinedBorder: '#353539',
outlinedHoverBorder: '#454651'
outlinedHoverBorder: '#454651',
},
text: {
primary: '#EBEBEF'
primary: '#FDFDFC',
},
background: {
body: '#212121',
body: '#151622',
surface: '#51525beb',
}
},
},
},
},
@ -62,15 +62,7 @@ export const joyTheme = extendTheme({
body: 'Josefin Sans, sans-serif',
display: 'Josefin Sans, sans-serif',
},
typography: {
display1: {
background:
'linear-gradient(-30deg, var(--joy-palette-primary-900), var(--joy-palette-primary-400))',
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
},
},
zIndex: {
modal: 1001
}
});
modal: 1001,
},
});

36
web/genAntdCss.ts Normal file
View File

@ -0,0 +1,36 @@
import { createHash } from 'crypto';
import fs from 'fs';
import path from 'path';
import { extractStyle } from '@ant-design/cssinjs';
import type Entity from '@ant-design/cssinjs/lib/Cache';
export type DoExtraStyleOptions = {
cache: Entity;
dir?: string;
baseFileName?: string;
};
export function doExtraStyle({ cache, dir = 'antd-output', baseFileName = 'antd.min' }: DoExtraStyleOptions) {
const baseDir = path.resolve(__dirname, '../../static/css');
const outputCssPath = path.join(baseDir, dir);
if (!fs.existsSync(outputCssPath)) {
fs.mkdirSync(outputCssPath, { recursive: true });
}
const css = extractStyle(cache, true);
if (!css) return '';
const md5 = createHash('md5');
const hash = md5.update(css).digest('hex');
const fileName = `${baseFileName}.${hash.substring(0, 8)}.css`;
const fullpath = path.join(outputCssPath, fileName);
const res = `_next/static/css/${dir}/${fileName}`;
if (fs.existsSync(fullpath)) return res;
fs.writeFileSync(fullpath, css);
return res;
}

View File

@ -11,27 +11,26 @@ import '../styles/globals.css';
import '../nprogress.css';
import '../app/i18n';
import { STORAGE_LANG_KEY, STORAGE_THEME_KEY } from '@/utils';
import { ConfigProvider, theme } from 'antd';
import { ConfigProvider, MappingAlgorithm, theme } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import enUS from 'antd/locale/en_US';
type ThemeMode = ReturnType<typeof useColorScheme>['mode'];
function getDefaultTheme(): ThemeMode {
const theme = localStorage.getItem(STORAGE_THEME_KEY) as ThemeMode;
if (theme) return theme;
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
const antdDarkTheme: MappingAlgorithm = (seedToken, mapToken) => {
return {
...theme.darkAlgorithm(seedToken, mapToken),
colorBgBase: '#232734',
colorBorder: '#828282',
colorBgContainer: '#232734',
};
};
function CssWrapper({ children }: { children: React.ReactElement }) {
const { mode } = useContext(ChatContext);
const { i18n } = useTranslation();
const { mode, setMode } = useColorScheme();
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
const themeMode = getDefaultTheme();
setMode(themeMode!);
}, []);
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
if (ref?.current && mode) {
@ -51,14 +50,13 @@ function CssWrapper({ children }: { children: React.ReactElement }) {
return (
<div ref={ref}>
<TopProgressBar />
<ChatContextProvider>{children}</ChatContextProvider>
{children}
</div>
);
}
function LayoutWrapper({ children }: { children: React.ReactNode }) {
const { isMenuExpand } = useContext(ChatContext);
const { mode } = useColorScheme();
const { isMenuExpand, mode } = useContext(ChatContext);
const { i18n } = useTranslation();
return (
@ -66,13 +64,14 @@ function LayoutWrapper({ children }: { children: React.ReactNode }) {
locale={i18n.language === 'en' ? enUS : zhCN}
theme={{
token: {
colorPrimary: '#0069FE',
borderRadius: 4,
},
algorithm: mode === 'dark' ? theme.darkAlgorithm : undefined,
algorithm: mode === 'dark' ? antdDarkTheme : undefined,
}}
>
<div className="flex w-screen h-screen overflow-hidden">
<div className={classNames('transition-[width]', isMenuExpand ? 'w-64' : 'w-20', 'hidden', 'md:block')}>
<div className={classNames('transition-[width]', isMenuExpand ? 'w-60' : 'w-20', 'hidden', 'md:block')}>
<SideBar />
</div>
<div className="flex flex-col flex-1 relative overflow-hidden">{children}</div>
@ -83,15 +82,13 @@ function LayoutWrapper({ children }: { children: React.ReactNode }) {
function MyApp({ Component, pageProps }: AppProps) {
return (
<ThemeProvider theme={joyTheme}>
<CssVarsProvider theme={joyTheme} defaultMode="light">
<CssWrapper>
<LayoutWrapper>
<Component {...pageProps} />
</LayoutWrapper>
</CssWrapper>
</CssVarsProvider>
</ThemeProvider>
<ChatContextProvider>
<CssWrapper>
<LayoutWrapper>
<Component {...pageProps} />
</LayoutWrapper>
</CssWrapper>
</ChatContextProvider>
);
}

View File

@ -1,6 +1,39 @@
import Document, { Head, Html, Main, NextScript } from 'next/document';
import { createCache, StyleProvider } from '@ant-design/cssinjs';
import Document, { DocumentContext, Head, Html, Main, NextScript } from 'next/document';
import { doExtraStyle } from '../genAntdCss';
class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext) {
const cache = createCache();
let fileName = '';
const originalRenderPage = ctx.renderPage;
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) => (props) =>
(
<StyleProvider cache={cache} hashPriority="high">
<App {...props} />
</StyleProvider>
),
});
const initialProps = await Document.getInitialProps(ctx);
fileName = doExtraStyle({
cache,
});
return {
...initialProps,
styles: (
<>
{initialProps.styles}
{/* 1.2 inject css */}
{fileName && <link rel="stylesheet" href={`/${fileName}`} />}
</>
),
};
}
render() {
return (
<Html lang="en">

View File

@ -1,27 +0,0 @@
import React, { useContext, useEffect } from 'react';
import { useRouter } from 'next/router';
import { ChatContext } from '@/app/chat-context';
import dynamic from 'next/dynamic';
const DbEditor = dynamic(() => import('@/components/chat/db-editor'), { ssr: false });
const ChatContainer = dynamic(() => import('@/components/chat/chat-container'), { ssr: false });
function Chat() {
const {
query: { id, scene },
} = useRouter();
const { isContract, setIsContract, setIsMenuExpand } = useContext(ChatContext);
useEffect(() => {
// 仅初始化执行防止dashboard页面无法切换状态
setIsMenuExpand(scene !== 'chat_dashboard');
// 路由变了要取消Editor模式再进来是默认的Preview模式
if (id && scene) {
setIsContract(false);
}
}, [id, scene]);
return <>{isContract ? <DbEditor /> : <ChatContainer />}</>;
}
export default Chat;

View File

@ -12,7 +12,7 @@ import CompletionInput from '@/components/common/completion-input';
import { useTranslation } from 'react-i18next';
import { STORAGE_INIT_MESSAGE_KET } from '@/utils';
import Icon from '@ant-design/icons/lib/components/Icon';
import { ColorfulDB, ColorfulPlugin, ColorfulDashboard, ColorfulData, ColorfulExcel, ColorfulDoc } from '@/components/icons';
import { ColorfulDB, ColorfulPlugin, ColorfulDashboard, ColorfulData, ColorfulExcel, ColorfulDoc, ColorfulChat } from '@/components/icons';
import classNames from 'classnames';
const Home: NextPage = () => {
@ -51,17 +51,19 @@ const Home: NextPage = () => {
function renderSceneIcon(scene: string) {
switch (scene) {
case 'chat_knowledge':
return <Icon className="w-10 h-10 mr-4 p-1 bg-white rounded" component={ColorfulDoc} />;
return <Icon className="w-10 h-10 mr-4 p-1" component={ColorfulDoc} />;
case 'chat_with_db_execute':
return <Icon className="w-10 h-10 mr-4 p-1 bg-white rounded" component={ColorfulData} />;
return <Icon className="w-10 h-10 mr-4 p-1" component={ColorfulData} />;
case 'chat_excel':
return <Icon className="w-10 h-10 mr-4 p-1 bg-white rounded" component={ColorfulExcel} />;
return <Icon className="w-10 h-10 mr-4 p-1" component={ColorfulExcel} />;
case 'chat_with_db_qa':
return <Icon className="w-10 h-10 mr-4 p-1 bg-white rounded" component={ColorfulDB} />;
return <Icon className="w-10 h-10 mr-4 p-1" component={ColorfulDB} />;
case 'chat_dashboard':
return <Icon className="w-10 h-10 mr-4 p-1 bg-white rounded" component={ColorfulDashboard} />;
return <Icon className="w-10 h-10 mr-4 p-1" component={ColorfulDashboard} />;
case 'chat_agent':
return <Icon className="w-10 h-10 mr-4 p-1 bg-white rounded" component={ColorfulPlugin} />;
return <Icon className="w-10 h-10 mr-4 p-1" component={ColorfulPlugin} />;
case 'dbgpt_chat':
return <Icon className="w-10 h-10 mr-4 p-1" component={ColorfulChat} />;
default:
return null;
}
@ -93,7 +95,7 @@ const Home: NextPage = () => {
>
<div
className={classNames(
'flex flex-row justify-center min-h-min border bg-slate-50 border-gray-300 dark:bg-black bg-opacity-50 border-opacity-50 text-gray-950 dark:text-white rounded p-4 cursor-pointer',
'flex flex-row justify-center h-[102px] min-h-min bg-white dark:bg-[#232734] dark:text-white rounded p-4 cursor-pointer hover:-translate-y-1 transition-[transform_shadow] duration-300 hover:shadow-[0_14px_20px_-10px_rgba(100,100,100,.1)]',
{ 'grayscale !cursor-no-drop': scene.show_disable },
)}
>

View File

@ -48,7 +48,7 @@ function ChunkList() {
}, [id, spaceName]);
return (
<div className="h-full overflow-y-scroll relative">
<div className="h-full overflow-y-scroll relative px-2">
<Breadcrumb
className="m-6"
items={[
@ -71,6 +71,7 @@ function ChunkList() {
return (
<Card
key={chunk.id}
className="mt-2"
title={
<>
<DocIcon type={chunk.doc_type} />

View File

@ -59,7 +59,7 @@ const Knowledge = () => {
}
return (
<div className="bg-[#FAFAFA] dark:bg-[#212121] w-full h-full">
<div className="bg-[#FAFAFA] dark:bg-transparent w-full h-full">
<div className="page-body p-4 md:p-6 h-full overflow-auto">
<Button
type="primary"
@ -71,7 +71,7 @@ const Knowledge = () => {
>
Create
</Button>
<div className="flex flex-wrap mt-4">
<div className="flex flex-wrap mt-4 gap-4">
{spaceList?.map((space: ISpace) => (
<SpaceCard key={space.id} space={space} onAddDoc={onAddDoc} getSpaces={getSpaces} />
))}

View File

@ -4,23 +4,31 @@
body {
margin: 0;
color: var(--joy-palette-text-primary, var(--joy-palette-neutral-800, #25252d));
font-family: var(--joy-fontFamily-body, var(--joy-Josefin Sans, sans-serif));
font-size: var(--joy-fontSize-md, 1rem);
line-height: var(--joy-lineHeight-md, 1.5);
background-color: var(--joy-palette-background-body);
--antd-primary-color: #0069fe;
}
body .ant-btn-primary {
background-color: #1677ff;
.light {
color: #333;
background-color: #f7f7f7;
}
.dark {
color: #f7f7f7;
background-color: #151622;
}
.ant-btn-primary {
background-color: var(--antd-primary-color);
}
.ant-pagination .ant-pagination-prev * {
color: rgb(39, 155, 255) !important;
color: var(--antd-primary-color) !important;
}
.ant-pagination .ant-pagination-next * {
color: rgb(39, 155, 255) !important;
color: var(--antd-primary-color) !important;
}
.ant-pagination .ant-pagination-item a {
@ -28,7 +36,7 @@ body .ant-btn-primary {
}
.ant-pagination .ant-pagination-item.ant-pagination-item-active {
background-color: rgb(39, 155, 255) !important;
background-color: var(--antd-primary-color) !important;
}
.ant-pagination .ant-pagination-item.ant-pagination-item-active a {
@ -61,11 +69,13 @@ table tr td {
.dark :where(.css-dev-only-do-not-override-18iikkb).ant-tabs .ant-tabs-tab-btn {
color: white;
}
:where(.css-dev-only-do-not-override-18iikkb).ant-form-item .ant-form-item-label > label {
:where(.css-dev-only-do-not-override-18iikkb).ant-form-item .ant-form-item-label>label {
height: 36px;
}
@keyframes rotate {
to {
transform: rotate(360deg);
}
}
}

View File

@ -8,8 +8,17 @@ module.exports = {
fontFamily: {
sans: ['"Josefin Sans"', ...defaultTheme.fontFamily.sans],
},
colors: {
theme: {
primary: '#0069fe',
light: '#f7f7f7',
dark: '#151622',
'dark-container': '#232734',
},
},
},
},
important: true,
darkMode: 'class',
/**
* @see https://www.tailwindcss-animated.com/configurator.html