Currently, the sync_database tool is a single, monolithic operation that combines both the creation of the knowledge base JSONL file and the embedding of its content into ChromaDB. This lacks the granular control provided by the original createKnowledgeBase.mjs and embedKnowledgeBase.mjs scripts.
This ticket covers the work to separate this functionality into distinct tools to improve modularity, debuggability, and feature parity.
Acceptance Criteria
- The
openapi.yaml is updated to include two new endpoints under the Database tag:
POST /db/create: With operationId: create_knowledge_base.
POST /db/embed: With operationId: embed_knowledge_base.
- The
databaseService.mjs is refactored:
- The logic from the existing
syncDatabase function is split into two new functions: createKnowledgeBase and embedKnowledgeBase.
- The
createKnowledgeBase function will only generate the dist/ai-knowledge-base.jsonl file.
- The
embedKnowledgeBase function will read the .jsonl file and perform the diff, embedding, and upserting into ChromaDB.
- The existing
syncDatabase function is refactored to be a simple orchestrator that calls createKnowledgeBase() and then embedKnowledgeBase() in sequence.
- The
toolService.mjs serviceMapping is updated to map the new operationIds to their respective service functions.
Currently, the
sync_databasetool is a single, monolithic operation that combines both the creation of the knowledge base JSONL file and the embedding of its content into ChromaDB. This lacks the granular control provided by the originalcreateKnowledgeBase.mjsandembedKnowledgeBase.mjsscripts.This ticket covers the work to separate this functionality into distinct tools to improve modularity, debuggability, and feature parity.
Acceptance Criteria
openapi.yamlis updated to include two new endpoints under theDatabasetag:POST /db/create: WithoperationId: create_knowledge_base.POST /db/embed: WithoperationId: embed_knowledge_base.databaseService.mjsis refactored:syncDatabasefunction is split into two new functions:createKnowledgeBaseandembedKnowledgeBase.createKnowledgeBasefunction will only generate thedist/ai-knowledge-base.jsonlfile.embedKnowledgeBasefunction will read the.jsonlfile and perform the diff, embedding, and upserting into ChromaDB.syncDatabasefunction is refactored to be a simple orchestrator that callscreateKnowledgeBase()and thenembedKnowledgeBase()in sequence.toolService.mjsserviceMappingis updated to map the newoperationIds to their respective service functions.