{$i18n.t('Models')} | {$WEBUI_NAME} {#if loaded} { deleteModelHandler(selectedModel); }} />
{$i18n.t('Models')}
{filteredModels.length}
{#each filteredModels as model}
{$i18n.t('By {{name}}', { name: capitalizeFirstLetter( model?.user?.name ?? model?.user?.email ?? $i18n.t('Deleted User') ) })}
{#if shiftKey} {:else} {#if $user?.role === 'admin' || model.user_id === $user?.id} {/if} { shareModelHandler(model); }} cloneHandler={() => { cloneModelHandler(model); }} exportHandler={() => { exportModelHandler(model); }} hideHandler={() => { hideModelHandler(model); }} deleteHandler={() => { selectedModel = model; showModelDeleteConfirm = true; }} onClose={() => {}} >
{ toggleModelById(localStorage.token, model.id); _models.set(await getModels(localStorage.token)); }} />
{/if}
{/each}
{#if $user?.role === 'admin'}
{ console.log(importFiles); let reader = new FileReader(); reader.onload = async (event) => { let savedModels = JSON.parse(event.target.result); console.log(savedModels); for (const model of savedModels) { if (model?.info ?? false) { if ($_models.find((m) => m.id === model.id)) { await updateModelById(localStorage.token, model.id, model.info).catch( (error) => { return null; } ); } else { await createNewModel(localStorage.token, model.info).catch((error) => { return null; }); } } } await _models.set(await getModels(localStorage.token)); models = await getWorkspaceModels(localStorage.token); }; reader.readAsText(importFiles[0]); }} />
{/if} {#if $config?.features.enable_community_sharing} {/if} {:else}
{/if}