feat(webui): show resolved Auto API in preset selector
This commit is contained in:
1 parent
994ce51502
commit
73a27e0726
28 files changed
+464
-259
No files matched your search
@@ -3,6 +3,7 @@ import type {
|
||||
AutomationChatsPayload,
|
||||
AutomationChatUpdate,
|
||||
AutomationsPayload,
|
||||
AutomaticModelAPIPayload,
|
||||
AutomationUpdatePayload,
|
||||
ChannelConfigurePayload,
|
||||
ChannelConnectPayload,
|
||||
@@ -1045,6 +1046,27 @@ export async function cancelMcpOAuth(
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchAutomaticModelAPI(
|
||||
token: string,
|
||||
provider: string,
|
||||
model: string,
|
||||
reasoningEffort: string,
|
||||
base: string = "",
|
||||
): Promise<AutomaticModelAPIPayload> {
|
||||
const query = new URLSearchParams({ provider, model, reasoning_effort: reasoningEffort });
|
||||
const payload = await request<unknown>(
|
||||
`${base}/api/settings/model-api?${query}`, token, undefined, API_READ_TIMEOUT_MS,
|
||||
);
|
||||
if (typeof payload !== "object" || payload === null) throw new Error("Invalid model API resolution");
|
||||
const result = payload as Record<string, unknown>;
|
||||
const api = result.api;
|
||||
if (typeof result.provider !== "string" || (
|
||||
api !== "chat_completions" && api !== "responses" && api !== "anthropic_messages"
|
||||
&& api !== "bedrock_converse" && api !== "transcription"
|
||||
)) throw new Error("Invalid model API resolution");
|
||||
return { provider: result.provider, api };
|
||||
}
|
||||
|
||||
export async function fetchProviderModels(
|
||||
token: string,
|
||||
provider: string,
|
||||
|
||||
Reference in new issue
Block a user