19 lines
629 B
TypeScript
19 lines
629 B
TypeScript
import { helloWorldAgent } from './helloAgent';
|
|
import { Conversation } from './types';
|
|
import dotenv from 'dotenv';
|
|
dotenv.config();
|
|
|
|
export type Handler = string | ((conv: Conversation) => Promise<string>);
|
|
|
|
export const chatHandlers: Record<string, Handler> = {
|
|
'50498554225@c.us': process.env.CONVERSATION_AGENT_URL || 'http://conversation-layer-agent:8001',
|
|
// 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;
|
|
}
|