feat(graph-rag): UI fuer Wissens-Graph mit BFS-Traversierung — Modul 11/16 des UI-Backlogs
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
@@ -104,6 +104,45 @@ export interface GraphRelationshipsResult {
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface GraphRelationshipCreate {
|
||||
source_type: string;
|
||||
source_id: string;
|
||||
target_type: string;
|
||||
target_id: string;
|
||||
relationship_type: string;
|
||||
metadata?: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export interface GraphNode {
|
||||
entity_type: string;
|
||||
entity_id: string;
|
||||
depth: number;
|
||||
path: string[];
|
||||
}
|
||||
|
||||
export interface GraphEdge {
|
||||
source_type: string;
|
||||
source_id: string;
|
||||
target_type: string;
|
||||
target_id: string;
|
||||
relationship_type: string;
|
||||
metadata: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export interface GraphTraverseRequest {
|
||||
source_type: string;
|
||||
source_id: string;
|
||||
max_hops?: number;
|
||||
relationship_types?: string[] | null;
|
||||
}
|
||||
|
||||
export interface GraphTraverseResult {
|
||||
nodes: GraphNode[];
|
||||
edges: GraphEdge[];
|
||||
total_nodes: number;
|
||||
total_edges: number;
|
||||
}
|
||||
|
||||
// ─── Ask Knowledge types ───────────────────────────────────────────────────
|
||||
|
||||
export interface KnowledgeAskRequest {
|
||||
@@ -203,6 +242,22 @@ export async function fetchGraphRelationships(params?: {
|
||||
return apiGet<GraphRelationshipsResult>(`/graph/relationships${qs ? `?${qs}` : ''}`);
|
||||
}
|
||||
|
||||
export async function createGraphRelationship(
|
||||
data: GraphRelationshipCreate,
|
||||
): Promise<GraphRelationship> {
|
||||
return apiPost<GraphRelationship>('/graph/relationships', data);
|
||||
}
|
||||
|
||||
export async function deleteGraphRelationship(relationshipId: string): Promise<void> {
|
||||
await apiDelete<void>(`/graph/relationships/${relationshipId}`);
|
||||
}
|
||||
|
||||
export async function traverseGraph(
|
||||
body: GraphTraverseRequest,
|
||||
): Promise<GraphTraverseResult> {
|
||||
return apiPost<GraphTraverseResult>('/graph/traverse', body);
|
||||
}
|
||||
|
||||
// ─── Ask Knowledge API ─────────────────────────────────────────────────────
|
||||
|
||||
export async function askKnowledge(body: KnowledgeAskRequest): Promise<KnowledgeAskResponse> {
|
||||
|
||||
Reference in New Issue
Block a user