Add index button

This commit is contained in:
Xin Wang
2026-02-10 10:42:40 +08:00
parent aa2a358b38
commit 375181a524
2 changed files with 103 additions and 3 deletions

View File

@@ -623,6 +623,23 @@ export const deleteKnowledgeDocument = async (kbId: string, docId: string): Prom
await apiRequest(`/knowledge/bases/${kbId}/documents/${docId}`, { method: 'DELETE' });
};
export const indexKnowledgeDocument = async (
kbId: string,
docId: string,
content: string,
): Promise<{ message: string; chunkCount: number }> => {
return apiRequest<{ message: string; chunkCount: number }>(
`/knowledge/bases/${kbId}/documents/${docId}/index`,
{
method: 'POST',
body: {
document_id: docId,
content,
},
}
);
};
export type KnowledgeSearchResultItem = {
content: string;
metadata?: {