| | |
| | | import request from "@/utils/request"; |
| | | import { getToken } from '@/utils/auth'; |
| | | |
| | | // 查询知识库列表 |
| | | export function listKnowledgeBase(query) { |
| | |
| | | }); |
| | | } |
| | | |
| | | // 获取知识库列表(问答用) |
| | | export function getKnowledgeBaseListForChat() { |
| | | // 查询知识库问答历史 |
| | | export function getKnowledgeHistory(memoryId) { |
| | | return request({ |
| | | url: "/ai/knowledge/list", |
| | | url: `/ai/knowledge/history/${memoryId}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // 知识库问答(流式) |
| | | export async function knowledgeChat(data) { |
| | | const response = await fetch("/api/ai/knowledge/chat", { |
| | | method: "POST", |
| | | headers: { "Content-Type": "application/json" }, |
| | | body: JSON.stringify(data), |
| | | const token = getToken(); |
| | | const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/ai/knowledge/chat', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'Authorization': 'Bearer ' + token |
| | | }, |
| | | body: JSON.stringify(data) |
| | | }); |
| | | return response.body; |
| | | } |