Skip to content

Commit bee121c

Browse files
committed
updated the Gemini version
1 parent 6ccc030 commit bee121c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Codespace_Service/src/routes/aiRoutes.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
6368
I'd love to help you with your coding questions, but I'm currently experiencing quota limitations on the Gemini API.
6469

Codespace_Service/src/services/aiService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export async function AIChatResponse(messages) {
77
}
88

99
const result = streamText({
10-
model: google("gemini-1.5-pro"),
10+
model: google("gemini-2.5-flash"),
11+
1112
messages: convertToModelMessages(messages),
1213
system: `
1314
You are an expert AI coding assistant integrated into a collaborative code editor.

0 commit comments

Comments
 (0)