mirror of
https://github.com/open-webui/open-webui
synced 2025-05-18 12:21:36 +00:00
refac
This commit is contained in:
parent
afe92fd227
commit
153413dc54
@ -101,6 +101,17 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateDirectAPIHandler = async () => {
|
||||||
|
const res = await setDirectApiConfig(localStorage.token, directApiConfig).catch((error) => {
|
||||||
|
toast.error(`${error}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
toast.success($i18n.t('Direct API settings updated'));
|
||||||
|
await models.set(await getModels());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const addOpenAIConnectionHandler = async (connection) => {
|
const addOpenAIConnectionHandler = async (connection) => {
|
||||||
OPENAI_API_BASE_URLS = [...OPENAI_API_BASE_URLS, connection.url];
|
OPENAI_API_BASE_URLS = [...OPENAI_API_BASE_URLS, connection.url];
|
||||||
OPENAI_API_KEYS = [...OPENAI_API_KEYS, connection.key];
|
OPENAI_API_KEYS = [...OPENAI_API_KEYS, connection.key];
|
||||||
@ -180,8 +191,7 @@
|
|||||||
const submitHandler = async () => {
|
const submitHandler = async () => {
|
||||||
updateOpenAIHandler();
|
updateOpenAIHandler();
|
||||||
updateOllamaHandler();
|
updateOllamaHandler();
|
||||||
|
updateDirectAPIHandler();
|
||||||
setDirectApiConfig(localStorage.token, directApiConfig);
|
|
||||||
|
|
||||||
dispatch('save');
|
dispatch('save');
|
||||||
};
|
};
|
||||||
@ -353,7 +363,7 @@
|
|||||||
<Switch
|
<Switch
|
||||||
bind:state={directApiConfig.ENABLE_DIRECT_API}
|
bind:state={directApiConfig.ENABLE_DIRECT_API}
|
||||||
on:change={async () => {
|
on:change={async () => {
|
||||||
updateOpenAIHandler();
|
updateDirectAPIHandler();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user