From b45095f7ec6d5926a6295b9278924d092760ab60 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Tue, 27 May 2025 19:06:47 +0800 Subject: [PATCH] feat: knowledge --- ui/src/api/knowledge/document.ts | 420 ++++++++ ui/src/api/knowledge/knowledge.ts | 61 +- ui/src/api/type/knowledge.ts | 9 + ui/src/components/app-icon/icons/document.ts | 55 + ui/src/components/app-icon/icons/knowledge.ts | 57 ++ ui/src/components/app-table/index.vue | 159 +++ ui/src/components/back-button/index.vue | 31 + ui/src/components/index.ts | 4 + ui/src/enums/common.ts | 16 + ui/src/layout/components/breadcrumb/index.vue | 32 +- .../layout/components/sidebar/SidebarItem.vue | 4 +- ui/src/layout/components/sidebar/index.vue | 7 +- .../layout/layout-header/top-menu/index.vue | 2 +- ui/src/layout/layout-template/MainLayout.vue | 4 +- ui/src/locales/lang/en-US/common.ts | 4 + ui/src/locales/lang/en-US/views/model.ts | 4 +- ui/src/locales/lang/zh-CN/common.ts | 4 + ui/src/locales/lang/zh-CN/views/document.ts | 176 ++++ ui/src/locales/lang/zh-CN/views/index.ts | 4 +- ui/src/locales/lang/zh-CN/views/knowledge.ts | 4 + ui/src/locales/lang/zh-CN/views/model.ts | 3 - ui/src/locales/lang/zh-Hant/common.ts | 6 +- ui/src/locales/lang/zh-Hant/views/model.ts | 3 - ui/src/router/modules/2knowledge.ts | 6 +- ui/src/router/modules/document.ts | 62 ++ ui/src/router/routes.ts | 2 +- ui/src/stores/index.ts | 4 + ui/src/stores/modules/common.ts | 52 + ui/src/stores/modules/knowledge.ts | 77 ++ ui/src/styles/app.scss | 4 - ui/src/styles/component.scss | 29 + ui/src/styles/element-plus.scss | 5 +- ui/src/styles/variables.scss | 1 + ui/src/utils/status.ts | 68 ++ .../component/EmbeddingContentDialog.vue | 48 + .../component/ImportDocumentDialog.vue | 233 +++++ .../component/SelectDatasetDialog.vue | 142 +++ ui/src/views/document/component/Status.vue | 87 ++ .../views/document/component/StatusTable.vue | 109 ++ ui/src/views/document/index.vue | 953 ++++++++++++++++++ ui/src/views/knowledge/component/BaseForm.vue | 147 +++ .../component/CreateDatasetDialog.vue | 329 ++++++ .../component/EditParagraphDialog.vue | 135 +++ .../knowledge/component/ParagraphList.vue | 109 ++ .../knowledge/component/ParagraphPreview.vue | 70 ++ .../knowledge/component/ResultSuccess.vue | 90 ++ ui/src/views/knowledge/component/SetRules.vue | 279 +++++ .../knowledge/component/SyncWebDialog.vue | 87 ++ .../knowledge/component/UploadComponent.vue | 327 ++++++ ui/src/views/knowledge/index.vue | 132 ++- ui/src/views/model/index.vue | 2 +- ui/src/views/tool/index.vue | 12 +- 52 files changed, 4602 insertions(+), 68 deletions(-) create mode 100644 ui/src/api/knowledge/document.ts create mode 100644 ui/src/api/type/knowledge.ts create mode 100644 ui/src/components/app-icon/icons/document.ts create mode 100644 ui/src/components/app-icon/icons/knowledge.ts create mode 100644 ui/src/components/app-table/index.vue create mode 100644 ui/src/components/back-button/index.vue create mode 100644 ui/src/enums/common.ts create mode 100644 ui/src/locales/lang/zh-CN/views/document.ts create mode 100644 ui/src/router/modules/document.ts create mode 100644 ui/src/stores/modules/common.ts create mode 100644 ui/src/stores/modules/knowledge.ts create mode 100644 ui/src/utils/status.ts create mode 100644 ui/src/views/document/component/EmbeddingContentDialog.vue create mode 100644 ui/src/views/document/component/ImportDocumentDialog.vue create mode 100644 ui/src/views/document/component/SelectDatasetDialog.vue create mode 100644 ui/src/views/document/component/Status.vue create mode 100644 ui/src/views/document/component/StatusTable.vue create mode 100644 ui/src/views/document/index.vue create mode 100644 ui/src/views/knowledge/component/BaseForm.vue create mode 100644 ui/src/views/knowledge/component/CreateDatasetDialog.vue create mode 100644 ui/src/views/knowledge/component/EditParagraphDialog.vue create mode 100644 ui/src/views/knowledge/component/ParagraphList.vue create mode 100644 ui/src/views/knowledge/component/ParagraphPreview.vue create mode 100644 ui/src/views/knowledge/component/ResultSuccess.vue create mode 100644 ui/src/views/knowledge/component/SetRules.vue create mode 100644 ui/src/views/knowledge/component/SyncWebDialog.vue create mode 100644 ui/src/views/knowledge/component/UploadComponent.vue diff --git a/ui/src/api/knowledge/document.ts b/ui/src/api/knowledge/document.ts new file mode 100644 index 00000000..486dc025 --- /dev/null +++ b/ui/src/api/knowledge/document.ts @@ -0,0 +1,420 @@ +import { Result } from '@/request/Result' +import { get, post, del, put, exportExcel, exportFile } from '@/request/index' +import type { Ref } from 'vue' +import type { KeyValue } from '@/api/type/common' +import type { pageRequest } from '@/api/type/common' + +const prefix = '/workspace' + +/** + * 文档分页列表 + * @param 参数 knowledge_id, + * page { + "current_page": "string", + "page_size": "string", + } + * param { + "name": "string", + } + */ + +const getDocument: ( + wordspace_id: string, + knowledge_id: string, + page: pageRequest, + param: any, + loading?: Ref, +) => Promise> = (wordspace_id, knowledge_id, page, param, loading) => { + return get( + `${prefix}/${wordspace_id}/knowledge/${knowledge_id}/document/${page.current_page}/${page.page_size}`, + param, + loading, + ) +} + +/** + * 分段预览(上传文档) + * @param 参数 file:file,limit:number,patterns:array,with_filter:boolean + */ +const postSplitDocument: (data: any) => Promise> = (data) => { + return post(`${prefix}/document/split`, data, undefined, undefined, 1000 * 60 * 60) +} + +/** + * 分段标识列表 + * @param loading 加载器 + * @returns 分段标识列表 + */ +const listSplitPattern: ( + loading?: Ref, +) => Promise>>> = (loading) => { + return get(`${prefix}/document/split_pattern`, {}, loading) +} + +const getAllDocument: (dataset_id: string, loading?: Ref) => Promise> = ( + dataset_id, + loading, +) => { + return get(`${prefix}/${dataset_id}/document`, undefined, loading) +} + +/** + * 创建批量文档 + * @param 参数 + * { + "name": "string", + "paragraphs": [ + { + "content": "string", + "title": "string", + "problem_list": [ + { + "id": "string", + "content": "string" + } + ] + } + ] + } + */ +const postDocument: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return post(`${prefix}/${dataset_id}/document/_bach`, data, {}, loading, 1000 * 60 * 5) +} + +/** + * 修改文档 + * @param 参数 + * dataset_id, document_id, + * { + "name": "string", + "is_active": true, + "meta": {} + } + */ +const putDocument: ( + dataset_id: string, + document_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, document_id, data: any, loading) => { + return put(`${prefix}/${dataset_id}/document/${document_id}`, data, undefined, loading) +} + +/** + * 删除文档 + * @param 参数 dataset_id, document_id, + */ +const delDocument: ( + dataset_id: string, + document_id: string, + loading?: Ref, +) => Promise> = (dataset_id, document_id, loading) => { + return del(`${prefix}/${dataset_id}/document/${document_id}`, loading) +} +/** + * 批量删除文档 + * @param 参数 dataset_id, + */ +const delMulDocument: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return del(`${prefix}/${dataset_id}/document/_bach`, undefined, { id_list: data }, loading) +} + +const batchRefresh: ( + dataset_id: string, + data: any, + stateList: Array, + loading?: Ref, +) => Promise> = (dataset_id, data, stateList, loading) => { + return put( + `${prefix}/${dataset_id}/document/batch_refresh`, + { id_list: data, state_list: stateList }, + undefined, + loading, + ) +} +/** + * 文档详情 + * @param 参数 dataset_id + */ +const getDocumentDetail: (dataset_id: string, document_id: string) => Promise> = ( + dataset_id, + document_id, +) => { + return get(`${prefix}/${dataset_id}/document/${document_id}`) +} + +/** + * 刷新文档向量库 + * @param 参数 + * dataset_id, document_id, + */ +const putDocumentRefresh: ( + dataset_id: string, + document_id: string, + state_list: Array, + loading?: Ref, +) => Promise> = (dataset_id, document_id, state_list, loading) => { + return put( + `${prefix}/${dataset_id}/document/${document_id}/refresh`, + { state_list }, + undefined, + loading, + ) +} + +/** + * 同步web站点类型 + * @param 参数 + * dataset_id, document_id, + */ +const putDocumentSync: ( + dataset_id: string, + document_id: string, + loading?: Ref, +) => Promise> = (dataset_id, document_id, loading) => { + return put(`${prefix}/${dataset_id}/document/${document_id}/sync`, undefined, undefined, loading) +} +const putLarkDocumentSync: ( + dataset_id: string, + document_id: string, + loading?: Ref, +) => Promise> = (dataset_id, document_id, loading) => { + return put( + `${prefix}/lark/${dataset_id}/document/${document_id}/sync`, + undefined, + undefined, + loading, + ) +} + +/** + * 批量同步文档 + * @param 参数 dataset_id, + */ +const delMulSyncDocument: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return put(`${prefix}/${dataset_id}/document/_bach`, { id_list: data }, undefined, loading) +} +const delMulLarkSyncDocument: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return put(`${prefix}/lark/${dataset_id}/_batch`, { id_list: data }, undefined, loading) +} + +/** + * 创建Web站点文档 + * @param 参数 + * { + "source_url_list": [ + "string" + ], + "selector": "string" + } + } + */ +const postWebDocument: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return post(`${prefix}/${dataset_id}/document/web`, data, undefined, loading) +} + +/** + * 导入QA文档 + * @param 参数 + * file + } + */ +const postQADocument: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return post(`${prefix}/${dataset_id}/document/qa`, data, undefined, loading) +} + +/** + * 导入表格 + * @param 参数 + * file + */ +const postTableDocument: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return post(`${prefix}/${dataset_id}/document/table`, data, undefined, loading) +} + +/** + * 批量迁移文档 + * @param 参数 dataset_id,target_dataset_id, + */ +const putMigrateMulDocument: ( + dataset_id: string, + target_dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, target_dataset_id, data, loading) => { + return put( + `${prefix}/${dataset_id}/document/migrate/${target_dataset_id}`, + data, + undefined, + loading, + ) +} + +/** + * 批量修改命中方式 + * @param dataset_id 知识库id + * @param data {id_list:[],hit_handling_method:'directly_return|optimization'} + * @param loading + * @returns + */ +const batchEditHitHandling: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return put(`${prefix}/${dataset_id}/document/batch_hit_handling`, data, undefined, loading) +} + +/** + * 获得QA模版 + * @param 参数 fileName,type, + */ +const exportQATemplate: (fileName: string, type: string, loading?: Ref) => void = ( + fileName, + type, + loading, +) => { + return exportExcel(fileName, `${prefix}/document/template/export`, { type }, loading) +} + +/** + * 获得table模版 + * @param 参数 fileName,type, + */ +const exportTableTemplate: (fileName: string, type: string, loading?: Ref) => void = ( + fileName, + type, + loading, +) => { + return exportExcel(fileName, `${prefix}/document/table_template/export`, { type }, loading) +} + +/** + * 导出文档 + * @param document_name 文档名称 + * @param dataset_id 数据集id + * @param document_id 文档id + * @param loading 加载器 + * @returns + */ +const exportDocument: ( + document_name: string, + dataset_id: string, + document_id: string, + loading?: Ref, +) => Promise = (document_name, dataset_id, document_id, loading) => { + return exportExcel( + document_name + '.xlsx', + `${prefix}/${dataset_id}/document/${document_id}/export`, + {}, + loading, + ) +} +/** + * 导出文档 + * @param document_name 文档名称 + * @param dataset_id 数据集id + * @param document_id 文档id + * @param loading 加载器 + * @returns + */ +const exportDocumentZip: ( + document_name: string, + dataset_id: string, + document_id: string, + loading?: Ref, +) => Promise = (document_name, dataset_id, document_id, loading) => { + return exportFile( + document_name + '.zip', + `${prefix}/${dataset_id}/document/${document_id}/export_zip`, + {}, + loading, + ) +} +const batchGenerateRelated: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return put(`${prefix}/${dataset_id}/document/batch_generate_related`, data, undefined, loading) +} + +const cancelTask: ( + dataset_id: string, + document_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, document_id, data, loading) => { + return put( + `${prefix}/${dataset_id}/document/${document_id}/cancel_task`, + data, + undefined, + loading, + ) +} + +const batchCancelTask: ( + dataset_id: string, + data: any, + loading?: Ref, +) => Promise> = (dataset_id, data, loading) => { + return put(`${prefix}/${dataset_id}/document/cancel_task/_batch`, data, undefined, loading) +} + +export default { + postSplitDocument, + getDocument, + getAllDocument, + postDocument, + putDocument, + delDocument, + delMulDocument, + getDocumentDetail, + listSplitPattern, + putDocumentRefresh, + putDocumentSync, + delMulSyncDocument, + postWebDocument, + putMigrateMulDocument, + batchEditHitHandling, + exportQATemplate, + exportTableTemplate, + postQADocument, + postTableDocument, + exportDocument, + batchRefresh, + batchGenerateRelated, + cancelTask, + exportDocumentZip, + batchCancelTask, + putLarkDocumentSync, + delMulLarkSyncDocument, +} diff --git a/ui/src/api/knowledge/knowledge.ts b/ui/src/api/knowledge/knowledge.ts index 4c62aa32..6f23fa03 100644 --- a/ui/src/api/knowledge/knowledge.ts +++ b/ui/src/api/knowledge/knowledge.ts @@ -21,7 +21,7 @@ const getKnowledgeByFolder: ( } /** - * 知识库列表 + * 知识库分页列表 * @param 参数 * param { "folder_id": "string", @@ -43,7 +43,66 @@ const getKnowledgeList: ( ) } +/** + * 获取全部知识库 + * @param 参数 + */ +// const getAllDataset: (loading?: Ref) => Promise> = (loading) => { +// return get(`${prefix}`, undefined, loading) +// } + +/** + * 同步知识库 + * @param 参数 knowledge_id + * @query 参数 sync_type // 同步类型->replace:替换同步,complete:完整同步 + */ +const putSyncWebKnowledge: ( + wordspace_id: string, + knowledge_id: string, + sync_type: string, + loading?: Ref, +) => Promise> = (wordspace_id, knowledge_id, sync_type, loading) => { + return put( + `${prefix}/${wordspace_id}/knowledge/${knowledge_id}/sync`, + undefined, + { sync_type }, + loading, + ) +} + +/** + * 向量化知识库 + * @param 参数 knowledge_id + */ +const putReEmbeddingDataset: ( + wordspace_id: string, + knowledge_id: string, + loading?: Ref, +) => Promise> = (wordspace_id, knowledge_id, loading) => { + return put( + `${prefix}/${wordspace_id}/knowledge/${knowledge_id}/embedding`, + undefined, + undefined, + loading, + ) +} + +/** + * 知识库详情 + * @param 参数 knowledge_id + */ +const getKnowledgeDetail: ( + wordspace_id: string, + knowledge_id: string, + loading?: Ref, +) => Promise> = (wordspace_id, knowledge_id, loading) => { + return get(`${prefix}/${wordspace_id}/knowledge/${knowledge_id}`, undefined, loading) +} + export default { getKnowledgeByFolder, getKnowledgeList, + putReEmbeddingDataset, + putSyncWebKnowledge, + getKnowledgeDetail, } diff --git a/ui/src/api/type/knowledge.ts b/ui/src/api/type/knowledge.ts new file mode 100644 index 00000000..8ba67fe8 --- /dev/null +++ b/ui/src/api/type/knowledge.ts @@ -0,0 +1,9 @@ +interface knowledgeData { + name: String + desc: String + documents?: Array + type?: String + embedding_mode_id?: String +} + +export type { knowledgeData } diff --git a/ui/src/components/app-icon/icons/document.ts b/ui/src/components/app-icon/icons/document.ts new file mode 100644 index 00000000..faf47e91 --- /dev/null +++ b/ui/src/components/app-icon/icons/document.ts @@ -0,0 +1,55 @@ +import { h } from 'vue' +export default { + 'app-document': { + iconReader: () => { + return h('i', [ + h( + 'svg', + { + viewBox: '0 0 20 20', + version: '1.1', + xmlns: 'http://www.w3.org/2000/svg', + }, + [ + h('path', { + d: 'M13.3333 2.50016H4.16667V17.5002H15.8333V5.01641H13.75C13.6395 5.01641 13.5335 4.97251 13.4554 4.89437C13.3772 4.81623 13.3333 4.71025 13.3333 4.59975V2.50016ZM3.33333 0.833496H14.2379C14.3474 0.833465 14.4558 0.855013 14.557 0.896908C14.6582 0.938804 14.7501 1.00023 14.8275 1.07766L17.2563 3.50725C17.4124 3.66356 17.5001 3.87548 17.5 4.09641V18.3335C17.5 18.5545 17.4122 18.7665 17.2559 18.9228C17.0996 19.079 16.8877 19.1668 16.6667 19.1668H3.33333C3.11232 19.1668 2.90036 19.079 2.74408 18.9228C2.5878 18.7665 2.5 18.5545 2.5 18.3335V1.66683C2.5 1.44582 2.5878 1.23385 2.74408 1.07757C2.90036 0.921293 3.11232 0.833496 3.33333 0.833496ZM6.66667 8.3335H13.3333C13.4438 8.3335 13.5498 8.3774 13.628 8.45554C13.7061 8.53368 13.75 8.63966 13.75 8.75016V9.5835C13.75 9.694 13.7061 9.79998 13.628 9.87812C13.5498 9.95626 13.4438 10.0002 13.3333 10.0002H6.66667C6.55616 10.0002 6.45018 9.95626 6.37204 9.87812C6.2939 9.79998 6.25 9.694 6.25 9.5835V8.75016C6.25 8.63966 6.2939 8.53368 6.37204 8.45554C6.45018 8.3774 6.55616 8.3335 6.66667 8.3335ZM6.66667 12.5002H10.4167C10.4714 12.5002 10.5256 12.5109 10.5761 12.5319C10.6267 12.5528 10.6726 12.5835 10.7113 12.6222C10.75 12.6609 10.7807 12.7068 10.8016 12.7574C10.8226 12.8079 10.8333 12.8621 10.8333 12.9168V13.7502C10.8333 13.8049 10.8226 13.8591 10.8016 13.9096C10.7807 13.9602 10.75 14.0061 10.7113 14.0448C10.6726 14.0835 10.6267 14.1142 10.5761 14.1351C10.5256 14.1561 10.4714 14.1668 10.4167 14.1668H6.66667C6.55616 14.1668 6.45018 14.1229 6.37204 14.0448C6.2939 13.9667 6.25 13.8607 6.25 13.7502V12.9168C6.25 12.8063 6.2939 12.7003 6.37204 12.6222C6.45018 12.5441 6.55616 12.5002 6.66667 12.5002Z', + fill: 'currentColor', + }), + ], + ), + ]) + }, + }, + 'app-document-active': { + iconReader: () => { + return h('i', [ + h( + 'svg', + { + viewBox: '0 0 20 20', + version: '1.1', + xmlns: 'http://www.w3.org/2000/svg', + }, + [ + h('path', { + d: 'M3.3335 2.08333C3.3335 1.6231 3.70659 1.25 4.16683 1.25H12.3842C12.4959 1.25 12.603 1.29489 12.6813 1.37459L16.5473 5.30784C16.6239 5.38576 16.6668 5.49065 16.6668 5.59992V17.9167C16.6668 18.3769 16.2937 18.75 15.8335 18.75H4.16683C3.70659 18.75 3.3335 18.3769 3.3335 17.9167V2.08333Z', + fill: 'currentColor', + }), + h('path', { + d: 'M12.5 1.2666C12.568 1.28633 12.6306 1.32327 12.6812 1.37472L16.5472 5.30797C16.5788 5.34017 16.6047 5.37698 16.6242 5.4168H13.4459C12.9235 5.4168 12.5 4.99328 12.5 4.47085V1.2666Z', + fill: '#2B5FD9', + }), + h('path', { + d: 'M6.71305 7.72705C6.48293 7.72705 6.29639 7.9136 6.29639 8.14372V8.82554C6.29639 9.05565 6.48294 9.2422 6.71305 9.2422H13.2871C13.5172 9.2422 13.7038 9.05565 13.7038 8.82554V8.14372C13.7038 7.9136 13.5172 7.72705 13.2871 7.72705H6.71305Z', + fill: 'white', + }), + h('path', { + d: 'M6.71305 11.5149C6.48293 11.5149 6.29639 11.7015 6.29639 11.9316V12.6134C6.29639 12.8435 6.48294 13.0301 6.71305 13.0301H9.58342C9.81354 13.0301 10.0001 12.8435 10.0001 12.6134V11.9316C10.0001 11.7015 9.81354 11.5149 9.58342 11.5149H6.71305Z', + fill: 'white', + }), + ], + ), + ]) + }, + }, +} diff --git a/ui/src/components/app-icon/icons/knowledge.ts b/ui/src/components/app-icon/icons/knowledge.ts new file mode 100644 index 00000000..6f0ac81b --- /dev/null +++ b/ui/src/components/app-icon/icons/knowledge.ts @@ -0,0 +1,57 @@ +import { h } from 'vue' +export default { + 'app-vectorization': { + iconReader: () => { + return h('i', [ + h( + 'svg', + { + style: { height: '100%', width: '100%' }, + viewBox: '0 0 1024 1024', + version: '1.1', + xmlns: 'http://www.w3.org/2000/svg', + }, + [ + h('path', { + d: 'M512 170.666667a85.333333 85.333333 0 0 1 85.333333-85.333334h256a85.333333 85.333333 0 0 1 85.333334 85.333334v256a85.333333 85.333333 0 0 1-85.333334 85.333333h-256a85.333333 85.333333 0 0 1-85.333333-85.333333V170.666667z m85.333333 0v256h256V170.666667h-256zM85.333333 597.333333a85.333333 85.333333 0 0 1 85.333334-85.333333h256a85.333333 85.333333 0 0 1 85.333333 85.333333v256a85.333333 85.333333 0 0 1-85.333333 85.333334H170.666667a85.333333 85.333333 0 0 1-85.333334-85.333334v-256z m85.333334 0v256h256v-256H170.666667zM128 298.666667a213.333333 213.333333 0 0 1 213.333333-213.333334h85.333334v85.333334H341.333333a128 128 0 0 0-128 128h57.514667a12.8 12.8 0 0 1 9.728 21.12l-100.181333 116.906666a12.8 12.8 0 0 1-19.456 0l-100.181334-116.906666A12.8 12.8 0 0 1 70.485333 298.666667H128zM896 725.333333a213.333333 213.333333 0 0 1-213.333333 213.333334h-85.333334v-85.333334h85.333334a128 128 0 0 0 128-128v-21.333333h-57.514667a12.8 12.8 0 0 1-9.728-21.12l100.181333-116.906667a12.8 12.8 0 0 1 19.456 0l100.181334 116.906667a12.8 12.8 0 0 1-9.728 21.12H896v21.333333z', + fill: 'currentColor', + }), + ], + ), + ]) + }, + }, + 'app-all-menu-active': { + iconReader: () => { + return h('i', [ + h( + 'svg', + { + style: { height: '100%', width: '100%' }, + viewBox: '0 0 20 20', + version: '1.1', + xmlns: 'http://www.w3.org/2000/svg', + }, + [ + h('path', { + d: 'M8.33317 1.6665H2.49984C2.0396 1.6665 1.6665 2.0396 1.6665 2.49984V8.33317C1.6665 8.79341 2.0396 9.1665 2.49984 9.1665H8.33317C8.79341 9.1665 9.1665 8.79341 9.1665 8.33317V2.49984C9.1665 2.0396 8.79341 1.6665 8.33317 1.6665Z', + fill: 'currentColor', + }), + h('path', { + d: 'M8.33317 10.8332H2.49984C2.0396 10.8332 1.6665 11.2063 1.6665 11.6665V17.4998C1.6665 17.9601 2.0396 18.3332 2.49984 18.3332H8.33317C8.79341 18.3332 9.1665 17.9601 9.1665 17.4998V11.6665C9.1665 11.2063 8.79341 10.8332 8.33317 10.8332Z', + fill: 'currentColor', + }), + h('path', { + d: 'M17.4998 1.6665H11.6665C11.2063 1.6665 10.8332 2.0396 10.8332 2.49984V8.33317C10.8332 8.79341 11.2063 9.1665 11.6665 9.1665H17.4998C17.9601 9.1665 18.3332 8.79341 18.3332 8.33317V2.49984C18.3332 2.0396 17.9601 1.6665 17.4998 1.6665Z', + fill: 'currentColor', + }), + h('path', { + d: 'M17.4508 10.8332H11.7155C11.2282 10.8332 10.8332 11.2282 10.8332 11.7155V17.4508C10.8332 17.9381 11.2282 18.3332 11.7155 18.3332H17.4508C17.9381 18.3332 18.3332 17.9381 18.3332 17.4508V11.7155C18.3332 11.2282 17.9381 10.8332 17.4508 10.8332Z', + fill: 'currentColor', + }), + ], + ), + ]) + }, + }, +} diff --git a/ui/src/components/app-table/index.vue b/ui/src/components/app-table/index.vue new file mode 100644 index 00000000..8da86977 --- /dev/null +++ b/ui/src/components/app-table/index.vue @@ -0,0 +1,159 @@ + + + + diff --git a/ui/src/components/back-button/index.vue b/ui/src/components/back-button/index.vue new file mode 100644 index 00000000..0a0ea69b --- /dev/null +++ b/ui/src/components/back-button/index.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts index ce051f76..83abdbd2 100644 --- a/ui/src/components/index.ts +++ b/ui/src/components/index.ts @@ -9,6 +9,8 @@ import ContentContainer from './layout-container/ContentContainer.vue' import CardBox from './card-box/index.vue' import FolderTree from './folder-tree/index.vue' import CommonList from './common-list/index.vue' +import BackButton from './back-button/index.vue' +import AppTable from './app-table/index.vue' export default { install(app: App) { app.component('LogoFull', LogoFull) @@ -21,5 +23,7 @@ export default { app.component('CardBox', CardBox) app.component('FolderTree', FolderTree) app.component('CommonList', CommonList) + app.component('BackButton', BackButton) + app.component('AppTable', AppTable) }, } diff --git a/ui/src/enums/common.ts b/ui/src/enums/common.ts new file mode 100644 index 00000000..3afd8fc2 --- /dev/null +++ b/ui/src/enums/common.ts @@ -0,0 +1,16 @@ +export enum DeviceType { + Mobile = 'Mobile', + Desktop = 'Desktop' +} + +export enum ValidType { + Application = 'application', + Dataset = 'dataset', + User = 'user' +} + +export enum ValidCount { + Application = 5, + Dataset = 50, + User = 2 +} diff --git a/ui/src/layout/components/breadcrumb/index.vue b/ui/src/layout/components/breadcrumb/index.vue index 2cd02519..ea3638d9 100644 --- a/ui/src/layout/components/breadcrumb/index.vue +++ b/ui/src/layout/components/breadcrumb/index.vue @@ -10,7 +10,7 @@ > diff --git a/ui/src/locales/lang/en-US/common.ts b/ui/src/locales/lang/en-US/common.ts index 46e2b71d..916ea114 100644 --- a/ui/src/locales/lang/en-US/common.ts +++ b/ui/src/locales/lang/en-US/common.ts @@ -34,12 +34,16 @@ export default { public: 'Public', private: 'Private', paramSetting: 'Parameter Settings', + name: 'Name', creator: 'Creator', author: 'Author', debug: 'Debug', required: 'Required', noData: 'No data', result: 'Result', + searchBar: { + placeholder: 'Search by name', + }, fileUpload: { document: 'Documents', image: 'Image', diff --git a/ui/src/locales/lang/en-US/views/model.ts b/ui/src/locales/lang/en-US/views/model.ts index c61d06c7..2c8a648e 100644 --- a/ui/src/locales/lang/en-US/views/model.ts +++ b/ui/src/locales/lang/en-US/views/model.ts @@ -3,9 +3,7 @@ export default { provider: 'Provider', providerPlaceholder: 'Select Provider', addModel: 'Add Model', - searchBar: { - placeholder: 'Search by name', - }, + delete: { confirmTitle: 'Delete Model', confirmMessage: 'Are you sure you want to delete the model:', diff --git a/ui/src/locales/lang/zh-CN/common.ts b/ui/src/locales/lang/zh-CN/common.ts index c5512a0e..439cc8e3 100644 --- a/ui/src/locales/lang/zh-CN/common.ts +++ b/ui/src/locales/lang/zh-CN/common.ts @@ -35,12 +35,16 @@ export default { public: '公有', private: '私有', paramSetting: '参数设置', + name: '名称', creator: '创建者', author: '作者', debug: '调试', required: '必填', noData: '暂无数据', result: '结果', + searchBar: { + placeholder: '按名称搜索', + }, fileUpload: { document: '文档', image: '图片', diff --git a/ui/src/locales/lang/zh-CN/views/document.ts b/ui/src/locales/lang/zh-CN/views/document.ts new file mode 100644 index 00000000..bfdf2907 --- /dev/null +++ b/ui/src/locales/lang/zh-CN/views/document.ts @@ -0,0 +1,176 @@ +export default { + uploadDocument: '上传文档', + importDocument: '导入文档', + syncDocument: '同步文档', + selected: '已选', + items: '项', + searchBar: { + placeholder: '按 文档名称 搜索' + }, + setting: { + migration: '迁移', + cancelGenerateQuestion: '取消生成问题', + cancelVectorization: '取消向量化', + cancelGenerate: '取消生成', + export: '导出' + }, + tip: { + saveMessage: '当前的更改尚未保存,确认退出吗?', + cancelSuccess: '批量取消成功', + sendMessage: '发送成功', + vectorizationSuccess: '批量向量化成功', + nameMessage: '文件名称不能为空!', + importMessage: '导入成功', + migrationSuccess: '迁移成功' + }, + upload: { + selectFile: '选择文件', + selectFiles: '选择文件夹', + uploadMessage: '拖拽文件至此上传或', + formats: '支持格式:', + requiredMessage: '请上传文件', + errorMessage1: '文件大小超过 100MB', + errorMessage2: '文件格式不支持', + errorMessage3: '文件不能为空', + errorMessage4: '每次最多上传50个文件', + template: '模版', + download: '下载' + }, + + fileType: { + txt: { + label: '文本文件', + tip1: '1、文件上传前,建议规范文件的分段标识', + tip2: '2、每次最多上传 50 个文件,每个文件不超过 100MB' + }, + table: { + label: '表格', + tip1: '1、点击下载对应模版并完善信息:', + tip2: '2、第一行必须是列标题,且列标题必须是有意义的术语,表中每条记录将作为一个分段', + tip3: '3、上传的表格文件中每个 sheet 会作为一个文档,sheet名称为文档名称', + tip4: '4、每次最多上传 50 个文件,每个文件不超过 100MB' + }, + QA: { + label: 'QA 问答对', + tip1: '1、点击下载对应模版并完善信息', + tip2: '2、上传的表格文件中每个 sheet 会作为一个文档,sheet名称为文档名称', + tip3: '3、每次最多上传 50 个文件,每个文件不超过 100MB' + }, + lark: {} + }, + setRules: { + title: { + setting: '设置分段规则', + preview: '分段预览' + }, + intelligent: { + label: '智能分段(推荐)', + text: '不了解如何设置分段规则推荐使用智能分段' + }, + advanced: { + label: '高级分段', + text: '用户可根据文档规范自行设置分段标识符、分段长度以及清洗规则' + }, + patterns: { + label: '分段标识', + tooltip: '按照所选符号先后顺序做递归分割,分割结果超出分段长度将截取至分段长度。', + placeholder: '请选择' + }, + limit: { + label: '分段长度' + }, + with_filter: { + label: '自动清洗', + text: '去掉重复多余符号空格、空行、制表符' + }, + checkedConnect: { + label: '导入时添加分段标题为关联问题(适用于标题为问题的问答对)' + } + }, + buttons: { + prev: '上一步', + next: '下一步', + import: '开始导入', + preview: '生成预览' + }, + table: { + name: '文件名称', + char_length: '字符数', + paragraph: '分段', + all: '全部', + updateTime: '更新时间' + }, + fileStatus: { + label: '文件状态', + SUCCESS: '成功', + FAILURE: '失败', + EMBEDDING: '索引中', + PENDING: '排队中', + GENERATE: '生成中', + SYNC: '同步中', + REVOKE: '取消中', + finish: '完成' + }, + enableStatus: { + label: '启用状态', + enable: '开启', + close: '关闭' + }, + sync: { + label: '同步', + confirmTitle: '确认同步文档?', + confirmMessage1: '同步将删除已有数据重新获取新数据,请谨慎操作。', + confirmMessage2: '无法同步,请先去设置文档 URL地址', + successMessage: '同步文档成功' + }, + delete: { + confirmTitle1: '是否批量删除', + confirmTitle2: '个文档?', + confirmMessage: '所选文档中的分段会跟随删除,请谨慎操作。', + successMessage: '批量删除成功', + confirmTitle3: '是否删除文档:', + confirmMessage1: '此文档下的', + confirmMessage2: '个分段都会被删除,请谨慎操作。' + }, + form: { + source_url: { + label: '文档地址', + placeholder: '请输入文档地址,一行一个,地址不正确文档会导入失败。', + requiredMessage: '请输入文档地址' + }, + selector: { + label: '选择器', + placeholder: '默认为 body,可输入 .classname/#idname/tagname' + }, + hit_handling_method: { + label: '命中处理方式', + tooltip: '用户提问时,命中文档下的分段时按照设置的方式进行处理。' + }, + similarity: { + label: '相似度高于', + placeholder: '直接返回分段内容', + requiredMessage: '请输入相似度' + } + }, + hitHandlingMethod: { + optimization: '模型优化', + directly_return: '直接回答' + }, + generateQuestion: { + title: '生成问题', + successMessage: '生成问题成功', + tip1: '提示词中的 {data} 为分段内容的占位符,执行时替换为分段内容发送给 AI 模型;', + tip2: 'AI 模型根据分段内容生成相关问题,请将生成的问题放至', + tip3: '标签中,系统会自动关联标签中的问题;', + tip4: '生成效果依赖于所选模型和提示词,用户可自行调整至最佳效果。', + prompt1: `内容:{data}\n\n请总结上面的内容,并根据内容总结生成 5 个问题。\n回答要求:\n- 请只输出问题;\n- 请将每个问题放置`, + prompt2: `标签中。` + }, + feishu: { + selectDocument: '选择文档', + tip1: '支持文档和表格类型,包含TXT、Markdown、PDF、DOCX、HTML、XLS、XLSX、CSV、ZIP格式;', + tip2: '系统不存储原始文档,导入文档前,建议规范文档的分段标识。', + allCheck: '全选', + errorMessage1: '请选择文档' + } +} diff --git a/ui/src/locales/lang/zh-CN/views/index.ts b/ui/src/locales/lang/zh-CN/views/index.ts index a8f343b8..3c816e14 100644 --- a/ui/src/locales/lang/zh-CN/views/index.ts +++ b/ui/src/locales/lang/zh-CN/views/index.ts @@ -2,6 +2,7 @@ import login from './login' import model from './model' import knowledge from './knowledge' import tool from './tool' +import document from './document' // import notFound from './404' // import application from './application' // import applicationOverview from './application-overview' @@ -10,7 +11,6 @@ import tool from './tool' // import user from './user' // import team from './team' -// import document from './document' // import paragraph from './paragraph' // import problem from './problem' // import log from './log' @@ -22,13 +22,13 @@ export default { model, knowledge, tool, + document, // notFound, // application, // applicationOverview, // system, // user, // team, - // document, // paragraph, // problem, // log, diff --git a/ui/src/locales/lang/zh-CN/views/knowledge.ts b/ui/src/locales/lang/zh-CN/views/knowledge.ts index 80ca8af6..54e64004 100644 --- a/ui/src/locales/lang/zh-CN/views/knowledge.ts +++ b/ui/src/locales/lang/zh-CN/views/knowledge.ts @@ -2,4 +2,8 @@ export default { title: '知识库', document_count: '文档数', relatedApp_count: '关联应用', + setting: { + vectorization: '向量化', + sync: '同步', + }, } diff --git a/ui/src/locales/lang/zh-CN/views/model.ts b/ui/src/locales/lang/zh-CN/views/model.ts index 11763961..0c137571 100644 --- a/ui/src/locales/lang/zh-CN/views/model.ts +++ b/ui/src/locales/lang/zh-CN/views/model.ts @@ -3,9 +3,6 @@ export default { provider: '供应商', providerPlaceholder: '选择供应商', addModel: '添加模型', - searchBar: { - placeholder: '按名称搜索', - }, delete: { confirmTitle: '删除模型', confirmMessage: '是否删除模型:', diff --git a/ui/src/locales/lang/zh-Hant/common.ts b/ui/src/locales/lang/zh-Hant/common.ts index 511b7d63..0e79520f 100644 --- a/ui/src/locales/lang/zh-Hant/common.ts +++ b/ui/src/locales/lang/zh-Hant/common.ts @@ -34,12 +34,16 @@ export default { public: '公有', private: '私有', paramSetting: '參數設定', + name: '名稱', creator: '建立者', author: '作者', debug: '調試', required: '必填', noData: '暂无数据', result: '結果', + searchBar: { + placeholder: '按名稱搜尋', + }, fileUpload: { document: '文檔', image: '圖片', @@ -73,6 +77,6 @@ export default { custom: '自訂', sizeTip: '建議尺寸 32*32,支援 JPG、PNG、GIF,大小不超過 10 MB', fileSizeExceeded: '檔案大小超過 10 MB', - uploadImagePrompt: '請上傳一張圖片' + uploadImagePrompt: '請上傳一張圖片', }, } diff --git a/ui/src/locales/lang/zh-Hant/views/model.ts b/ui/src/locales/lang/zh-Hant/views/model.ts index f682db8c..8c379409 100644 --- a/ui/src/locales/lang/zh-Hant/views/model.ts +++ b/ui/src/locales/lang/zh-Hant/views/model.ts @@ -3,9 +3,6 @@ export default { provider: '供應商', providerPlaceholder: '選擇供應商', addModel: '新增模型', - searchBar: { - placeholder: '按名稱搜尋', - }, delete: { confirmTitle: '刪除模型', confirmMessage: '是否刪除模型:', diff --git a/ui/src/router/modules/2knowledge.ts b/ui/src/router/modules/2knowledge.ts index a1caf7f8..88289d3b 100644 --- a/ui/src/router/modules/2knowledge.ts +++ b/ui/src/router/modules/2knowledge.ts @@ -9,9 +9,9 @@ const ModelRouter = { path: '/knowledge', name: 'knowledge-index', meta: { title: '知识库主页', activeMenu: '/knowledge' }, - component: () => import('@/views/knowledge/index.vue') - } - ] + component: () => import('@/views/knowledge/index.vue'), + }, + ], } export default ModelRouter diff --git a/ui/src/router/modules/document.ts b/ui/src/router/modules/document.ts new file mode 100644 index 00000000..4cf81344 --- /dev/null +++ b/ui/src/router/modules/document.ts @@ -0,0 +1,62 @@ +const ModelRouter = { + path: '/knowledge/:id', + name: 'DatasetDetail', + meta: { title: 'common.fileUpload.document', activeMenu: '/knowledge', breadcrumb: true }, + component: () => import('@/layout/layout-template/MainLayout.vue'), + hidden: true, + children: [ + { + path: 'document', + name: 'Document', + meta: { + icon: 'app-document', + iconActive: 'app-document-active', + title: 'common.fileUpload.document', + active: 'document', + parentPath: '/knowledge/:id', + parentName: 'DatasetDetail', + }, + component: () => import('@/views/document/index.vue'), + }, + // { + // path: 'problem', + // name: 'Problem', + // meta: { + // icon: 'app-problems', + // iconActive: 'QuestionFilled', + // title: 'views.problem.title', + // active: 'problem', + // parentPath: '/dataset/:id', + // parentName: 'DatasetDetail' + // }, + // component: () => import('@/views/problem/index.vue') + // }, + // { + // path: 'hit-test', + // name: 'DatasetHitTest', + // meta: { + // icon: 'app-hit-test', + // title: 'views.application.hitTest.title', + // active: 'hit-test', + // parentPath: '/dataset/:id', + // parentName: 'DatasetDetail' + // }, + // component: () => import('@/views/hit-test/index.vue') + // }, + // { + // path: 'setting', + // name: 'DatasetSetting', + // meta: { + // icon: 'app-setting', + // iconActive: 'app-setting-active', + // title: 'common.setting', + // active: 'setting', + // parentPath: '/dataset/:id', + // parentName: 'DatasetDetail' + // }, + // component: () => import('@/views/dataset/DatasetSetting.vue') + // } + ], +} + +export default ModelRouter diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts index dedec972..e395f288 100644 --- a/ui/src/router/routes.ts +++ b/ui/src/router/routes.ts @@ -6,7 +6,7 @@ export const routes: Array = [ { path: '/', name: 'home', - redirect: '/model', + redirect: '/knowledge', children: [...rolesRoutes], }, diff --git a/ui/src/stores/index.ts b/ui/src/stores/index.ts index 676ef020..f8f3ce62 100644 --- a/ui/src/stores/index.ts +++ b/ui/src/stores/index.ts @@ -1,13 +1,17 @@ +import useCommonStore from './modules/common' import useLoginStore from './modules/login' import useUserStore from './modules/user' import useFolderStore from './modules/folder' import useThemeStore from './modules/theme' +import useKnowledgeStore from './modules/knowledge' const useStore = () => ({ + common: useCommonStore(), login: useLoginStore(), user: useUserStore(), folder: useFolderStore(), theme: useThemeStore(), + knowledge: useKnowledgeStore(), }) export default useStore diff --git a/ui/src/stores/modules/common.ts b/ui/src/stores/modules/common.ts new file mode 100644 index 00000000..92946014 --- /dev/null +++ b/ui/src/stores/modules/common.ts @@ -0,0 +1,52 @@ +import { defineStore } from 'pinia' +import { DeviceType, ValidType } from '@/enums/common' +// import type { Ref } from 'vue' +// import userApi from '@/api/user' + +export interface commonTypes { + breadcrumb: any + paginationConfig: any | null + search: any + device: string +} + +const useCommonStore = defineStore('common',{ + state: (): commonTypes => ({ + breadcrumb: null, + // 搜索和分页缓存 + paginationConfig: {}, + search: {}, + device: DeviceType.Desktop + }), + actions: { + saveBreadcrumb(data: any) { + this.breadcrumb = data + }, + savePage(val: string, data: any) { + this.paginationConfig[val] = data + }, + saveCondition(val: string, data: any) { + this.search[val] = data + }, + toggleDevice(value: DeviceType) { + this.device = value + }, + isMobile() { + return this.device === DeviceType.Mobile + }, + // async asyncGetValid(valid_type: ValidType, valid_count: number, loading?: Ref) { + // return new Promise((resolve, reject) => { + // userApi + // .getValid(valid_type, valid_count, loading) + // .then((data) => { + // resolve(data) + // }) + // .catch((error) => { + // reject(error) + // }) + // }) + // } + } +}) + +export default useCommonStore diff --git a/ui/src/stores/modules/knowledge.ts b/ui/src/stores/modules/knowledge.ts new file mode 100644 index 00000000..5946fcda --- /dev/null +++ b/ui/src/stores/modules/knowledge.ts @@ -0,0 +1,77 @@ +import { defineStore } from 'pinia' +import type { knowledgeData } from '@/api/type/knowledge' +import type { UploadUserFile } from 'element-plus' +import knowledgeApi from '@/api/knowledge/knowledge' +import { type Ref } from 'vue' + +export interface knowledgeStateTypes { + baseInfo: knowledgeData | null + webInfo: any + documentsType: string + documentsFiles: UploadUserFile[] +} + +const useKnowledgeStore = defineStore('knowledge', { + state: (): knowledgeStateTypes => ({ + baseInfo: null, + webInfo: null, + documentsType: '', + documentsFiles: [], + }), + actions: { + saveBaseInfo(info: knowledgeData | null) { + this.baseInfo = info + }, + saveWebInfo(info: any) { + this.webInfo = info + }, + saveDocumentsType(val: string) { + this.documentsType = val + }, + saveDocumentsFile(file: UploadUserFile[]) { + this.documentsFiles = file + }, + // async asyncGetAllDataset(loading?: Ref) { + // return new Promise((resolve, reject) => { + // knowledgeApi + // .getAllDataset(loading) + // .then((data) => { + // resolve(data) + // }) + // .catch((error) => { + // reject(error) + // }) + // }) + // }, + async asyncGetDatasetDetail( + workspace_id: string, + knowledge_id: string, + loading?: Ref, + ) { + return new Promise((resolve, reject) => { + knowledgeApi + .getKnowledgeDetail(workspace_id, knowledge_id, loading) + .then((data) => { + resolve(data) + }) + .catch((error) => { + reject(error) + }) + }) + }, + async asyncSyncDataset(id: string, sync_type: string, loading?: Ref) { + return new Promise((resolve, reject) => { + knowledgeApi + .putSyncWebKnowledge(id, sync_type, loading) + .then((data) => { + resolve(data) + }) + .catch((error) => { + reject(error) + }) + }) + }, + }, +}) + +export default useKnowledgeStore diff --git a/ui/src/styles/app.scss b/ui/src/styles/app.scss index 5b7fdd00..012aaca6 100644 --- a/ui/src/styles/app.scss +++ b/ui/src/styles/app.scss @@ -1,4 +1,3 @@ -$primary-color: #3370ff; @font-face { font-family: AlibabaPuHuiTi; src: @@ -374,9 +373,6 @@ h5 { } // 颜色 -.color-primary-1 { - background: rgba($primary-color, 0.1); -} .color-primary { color: var(--el-color-primary); } diff --git a/ui/src/styles/component.scss b/ui/src/styles/component.scss index 5615524b..ad7b19dd 100644 --- a/ui/src/styles/component.scss +++ b/ui/src/styles/component.scss @@ -55,3 +55,32 @@ line-height: 30px; } } + + +/* + 表格第一行插入自定义行 +*/ +.table-quick-append { + background: #ffffff; + .el-table__append-wrapper { + position: absolute; + top: 0; + border-bottom: var(--el-table-border); + width: 100%; + height: 49px; + box-sizing: border-box; + align-items: center; + display: flex; + padding: 0 12px; + background: #ffffff; + cursor: pointer; + z-index: 2; + &:hover { + background: var(--el-color-primary-light-9); + z-index: 1; + } + } + .el-table__body { + margin-top: 49px; + } +} diff --git a/ui/src/styles/element-plus.scss b/ui/src/styles/element-plus.scss index ac2047f9..4c58569e 100644 --- a/ui/src/styles/element-plus.scss +++ b/ui/src/styles/element-plus.scss @@ -1,10 +1,9 @@ -$primary-color: #3370ff; :root { --el-color-primary: #3370ff; --el-color-success: #34c724; --el-text-color-primary: #1f2329; --el-border-radius-base: 6px; - // --el-menu-item-height: 45px; + --el-menu-item-height: 45px; // --el-box-shadow-light: 0px 2px 4px 0px rgba(31, 35, 41, 0.12); // --el-border-color: #dee0e3; // --el-color-info: #8f959e !important; @@ -36,7 +35,7 @@ $primary-color: #3370ff; } } .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content { - background: rgba($primary-color, 0.1); + background: var(--el-color-primary-light-9); color: var(--el-color-primary); } .el-tree-node__expand-icon { diff --git a/ui/src/styles/variables.scss b/ui/src/styles/variables.scss index 181e5870..a653904d 100644 --- a/ui/src/styles/variables.scss +++ b/ui/src/styles/variables.scss @@ -1,3 +1,4 @@ +$primary-color: #3370ff; :root { --app-base-px: 8px; --app-layout-bg-color: #f5f6f7; diff --git a/ui/src/utils/status.ts b/ui/src/utils/status.ts new file mode 100644 index 00000000..16f98599 --- /dev/null +++ b/ui/src/utils/status.ts @@ -0,0 +1,68 @@ +import { type Dict } from '@/api/type/common' +interface TaskTypeInterface { + // 向量化 + EMBEDDING: number + // 生成问题 + GENERATE_PROBLEM: number + // 同步 + SYNC: number +} +interface StateInterface { + // 等待 + PENDING: '0' + // 执行中 + STARTED: '1' + // 成功 + SUCCESS: '2' + // 失败 + FAILURE: '3' + // 取消任务 + REVOKE: '4' + // 取消成功 + REVOKED: '5' + IGNORED: 'n' +} +const TaskType: TaskTypeInterface = { + EMBEDDING: 1, + GENERATE_PROBLEM: 2, + SYNC: 3 +} +const State: StateInterface = { + // 等待 + PENDING: '0', + // 执行中 + STARTED: '1', + // 成功 + SUCCESS: '2', + // 失败 + FAILURE: '3', + // 取消任务 + REVOKE: '4', + // 取消成功 + REVOKED: '5', + IGNORED: 'n' +} +class Status { + task_status: Dict + constructor(status?: string) { + if (!status) { + status = '' + } + status = status.split('').reverse().join('') + this.task_status = {} + for (let key in TaskType) { + const value = TaskType[key as keyof TaskTypeInterface] + const index = value - 1 + this.task_status[value] = status[index] ? status[index] : 'n' + } + } + toString() { + const r = [] + for (let key in TaskType) { + const value = TaskType[key as keyof TaskTypeInterface] + r.push(this.task_status[value]) + } + return r.reverse().join('') + } +} +export { Status, State, TaskType, type TaskTypeInterface, type StateInterface } diff --git a/ui/src/views/document/component/EmbeddingContentDialog.vue b/ui/src/views/document/component/EmbeddingContentDialog.vue new file mode 100644 index 00000000..1aa740d6 --- /dev/null +++ b/ui/src/views/document/component/EmbeddingContentDialog.vue @@ -0,0 +1,48 @@ + + + diff --git a/ui/src/views/document/component/ImportDocumentDialog.vue b/ui/src/views/document/component/ImportDocumentDialog.vue new file mode 100644 index 00000000..34443e96 --- /dev/null +++ b/ui/src/views/document/component/ImportDocumentDialog.vue @@ -0,0 +1,233 @@ + + + diff --git a/ui/src/views/document/component/SelectDatasetDialog.vue b/ui/src/views/document/component/SelectDatasetDialog.vue new file mode 100644 index 00000000..91bd73b9 --- /dev/null +++ b/ui/src/views/document/component/SelectDatasetDialog.vue @@ -0,0 +1,142 @@ + + + diff --git a/ui/src/views/document/component/Status.vue b/ui/src/views/document/component/Status.vue new file mode 100644 index 00000000..055fcaed --- /dev/null +++ b/ui/src/views/document/component/Status.vue @@ -0,0 +1,87 @@ + + + diff --git a/ui/src/views/document/component/StatusTable.vue b/ui/src/views/document/component/StatusTable.vue new file mode 100644 index 00000000..02c7b909 --- /dev/null +++ b/ui/src/views/document/component/StatusTable.vue @@ -0,0 +1,109 @@ + + + diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue new file mode 100644 index 00000000..e4215d2f --- /dev/null +++ b/ui/src/views/document/index.vue @@ -0,0 +1,953 @@ + + + diff --git a/ui/src/views/knowledge/component/BaseForm.vue b/ui/src/views/knowledge/component/BaseForm.vue new file mode 100644 index 00000000..129c9045 --- /dev/null +++ b/ui/src/views/knowledge/component/BaseForm.vue @@ -0,0 +1,147 @@ + + + diff --git a/ui/src/views/knowledge/component/CreateDatasetDialog.vue b/ui/src/views/knowledge/component/CreateDatasetDialog.vue new file mode 100644 index 00000000..2d9eaa06 --- /dev/null +++ b/ui/src/views/knowledge/component/CreateDatasetDialog.vue @@ -0,0 +1,329 @@ + + + diff --git a/ui/src/views/knowledge/component/EditParagraphDialog.vue b/ui/src/views/knowledge/component/EditParagraphDialog.vue new file mode 100644 index 00000000..9fffaddc --- /dev/null +++ b/ui/src/views/knowledge/component/EditParagraphDialog.vue @@ -0,0 +1,135 @@ + + + diff --git a/ui/src/views/knowledge/component/ParagraphList.vue b/ui/src/views/knowledge/component/ParagraphList.vue new file mode 100644 index 00000000..eed59242 --- /dev/null +++ b/ui/src/views/knowledge/component/ParagraphList.vue @@ -0,0 +1,109 @@ + + + diff --git a/ui/src/views/knowledge/component/ParagraphPreview.vue b/ui/src/views/knowledge/component/ParagraphPreview.vue new file mode 100644 index 00000000..ae780c01 --- /dev/null +++ b/ui/src/views/knowledge/component/ParagraphPreview.vue @@ -0,0 +1,70 @@ + + + diff --git a/ui/src/views/knowledge/component/ResultSuccess.vue b/ui/src/views/knowledge/component/ResultSuccess.vue new file mode 100644 index 00000000..f1d1087c --- /dev/null +++ b/ui/src/views/knowledge/component/ResultSuccess.vue @@ -0,0 +1,90 @@ + + + diff --git a/ui/src/views/knowledge/component/SetRules.vue b/ui/src/views/knowledge/component/SetRules.vue new file mode 100644 index 00000000..07e9acde --- /dev/null +++ b/ui/src/views/knowledge/component/SetRules.vue @@ -0,0 +1,279 @@ + + + diff --git a/ui/src/views/knowledge/component/SyncWebDialog.vue b/ui/src/views/knowledge/component/SyncWebDialog.vue new file mode 100644 index 00000000..8c152b11 --- /dev/null +++ b/ui/src/views/knowledge/component/SyncWebDialog.vue @@ -0,0 +1,87 @@ + + + diff --git a/ui/src/views/knowledge/component/UploadComponent.vue b/ui/src/views/knowledge/component/UploadComponent.vue new file mode 100644 index 00000000..1b6c3cf3 --- /dev/null +++ b/ui/src/views/knowledge/component/UploadComponent.vue @@ -0,0 +1,327 @@ + + + diff --git a/ui/src/views/knowledge/index.vue b/ui/src/views/knowledge/index.vue index 4596da39..1359736b 100644 --- a/ui/src/views/knowledge/index.vue +++ b/ui/src/views/knowledge/index.vue @@ -6,13 +6,44 @@ :data="folderList" :currentNodeKey="currentFolder?.id" @handleNodeClick="folderClickHandel" + class="p-8" /> - -
-

{{ currentFolder?.name }}

-
-
+ +
@@ -99,12 +182,28 @@