Add HelloWorld debug agent and per-chat handler
This commit is contained in:
15
whatsapp-router/src/chatHandlers.ts
Normal file
15
whatsapp-router/src/chatHandlers.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user