提交 7cbdc670 作者: 敬文 | 罗千洪

fix(前端): 查询切换到知识库tab时,应该调用查询知识库列表接口而不是文件列表接口;删除文件改为使用DELETE方法,参数按api.py改动调整为QueryParam

上级 2311fb00
...@@ -16,6 +16,14 @@ export const chatfile = (params: any) => { ...@@ -16,6 +16,14 @@ export const chatfile = (params: any) => {
}) })
} }
export const getKbsList = () => {
return api({
url: '/local_doc_qa/list_knowledge_base',
method: 'get',
})
}
export const getfilelist = (knowledge_base_id: any) => { export const getfilelist = (knowledge_base_id: any) => {
return api({ return api({
url: '/local_doc_qa/list_files', url: '/local_doc_qa/list_files',
...@@ -35,8 +43,8 @@ export const bing_search = (params: any) => { ...@@ -35,8 +43,8 @@ export const bing_search = (params: any) => {
export const deletefile = (params: any) => { export const deletefile = (params: any) => {
return api({ return api({
url: '/local_doc_qa/delete_file', url: '/local_doc_qa/delete_file',
method: 'post', method: 'delete',
data: JSON.stringify(params), params,
}) })
} }
export const web_url = () => { export const web_url = () => {
......
...@@ -3,15 +3,16 @@ import { NButton, NForm, NFormItem, NInput, NPopconfirm } from 'naive-ui' ...@@ -3,15 +3,16 @@ import { NButton, NForm, NFormItem, NInput, NPopconfirm } from 'naive-ui'
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import filelist from './filelist.vue' import filelist from './filelist.vue'
import { SvgIcon } from '@/components/common' import { SvgIcon } from '@/components/common'
import { deletefile, getfilelist } from '@/api/chat' import { deletefile, getKbsList, getfilelist } from '@/api/chat'
import { idStore } from '@/store/modules/knowledgebaseid/id' import { idStore } from '@/store/modules/knowledgebaseid/id'
const items = ref<any>([]) const items = ref<any>([])
const choice = ref('') const choice = ref('')
const store = idStore() const store = idStore()
onMounted(async () => { onMounted(async () => {
choice.value = store.knowledgeid choice.value = store.knowledgeid
const res = await getfilelist({}) const res = await getKbsList()
res.data.data.forEach((item: any) => { res.data.data.forEach((item: any) => {
items.value.push({ items.value.push({
value: item, value: item,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论