refac
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import { getModels, getTaskConfig, updateTaskConfig } from '$lib/apis';
|
import { getModels, getTaskConfig, updateTaskConfig } from '$lib/apis';
|
||||||
import { config, settings } from '$lib/stores';
|
import { config, settings } from '$lib/stores';
|
||||||
import { createEventDispatcher, onMount, getContext } from 'svelte';
|
import { createEventDispatcher, onMount, getContext } from 'svelte';
|
||||||
|
import { toast } from 'svelte-sonner';
|
||||||
|
|
||||||
import { getBaseModels } from '$lib/apis/models';
|
import { getBaseModels } from '$lib/apis/models';
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
let models = null;
|
let models = null;
|
||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
|
try {
|
||||||
taskConfig = await getTaskConfig(localStorage.token);
|
taskConfig = await getTaskConfig(localStorage.token);
|
||||||
|
|
||||||
workspaceModels = await getBaseModels(localStorage.token);
|
workspaceModels = await getBaseModels(localStorage.token);
|
||||||
@@ -69,6 +71,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.debug('models', models);
|
console.debug('models', models);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to initialize Interface settings:', err);
|
||||||
|
toast.error(
|
||||||
|
err?.detail ?? err?.message ?? $i18n.t('Failed to load Interface settings')
|
||||||
|
);
|
||||||
|
models = [];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user