From 647eada38826a164b12ecb9bce6a89daab5ff5de Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Tue, 5 Mar 2024 17:22:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20AI=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/application.ts | 17 ++++++++++- ui/src/views/application/CreateAndSetting.vue | 30 +++++++++++++------ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index c6020ddd2..1a3631d36 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -216,6 +216,20 @@ const getApplicationHitTest: ( return get(`${prefix}/${application_id}/hit_test`, data, loading) } +/** + * 获取当前用户可使用的模型列表 + * @param application_id + * @param loading + * @query { query_text: string, top_number: number, similarity: number } + * @returns + */ +const getApplicationModel: ( + application_id: string, + loading?: Ref +) => Promise>> = (application_id, loading) => { + return get(`${prefix}/${application_id}/model`, loading) +} + export default { getAllAppilcation, getApplication, @@ -232,5 +246,6 @@ export default { postAppAuthentication, getProfile, putChatVote, - getApplicationHitTest + getApplicationHitTest, + getApplicationModel } diff --git a/ui/src/views/application/CreateAndSetting.vue b/ui/src/views/application/CreateAndSetting.vue index a99d05771..db13b2ca5 100644 --- a/ui/src/views/application/CreateAndSetting.vue +++ b/ui/src/views/application/CreateAndSetting.vue @@ -464,15 +464,27 @@ function getDataset() { function getModel() { loading.value = true - model - .asyncGetModel() - .then((res: any) => { - modelOptions.value = groupBy(res?.data, 'provider') - loading.value = false - }) - .catch(() => { - loading.value = false - }) + if (id) { + applicationApi + .getApplicationModel(id) + .then((res: any) => { + modelOptions.value = groupBy(res?.data, 'provider') + loading.value = false + }) + .catch(() => { + loading.value = false + }) + } else { + model + .asyncGetModel() + .then((res: any) => { + modelOptions.value = groupBy(res?.data, 'provider') + loading.value = false + }) + .catch(() => { + loading.value = false + }) + } } function getProvider() { From d3df1850b4774e63f47627b0ad2a6b55889860ad Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Tue, 5 Mar 2024 18:10:15 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/card-box/index.vue | 4 +++- ui/src/components/tag-ellipsis/index.vue | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/src/components/card-box/index.vue b/ui/src/components/card-box/index.vue index 84721522c..4190cbd31 100644 --- a/ui/src/components/card-box/index.vue +++ b/ui/src/components/card-box/index.vue @@ -8,7 +8,9 @@ -

{{ title }}

+ + {{ title }} + diff --git a/ui/src/components/tag-ellipsis/index.vue b/ui/src/components/tag-ellipsis/index.vue index fb39c40ad..aa08d864f 100644 --- a/ui/src/components/tag-ellipsis/index.vue +++ b/ui/src/components/tag-ellipsis/index.vue @@ -1,8 +1,8 @@