fix: appointmentStatus→status, missed call visibility, webhook callbackstatus, KB logging

- Renamed appointmentStatus to status in search + call-assist queries
- Missed calls worklist: removed agentName filter (shared FIFO queue)
- Webhook sets callbackstatus: PENDING_CALLBACK on missed calls
- AI chat: added KB content logging for debugging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 14:42:38 +05:30
parent 0b98d490f0
commit 4b5edc4e55
5 changed files with 16 additions and 5 deletions

View File

@@ -64,6 +64,7 @@ export class AiChatController {
private async buildKnowledgeBase(auth: string): Promise<string> {
const now = Date.now();
if (this.knowledgeBase && now - this.kbLoadedAt < this.kbTtlMs) {
this.logger.log(`KB cache hit (${this.knowledgeBase.length} chars, age ${Math.round((now - this.kbLoadedAt) / 1000)}s)`);
return this.knowledgeBase;
}
@@ -120,6 +121,7 @@ export class AiChatController {
}
} catch (err) {
this.logger.warn(`Failed to fetch clinics: ${err}`);
sections.push('## Clinics\nFailed to load clinic data.');
}
try {
@@ -155,6 +157,7 @@ export class AiChatController {
}
} catch (err) {
this.logger.warn(`Failed to fetch health packages: ${err}`);
sections.push('\n## Health Packages\nFailed to load package data.');
}
try {
@@ -175,6 +178,7 @@ export class AiChatController {
}
} catch (err) {
this.logger.warn(`Failed to fetch insurance partners: ${err}`);
sections.push('\n## Insurance Partners\nFailed to load insurance data.');
}
this.knowledgeBase = sections.join('\n') || 'No hospital information available yet.';
@@ -202,7 +206,9 @@ ${kb}`;
private async chatWithTools(userMessage: string, auth: string) {
const kb = await this.buildKnowledgeBase(auth);
this.logger.log(`KB content preview: ${kb.substring(0, 300)}...`);
const systemPrompt = this.buildSystemPrompt(kb);
this.logger.log(`System prompt length: ${systemPrompt.length} chars, user message: "${userMessage.substring(0, 100)}"`);
const platformService = this.platform;
const { text, steps } = await generateText({