feat(webui): add model settings runtime refresh
This commit is contained in:
+19
-1
@@ -1,4 +1,4 @@
|
||||
import type { ChatSummary } from "./types";
|
||||
import type { ChatSummary, SettingsPayload, SettingsUpdate } from "./types";
|
||||
|
||||
export class ApiError extends Error {
|
||||
status: number;
|
||||
@@ -104,3 +104,21 @@ export async function deleteSession(
|
||||
);
|
||||
return body.deleted;
|
||||
}
|
||||
|
||||
export async function fetchSettings(
|
||||
token: string,
|
||||
base: string = "",
|
||||
): Promise<SettingsPayload> {
|
||||
return request<SettingsPayload>(`${base}/api/settings`, token);
|
||||
}
|
||||
|
||||
export async function updateSettings(
|
||||
token: string,
|
||||
update: SettingsUpdate,
|
||||
base: string = "",
|
||||
): Promise<SettingsPayload> {
|
||||
const query = new URLSearchParams();
|
||||
if (update.model !== undefined) query.set("model", update.model);
|
||||
if (update.provider !== undefined) query.set("provider", update.provider);
|
||||
return request<SettingsPayload>(`${base}/api/settings/update?${query}`, token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user