Files
xerrors--yuxi/web/src/apis/graph_api.js
T
wehub-resource-sync 1443d3fdf9
Ruff Format Check / Ruff Format & Lint (push) Failing after 7m39s
Deploy VitePress site to Pages / build (push) Failing after 9m11s
Deploy VitePress site to Pages / Deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:32:26 +08:00

52 lines
1.2 KiB
JavaScript

import { apiGet } from './base'
export const graphApi = {
getGraphs: async () => {
return await apiGet('/api/graph/list', {}, true)
},
getSubgraph: async (params) => {
const {
kb_id,
node_label = '*',
max_depth = 2,
max_nodes = 100,
exclude_chunk = false
} = params
if (!kb_id) {
throw new Error('kb_id is required')
}
const queryParams = new URLSearchParams({
kb_id,
node_label,
max_depth: max_depth.toString(),
max_nodes: max_nodes.toString(),
exclude_chunk: exclude_chunk.toString()
})
return await apiGet(`/api/graph/subgraph?${queryParams.toString()}`, {}, true)
},
getStats: async (kb_id) => {
if (!kb_id) {
throw new Error('kb_id is required')
}
const queryParams = new URLSearchParams({ kb_id })
return await apiGet(`/api/graph/stats?${queryParams.toString()}`, {}, true)
},
getLabels: async (kb_id) => {
if (!kb_id) {
throw new Error('kb_id is required')
}
const queryParams = new URLSearchParams({ kb_id })
return await apiGet(`/api/graph/labels?${queryParams.toString()}`, {}, true)
}
}
export const unifiedApi = graphApi