移除gitignore中的lib文件夹,上传被排除掉的前端lib文件

This commit is contained in:
墨梓柒
2026-01-21 15:41:43 +08:00
parent 761e4c8940
commit 433a4551f9
26 changed files with 4559 additions and 1 deletions

View File

@@ -0,0 +1,69 @@
/**
* 知识库 API
*/
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '/api/webui'
export interface KnowledgeNode {
id: string
type: 'entity' | 'paragraph'
content: string
create_time?: number
}
export interface KnowledgeEdge {
source: string
target: string
weight: number
create_time?: number
update_time?: number
}
export interface KnowledgeGraph {
nodes: KnowledgeNode[]
edges: KnowledgeEdge[]
}
export interface KnowledgeStats {
total_nodes: number
total_edges: number
entity_nodes: number
paragraph_nodes: number
}
/**
* 获取知识图谱数据
*/
export async function getKnowledgeGraph(limit: number = 100, nodeType: 'all' | 'entity' | 'paragraph' = 'all'): Promise<KnowledgeGraph> {
const url = `${API_BASE_URL}/knowledge/graph?limit=${limit}&node_type=${nodeType}`
const response = await fetch(url)
if (!response.ok) {
throw new Error(`获取知识图谱失败: ${response.status}`)
}
return response.json()
}
/**
* 获取知识图谱统计信息
*/
export async function getKnowledgeStats(): Promise<KnowledgeStats> {
const response = await fetch(`${API_BASE_URL}/knowledge/stats`)
if (!response.ok) {
throw new Error('获取知识图谱统计信息失败')
}
return response.json()
}
/**
* 搜索知识节点
*/
export async function searchKnowledgeNode(query: string): Promise<KnowledgeNode[]> {
const response = await fetch(`${API_BASE_URL}/knowledge/search?query=${encodeURIComponent(query)}`)
if (!response.ok) {
throw new Error('搜索知识节点失败')
}
return response.json()
}