mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
feat: add updateLLMConfig method to llm-config API service
This commit is contained in:
parent
6b1805bde4
commit
caec63f338
1 changed files with 20 additions and 0 deletions
|
|
@ -96,6 +96,26 @@ class LLMConfigApiService {
|
|||
|
||||
return baseApiService.get(`/api/v1/llm-configs/${request.id}`, getLLMConfigResponse);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update an existing LLM configuration
|
||||
*/
|
||||
updateLLMConfig = async (request: UpdateLLMConfigRequest) => {
|
||||
const parsedRequest = updateLLMConfigRequest.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}`);
|
||||
}
|
||||
|
||||
const { id, data } = parsedRequest.data;
|
||||
|
||||
return baseApiService.put(`/api/v1/llm-configs/${id}`, updateLLMConfigResponse, {
|
||||
body: data,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export const llmConfigApiService = new LLMConfigApiService();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue