This commit is contained in:
Timothy Jaeryang Baek 2024-11-16 21:00:20 -08:00
parent 19a23a5b7d
commit 79fbab7341
4 changed files with 13 additions and 5 deletions

View File

@ -34,7 +34,8 @@
mobile, mobile,
showOverview, showOverview,
chatTitle, chatTitle,
showArtifacts showArtifacts,
tools
} from '$lib/stores'; } from '$lib/stores';
import { import {
convertMessagesToHistory, convertMessagesToHistory,
@ -78,6 +79,7 @@
import ChatControls from './ChatControls.svelte'; import ChatControls from './ChatControls.svelte';
import EventConfirmDialog from '../common/ConfirmDialog.svelte'; import EventConfirmDialog from '../common/ConfirmDialog.svelte';
import Placeholder from './Placeholder.svelte'; import Placeholder from './Placeholder.svelte';
import { getTools } from '$lib/apis/tools';
export let chatIdProp = ''; export let chatIdProp = '';
@ -158,12 +160,18 @@
} }
const setToolIds = async () => { const setToolIds = async () => {
if (!$tools) {
tools.set(await getTools(localStorage.token));
}
if (selectedModels.length !== 1) { if (selectedModels.length !== 1) {
return; return;
} }
const model = $models.find((m) => m.id === selectedModels[0]); const model = $models.find((m) => m.id === selectedModels[0]);
if (model) { if (model) {
selectedToolIds = model?.info?.meta?.toolIds ?? []; selectedToolIds = (model?.info?.meta?.toolIds ?? []).filter((id) =>
$tools.find((t) => t.id === id)
);
} }
}; };

View File

@ -632,7 +632,7 @@
showAccessControlModal = true; showAccessControlModal = true;
}} }}
> >
<LockClosed strokeWidth="2.5" /> <LockClosed strokeWidth="2.5" className="size-3.5" />
<div class="text-sm font-medium flex-shrink-0"> <div class="text-sm font-medium flex-shrink-0">
{$i18n.t('Share')} {$i18n.t('Share')}

View File

@ -104,7 +104,7 @@
showAccessControlModal = true; showAccessControlModal = true;
}} }}
> >
<LockClosed strokeWidth="2.5" /> <LockClosed strokeWidth="2.5" className="size-3.5" />
<div class="text-sm font-medium flex-shrink-0"> <div class="text-sm font-medium flex-shrink-0">
{$i18n.t('Share')} {$i18n.t('Share')}

View File

@ -231,7 +231,7 @@ class Tools:
showAccessControlModal = true; showAccessControlModal = true;
}} }}
> >
<LockClosed strokeWidth="2.5" /> <LockClosed strokeWidth="2.5" className="size-3.5" />
<div class="text-sm font-medium flex-shrink-0"> <div class="text-sm font-medium flex-shrink-0">
{$i18n.t('Share')} {$i18n.t('Share')}