Skip to content

Commit 8581fb7

Browse files
committed
ファイルの位置とlint修正
1 parent c5f10d1 commit 8581fb7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { NextResponse } from 'next/server';
2-
import { GoogleGenerativeAI } from '@google/generative-ai';
3-
1+
import { NextResponse } from "next/server";
2+
import { GoogleGenerativeAI } from "@google/generative-ai";
43

54
const genAI = new GoogleGenerativeAI(process.env.API_KEY);
65

76
export async function POST(request) {
87
const { message } = await request.json();
98

10-
119
if (!message) {
1210
return NextResponse.json(
1311
{ error: "メッセージがありません。" },
@@ -17,19 +15,17 @@ export async function POST(request) {
1715

1816
try {
1917
const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
20-
18+
2119
const result = await model.generateContent(message);
2220
const response = result.response;
2321
const text = response.text();
2422

2523
return NextResponse.json({ response: text });
26-
2724
} catch (e) {
28-
2925
console.error("Error:", e);
3026
return NextResponse.json(
3127
{ response: "エラーが発生しました。" },
3228
{ status: 500 }
3329
);
3430
}
35-
}
31+
}

0 commit comments

Comments
 (0)