Add HelloWorld debug agent and per-chat handler

This commit is contained in:
josedario87
2025-06-04 21:51:05 -06:00
parent dec4922d42
commit 8d2e8f4854
14 changed files with 582 additions and 35 deletions

View File

@@ -0,0 +1,15 @@
import { helloWorldAgent } from './helloAgent';
import { WhatsAppMessage } from './types';
export type Handler = string | ((msg: WhatsAppMessage | string) => Promise<string>);
export const chatHandlers: Record<string, Handler> = {
'50498554225@c.us': helloWorldAgent,
// Add other mappings like:
// '50496210031@c.us': 'http://llm-agent:8000'
};
export function getHandler(chatId: string | undefined, defaultUrl?: string): Handler | undefined {
if (!chatId) return defaultUrl;
return chatHandlers[chatId] || defaultUrl;
}