diff --git a/ui/src/api/system-shared/document.ts b/ui/src/api/system-shared/document.ts index 0ce48aa78..d2505e45c 100644 --- a/ui/src/api/system-shared/document.ts +++ b/ui/src/api/system-shared/document.ts @@ -6,6 +6,22 @@ import type { pageRequest } from '@/api/type/common' const prefix = '/system/shared/knowledge' +/** + * 文档列表(无分页) + * @param 参数 knowledge_id, + * param { + " name": "string", + } + */ + +const getDocumentList: (knowledge_id: string, loading?: Ref) => Promise> = ( + knowledge_id, + loading, +) => { + return get(`${prefix}/${knowledge_id}/document`, undefined, loading) +} + + /** * 文档分页列表 * @param 参数 knowledge_id, @@ -506,14 +522,9 @@ const importLarkDocument: ( return post(`${prefix}/lark/${knowledge_id}/import`, data, null, loading) } -const getAllDocument: (knowledge_id: string, loading?: Ref) => Promise> = ( - knowledge_id, - loading, -) => { - return get(`${prefix}/${knowledge_id}/document`, undefined, loading) -} export default { + getDocumentList, getDocumentPage, getDocumentDetail, putDocument, diff --git a/ui/src/stores/modules/model.ts b/ui/src/stores/modules/model.ts index 69df97268..6af103ee9 100644 --- a/ui/src/stores/modules/model.ts +++ b/ui/src/stores/modules/model.ts @@ -1,19 +1,24 @@ -import {defineStore} from 'pinia' -import {type Ref} from 'vue' -import ModelApi from '@/api/model/model' +import { defineStore } from 'pinia' +import { type Ref } from 'vue' import ProviderApi from '@/api/model/provider' -import type {ListModelRequest} from '@/api/type/model' +import type { ListModelRequest } from '@/api/type/model' +import { loadSharedApi } from '@/utils/dynamics-api/shared-api' const useModelStore = defineStore('model', { state: () => ({}), actions: { - async asyncGetModel(data?: ListModelRequest, loading?: Ref) { + async asyncGetModel( + data?: ListModelRequest, + systemType: 'systemShare' | 'workspace' | 'systemManage' = 'workspace', + loading?: Ref, + ) { return new Promise((resolve, reject) => { - ModelApi.getModel(data, loading) - .then((res) => { + loadSharedApi({ type: 'model', systemType }) + .getModel(data, loading) + .then((res: any) => { resolve(res) }) - .catch((error) => { + .catch((error: any) => { reject(error) }) }) diff --git a/ui/src/stores/modules/paragraph.ts b/ui/src/stores/modules/paragraph.ts index 840b42f9b..47f92c494 100644 --- a/ui/src/stores/modules/paragraph.ts +++ b/ui/src/stores/modules/paragraph.ts @@ -50,8 +50,8 @@ const useParagraphStore = defineStore('paragraph', { ) { return new Promise((resolve, reject) => { const obj = { - paragraphId, - problemId, + paragraph_id: paragraphId, + problem_id: problemId, } paragraphApi .putDisassociationProblem(knowledgeId, documentId, obj, loading) @@ -72,8 +72,8 @@ const useParagraphStore = defineStore('paragraph', { ) { return new Promise((resolve, reject) => { const obj = { - paragraphId, - problemId, + paragraph_id: paragraphId, + problem_id: problemId, } paragraphApi .putAssociationProblem(knowledgeId, documentId, obj, loading) diff --git a/ui/src/views/chat-log/component/EditContentDialog.vue b/ui/src/views/chat-log/component/EditContentDialog.vue index 284ea1508..898a8aa85 100644 --- a/ui/src/views/chat-log/component/EditContentDialog.vue +++ b/ui/src/views/chat-log/component/EditContentDialog.vue @@ -217,7 +217,7 @@ function changeDocument(document_id: string) { } function getDocument(knowledge_id: string) { - document.asyncGetAllDocument(knowledge_id, loading).then((res: any) => { + document.asyncGetKnowledgeDocument(knowledge_id, loading).then((res: any) => { documentList.value = res.data if (localStorage.getItem(id + 'chat_document_id')) { form.value.document_id = localStorage.getItem(id + 'chat_document_id') as string diff --git a/ui/src/views/chat-log/index.vue b/ui/src/views/chat-log/index.vue index 994fe7d5f..801999843 100644 --- a/ui/src/views/chat-log/index.vue +++ b/ui/src/views/chat-log/index.vue @@ -569,7 +569,7 @@ function saveCleanTime() { function changeKnowledge(knowledge_id: string) { localStorage.setItem(id + 'chat_knowledge_id', knowledge_id) form.value.document_id = '' - getDocumentPage(knowledge_id) + getDocument(knowledge_id) } function changeDocument(document_id: string) { @@ -617,7 +617,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { } function getDocument(knowledge_id: string) { - document.asyncGetAllDocument(knowledge_id, documentLoading).then((res: any) => { + document.asyncGetKnowledgeDocument(knowledge_id, documentLoading).then((res: any) => { documentList.value = res.data if (localStorage.getItem(id + 'chat_document_id')) { form.value.document_id = localStorage.getItem(id + 'chat_document_id') as string diff --git a/ui/src/views/knowledge/KnowledgeSetting.vue b/ui/src/views/knowledge/KnowledgeSetting.vue index f777eda67..e3912007f 100644 --- a/ui/src/views/knowledge/KnowledgeSetting.vue +++ b/ui/src/views/knowledge/KnowledgeSetting.vue @@ -8,7 +8,7 @@

{{ $t('common.info') }}

- +