feat(ai-config): validate bindings before save

This commit is contained in:
2026-04-08 00:09:36 +08:00
parent 929b838e0f
commit e5948cd346
6 changed files with 381 additions and 15 deletions
+10 -1
View File
@@ -15,7 +15,8 @@ import {
AiChatResponse,
AiService,
ListAiBindingsResponse,
ListAiUsageLogsResponse
ListAiUsageLogsResponse,
TestAiBindingResponse
} from "./ai.service";
@Controller("ai")
@@ -45,6 +46,14 @@ export class AiController {
return this.aiService.upsertBinding(this.resolveUserId(userIdHeader), body);
}
@Post("bindings/test")
async testBinding(
@Headers("x-user-id") userIdHeader: string | string[] | undefined,
@Body() body: UpsertAiProviderBindingDto
): Promise<TestAiBindingResponse> {
return this.aiService.testBinding(this.resolveUserId(userIdHeader), body);
}
@Post("chat")
async chat(
@Headers("x-user-id") userIdHeader: string | string[] | undefined,