diff --git a/Makefile b/Makefile index 94aec58..907c4ea 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,9 @@ chat: cd chat-ui && npm install && npm run build && npm start router: - cd whatsapp-router && npm install && npm run dev + cd whatsapp-router && npm install && npm run dev agent: - cd conversation-layer-agent && npm install && npm run dev + cd conversation-layer-agent && npm install && npm run dev diff --git a/conversation-layer-agent/src/index.ts b/conversation-layer-agent/src/index.ts index 9d2cb65..d0fd900 100644 --- a/conversation-layer-agent/src/index.ts +++ b/conversation-layer-agent/src/index.ts @@ -6,6 +6,7 @@ dotenv.config(); const PORT = Number(process.env.PORT) || 8001; const API_KEY = process.env.GEMINI_API_KEY || ''; +console.log(`Using Gemini API key: ${API_KEY}`); const genAI = API_KEY ? new GoogleGenerativeAI(API_KEY) : null; const model = genAI ? genAI.getGenerativeModel({ model: 'gemini-pro' }) : null; @@ -38,6 +39,19 @@ app.post('/', async (req, res) => { } }); +app.get('/', (req, res) => { + res.send(` +
This service answers questions about the repository.
+Send a POST request to / with a JSON body containing {"message": "your question"}
+Example: {"message": "What is this repository about?"}
+It will respond with a JSON object containing {"reply": "the answer"}
+ +Repository info: ${repoInfo}
+ `); +} +); + app.listen(PORT, () => { console.log(`conversation-layer-agent listening on ${PORT}`); }); diff --git a/whatsapp-router/src/chatHandlers.ts b/whatsapp-router/src/chatHandlers.ts index b91daac..b5c9019 100644 --- a/whatsapp-router/src/chatHandlers.ts +++ b/whatsapp-router/src/chatHandlers.ts @@ -4,7 +4,7 @@ import { WhatsAppMessage } from './types'; export type Handler = string | ((msg: WhatsAppMessage | string) => Promise