mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
feat: add createLLMConfig method to llm-config API service
This commit is contained in:
parent
506419597e
commit
0c39242abb
1 changed files with 18 additions and 0 deletions
|
|
@ -33,6 +33,24 @@ class LLMConfigApiService {
|
|||
getGlobalLLMConfigs = async () => {
|
||||
return baseApiService.get(`/api/v1/global-llm-configs`, getGlobalLLMConfigsResponse);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new LLM configuration for a search space
|
||||
*/
|
||||
createLLMConfig = async (request: CreateLLMConfigRequest) => {
|
||||
const parsedRequest = createLLMConfigRequest.safeParse(request);
|
||||
|
||||
if (!parsedRequest.success) {
|
||||
console.error("Invalid request:", parsedRequest.error);
|
||||
|
||||
const errorMessage = parsedRequest.error.errors.map((err) => err.message).join(", ");
|
||||
throw new ValidationError(`Invalid request: ${errorMessage}`);
|
||||
}
|
||||
|
||||
return baseApiService.post(`/api/v1/llm-configs`, createLLMConfigResponse, {
|
||||
body: parsedRequest.data,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export const llmConfigApiService = new LLMConfigApiService();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue