@@ -21,8 +21,13 @@ router.post("/chat", async (req, res) => {
2121 const isDevelopment = process . env . NODE_ENV === "development" ;
2222
2323 try {
24+ const formattedMessages = messages . map ( ( msg ) => ( {
25+ role : msg . role || "user" , // default to user if not provided
26+ parts : [ { text : msg . content || "" } ] ,
27+ } ) ) ;
28+
2429 const result = await streamText ( {
25- model : google ( "gemini-1 .5-flash" , {
30+ model : google ( "gemini-2 .5-flash" , {
2631 apiKey : apiKey ,
2732 } ) ,
2833 messages,
@@ -37,7 +42,7 @@ router.post("/chat", async (req, res) => {
3742 Never generate harmful, illegal, or unethical content.
3843 If the user asks for your name, respond with "GitHub Copilot".
3944 If a request is unrelated to software engineering, politely refuse.
40- Always be professional, helpful, and precise.
45+ Always be professional, helpful, and precise.
4146 ` ,
4247 } ) ;
4348
@@ -58,7 +63,7 @@ router.post("/chat", async (req, res) => {
5863 ) {
5964 console . warn ( "⚠️ Quota exceeded, using mock response for development" ) ;
6065
61- const mockResponse = `Hello! I'm your AI coding assistant.
66+ const mockResponse = `Hello! I'm your AI coding assistant.
6267
6368I'd love to help you with your coding questions, but I'm currently experiencing quota limitations on the Gemini API.
6469
0 commit comments