From c62a12c23726d08861617255a1e0f347c5a7872b Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 7 Dec 2023 15:22:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E8=AF=9D=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/log.ts | 27 +++++++- ui/src/api/model.ts | 2 +- ui/src/api/paragraph.ts | 12 +++- ui/src/components/ai-chat/index.vue | 6 +- ui/src/components/index.ts | 2 + ui/src/styles/element-plus.scss | 13 ++++ ui/src/views/application/CreateAndSetting.vue | 1 - ui/src/views/application/index.vue | 7 +- ui/src/views/chat/index.vue | 1 - ui/src/views/dataset/index.vue | 6 +- .../views/log/component/ChatRecordDrawer.vue | 64 +++++++++++++++++++ ui/src/views/log/index.vue | 7 +- .../paragraph/component/ParagraphDialog.vue | 4 +- ui/src/views/paragraph/index.vue | 33 +++++----- 14 files changed, 152 insertions(+), 33 deletions(-) create mode 100644 ui/src/views/log/component/ChatRecordDrawer.vue diff --git a/ui/src/api/log.ts b/ui/src/api/log.ts index 0762a0385..554ac87e5 100644 --- a/ui/src/api/log.ts +++ b/ui/src/api/log.ts @@ -39,10 +39,33 @@ const delChatLog: ( chat_id: string, loading?: Ref ) => Promise> = (applicaiton_id, chat_id, loading) => { - return del(`${prefix}/${applicaiton_id}/document/${chat_id}`, {}, loading) + return del(`${prefix}/${applicaiton_id}/chat/${chat_id}`, undefined, {}, loading) +} + +/** + * 日志记录 + * @param 参数 + * application_id, chart_id + * page { + "current_page": "string", + "page_size": "string", + } + */ +const getChatRecordLog: ( + applicaiton_id: String, + chart_id: String, + page: pageRequest, + loading?: Ref +) => Promise> = (applicaiton_id, chart_id, page, loading) => { + return get( + `${prefix}/${applicaiton_id}/chat/${chart_id}/chat_record/${page.current_page}/${page.page_size}`, + undefined, + loading + ) } export default { getChatLog, - delChatLog + delChatLog, + getChatRecordLog } diff --git a/ui/src/api/model.ts b/ui/src/api/model.ts index 4ed44a9eb..fe8e63f8b 100644 --- a/ui/src/api/model.ts +++ b/ui/src/api/model.ts @@ -111,7 +111,7 @@ const deleteModel: (model_id: string, loading?: Ref) => Promise { - return del(`${prefix}/${model_id}`, {}, loading) + return del(`${prefix}/${model_id}`, undefined, {}, loading) } export default { getModel, diff --git a/ui/src/api/paragraph.ts b/ui/src/api/paragraph.ts index 6938e703c..d85cb6b68 100644 --- a/ui/src/api/paragraph.ts +++ b/ui/src/api/paragraph.ts @@ -37,9 +37,15 @@ const getParagraph: ( const delParagraph: ( dataset_id: string, document_id: string, - paragraph_id: string -) => Promise> = (dataset_id, document_id, paragraph_id) => { - return del(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`) + paragraph_id: string, + loading?: Ref +) => Promise> = (dataset_id, document_id, paragraph_id, loading) => { + return del( + `${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`, + undefined, + {}, + loading + ) } /** diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index ee306cb82..51beb6637 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -94,7 +94,7 @@ -
+
{} }, - appId: String + appId: String, + record: Boolean }) const { application } = useStore() diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts index 1875fd054..103d701f5 100644 --- a/ui/src/components/index.ts +++ b/ui/src/components/index.ts @@ -15,6 +15,7 @@ import CommonList from './common-list/index.vue' import MarkdownRenderer from './markdown-renderer/index.vue' import dynamicsForm from './dynamics-form' import CardCheckbox from './card-checkbox/index.vue' +import AiChat from './ai-chat/index.vue' export default { install(app: App) { @@ -34,5 +35,6 @@ export default { app.use(dynamicsForm) app.component(MarkdownRenderer.name, MarkdownRenderer) app.component(CardCheckbox.name, CardCheckbox) + app.component(AiChat.name, AiChat) } } diff --git a/ui/src/styles/element-plus.scss b/ui/src/styles/element-plus.scss index 4edf596cf..de96f103d 100644 --- a/ui/src/styles/element-plus.scss +++ b/ui/src/styles/element-plus.scss @@ -182,3 +182,16 @@ .el-tabs__header { margin: 0 0 12px; } + +.el-drawer { + .el-drawer__header { + padding: 16px 24px; + margin: 0; + border-bottom: 1px solid var(--el-border-color); + color: var(--app-text-color); + } + .el-drawer__footer { + border-top: 1px solid var(--el-border-color); + padding: 16px 24px; + } +} diff --git a/ui/src/views/application/CreateAndSetting.vue b/ui/src/views/application/CreateAndSetting.vue index 37cdcec9f..5496f9818 100644 --- a/ui/src/views/application/CreateAndSetting.vue +++ b/ui/src/views/application/CreateAndSetting.vue @@ -181,7 +181,6 @@ import { reactive, ref, watch, onMounted } from 'vue' import { useRouter, useRoute } from 'vue-router' import { groupBy } from 'lodash' -import AiChat from '@/components/ai-chat/index.vue' import AddDatasetDialog from './components/AddDatasetDialog.vue' import CreateModelDialog from '@/views/template/component/CreateModelDialog.vue' import SelectProviderDialog from '@/views/template/component/SelectProviderDialog.vue' diff --git a/ui/src/views/application/index.vue b/ui/src/views/application/index.vue index eed3eae65..8f0cffd47 100644 --- a/ui/src/views/application/index.vue +++ b/ui/src/views/application/index.vue @@ -109,7 +109,8 @@ const noMore = computed( () => applicationList.value.length > 0 && applicationList.value.length === pageConfig.total && - pageConfig.total > 20 + pageConfig.total > 20 && + !loading.value ) const disabledScroll = computed( () => applicationList.value.length > 0 && (loading.value || noMore.value) @@ -144,8 +145,9 @@ function deleteApplication(row: any) { applicationApi .delApplication(row.id) .then(() => { + const index = applicationList.value.findIndex((v) => v.id === row.id) + applicationList.value.splice(index, 1) MsgSuccess('删除成功') - getList() }) .catch(() => { loading.value = false @@ -154,7 +156,6 @@ function deleteApplication(row: any) { .catch(() => {}) } - function getList() { applicationApi .getApplication(pageConfig, searchValue.value && { name: searchValue.value }, loading) diff --git a/ui/src/views/chat/index.vue b/ui/src/views/chat/index.vue index c97c3516b..cd9c49888 100644 --- a/ui/src/views/chat/index.vue +++ b/ui/src/views/chat/index.vue @@ -14,7 +14,6 @@ + diff --git a/ui/src/views/log/index.vue b/ui/src/views/log/index.vue index 415603aa0..11aab4fa9 100644 --- a/ui/src/views/log/index.vue +++ b/ui/src/views/log/index.vue @@ -62,11 +62,13 @@
+