feat(ai-config): validate bindings before save
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user