import { http } from './client' import type { IndustryPack, KnowledgeItem, KnowledgeSearchResult, KnowledgeStats } from '@/types' /** GET /api/knowledge */ export function getKnowledge(query: { category?: string; keyword?: string } = {}) { return http.get<{ list: KnowledgeItem[]; total: number }>('/api/knowledge', { ...query }) } /** POST /api/knowledge */ export function createKnowledge(payload: Partial) { return http.post('/api/knowledge', payload) } /** PATCH /api/knowledge/:id */ export function updateKnowledge(id: string, payload: Partial) { return http.patch(`/api/knowledge/${id}`, payload) } /** DELETE /api/knowledge/:id */ export function deleteKnowledge(id: string) { return http.del<{ success: boolean }>(`/api/knowledge/${id}`) } /** POST /api/knowledge/upload */ export function uploadKnowledgeFiles(files: { name: string; type: string; base64: string }[]) { return http.post<{ items: KnowledgeItem[] }>('/api/knowledge/upload', { files }) } /** POST /api/knowledge/search-test */ export function knowledgeSearchTest(question: string) { return http.post('/api/knowledge/search-test', { question }) } /** GET /api/knowledge/stats */ export function getKnowledgeStats() { return http.get('/api/knowledge/stats') } /** GET /api/knowledge/packs */ export function getIndustryPacks() { return http.get('/api/knowledge/packs') }