From 48257eacffceb33c254b911600fb58b48b6ebe0f Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Tue, 14 Nov 2023 18:12:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=AE=B5=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/dataset.ts | 27 +++- ui/src/components/app-table/index.vue | 1 + ui/src/components/index.ts | 2 + ui/src/components/read-write/index.vue | 14 +- ui/src/components/tag-ellipsis/index.vue | 55 +++++++ .../top-bar/avatar/ResetPasssword.vue | 2 +- ui/src/router/modules/dataset.ts | 10 +- ui/src/stores/index.ts | 4 +- ui/src/stores/modules/paragraph.ts | 23 +++ ui/src/styles/app.scss | 2 + ui/src/styles/element-plus.scss | 22 +-- ui/src/views/dataset/CreateDataset.vue | 2 +- ui/src/views/dataset/component/BaseForm.vue | 9 +- .../dataset/component/EditParagraphDialog.vue | 44 ++++++ .../dataset/component/EditSegmentDialog.vue | 80 ---------- .../dataset/component/ParagraphDialog.vue | 121 --------------- ...egmentPreview.vue => ParagraphPreview.vue} | 16 +- .../dataset/component/UploadComponent.vue | 7 +- ui/src/views/dataset/index.vue | 1 + ui/src/views/dataset/step/StepSecond.vue | 23 ++- .../{dataset => document}/DatasetSetting.vue | 0 .../index.vue} | 0 ui/src/views/login/forgot-password/index.vue | 2 +- ui/src/views/login/register/index.vue | 2 +- .../paragraph/component/ParagraphDialog.vue | 145 ++++++++++++++++++ .../paragraph/component/ParagraphForm.vue | 75 +++++++++ .../index.vue} | 20 ++- 27 files changed, 454 insertions(+), 255 deletions(-) create mode 100644 ui/src/components/tag-ellipsis/index.vue create mode 100644 ui/src/stores/modules/paragraph.ts create mode 100644 ui/src/views/dataset/component/EditParagraphDialog.vue delete mode 100644 ui/src/views/dataset/component/EditSegmentDialog.vue delete mode 100644 ui/src/views/dataset/component/ParagraphDialog.vue rename ui/src/views/dataset/component/{SegmentPreview.vue => ParagraphPreview.vue} (90%) rename ui/src/views/{dataset => document}/DatasetSetting.vue (100%) rename ui/src/views/{dataset/DatasetDocument.vue => document/index.vue} (100%) create mode 100644 ui/src/views/paragraph/component/ParagraphDialog.vue create mode 100644 ui/src/views/paragraph/component/ParagraphForm.vue rename ui/src/views/{dataset/DocumentDetail.vue => paragraph/index.vue} (93%) diff --git a/ui/src/api/dataset.ts b/ui/src/api/dataset.ts index 91d669d1d..10a19fbbc 100644 --- a/ui/src/api/dataset.ts +++ b/ui/src/api/dataset.ts @@ -196,6 +196,30 @@ const delParagraph: ( return del(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`) } +/** + * 创建段落 + * @param 参数 + * dataset_id, document_id + * { + "content": "string", + "title": "string", + "is_active": true, + "problem_list": [ + { + "id": "string", + "content": "string" + } + ] + } + */ +const postParagraph: ( + dataset_id: string, + document_id: string, + data: any +) => Promise> = (dataset_id, document_id, data: any) => { + return post(`${prefix}/${dataset_id}/document/${document_id}/paragraph`, data) +} + /** * 修改段落 * @param 参数 @@ -236,5 +260,6 @@ export default { getDocumentDetail, getParagraph, delParagraph, - putParagraph + putParagraph, + postParagraph } diff --git a/ui/src/components/app-table/index.vue b/ui/src/components/app-table/index.vue index 14dafc87c..6a4506ce5 100644 --- a/ui/src/components/app-table/index.vue +++ b/ui/src/components/app-table/index.vue @@ -8,6 +8,7 @@ v-model="inputValue" placeholder="请输入文档名称" class="w-240 mr-12" + autofocus /> 创建 diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts index e3ac6770a..0173c4248 100644 --- a/ui/src/components/index.ts +++ b/ui/src/components/index.ts @@ -10,6 +10,7 @@ import CardAdd from './card-add/index.vue' import BackButton from './back-button/index.vue' import AppTable from './app-table/index.vue' import ReadWrite from './read-write/index.vue' +import TagEllipsis from './tag-ellipsis/index.vue' export default { install(app: App) { @@ -24,5 +25,6 @@ export default { app.component(BackButton.name, BackButton) app.component(AppTable.name, AppTable) app.component(ReadWrite.name, ReadWrite) + app.component(TagEllipsis.name, TagEllipsis) } } diff --git a/ui/src/components/read-write/index.vue b/ui/src/components/read-write/index.vue index 93719dcb4..71762873a 100644 --- a/ui/src/components/read-write/index.vue +++ b/ui/src/components/read-write/index.vue @@ -10,7 +10,10 @@
- +
+ +
+