Skip to content

Commit 479306d

Browse files
committed
パラメータ型をzodスキーマに基づくChatParamsに変更
1 parent f41ec4d commit 479306d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/actions/chatActions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ const ChatSchema = z.object({
1515

1616
const genAI = new GoogleGenerativeAI(process.env.API_KEY!);
1717

18-
export async function askAI(params: unknown): Promise<FormState> {
18+
type ChatParams = z.input<typeof ChatSchema>;
19+
20+
export async function askAI(params: ChatParams): Promise<FormState> {
1921
const parseResult = ChatSchema.safeParse(params);
2022

2123
if (!parseResult.success) {
@@ -41,5 +43,4 @@ export async function askAI(params: unknown): Promise<FormState> {
4143
}
4244
return { response: '', error: '予期せぬエラーが発生しました。' };
4345
}
44-
}
45-
46+
}

0 commit comments

Comments
 (0)