mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-17 23:52:29 +00:00
refac
This commit is contained in:
parent
dc98e3023f
commit
cc5479d16d
1 changed files with 19 additions and 11 deletions
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
import ModelEditor from '$lib/components/workspace/Models/ModelEditor.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
const i18n = getContext<any>('i18n');
|
||||
|
||||
const onSubmit = async (modelInfo) => {
|
||||
if ($models.find((m) => m.id === modelInfo.id)) {
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
{ modelId: modelInfo.id }
|
||||
)
|
||||
);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (modelInfo.id === '') {
|
||||
toast.error($i18n.t('Error: Model ID cannot be empty. Please enter a valid ID to proceed.'));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (modelInfo) {
|
||||
|
|
@ -49,16 +49,24 @@
|
|||
});
|
||||
|
||||
if (res) {
|
||||
await models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connections && ($settings?.directConnections ?? null)
|
||||
)
|
||||
);
|
||||
toast.success($i18n.t('Model created successfully!'));
|
||||
await goto('/workspace/models');
|
||||
try {
|
||||
await models.set(
|
||||
await getModels(
|
||||
localStorage.token,
|
||||
$config?.features?.enable_direct_connections
|
||||
? ($settings?.directConnections ?? null)
|
||||
: null
|
||||
)
|
||||
);
|
||||
toast.success($i18n.t('Model created successfully!'));
|
||||
await goto('/workspace/models');
|
||||
} catch (error: any) {
|
||||
toast.error(`${error?.message ?? error}`);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
let model = null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue