This commit is contained in:
Timothy Jaeryang Baek committed 2026-06-29 03:33:49 -05:00
1 parent ed2d7d4acd
commit 9802b0d135
4 files changed
+66 -34

No files matched your search

+49 -30
View File
@@ -469,40 +469,62 @@
let user = null;
export let placeholder = '';
let visionCapableModels = [];
$: visionCapableModels = (atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).filter(
(model) => $models.find((m) => m.id === model)?.info?.meta?.capabilities?.vision ?? true
type ModelCapability =
| 'vision'
| 'file_upload'
| 'web_search'
| 'image_generation'
| 'code_interpreter'
| 'terminal';
type ModelCapabilitiesById = Record<string, Partial<Record<ModelCapability, boolean>>>;
let modelCapabilitiesById: ModelCapabilitiesById = {};
$: modelCapabilitiesById = Object.fromEntries(
($models ?? []).map((model) => [model.id, model.info?.meta?.capabilities ?? {}])
);
const getCapableModelIds = (
modelIds: string[],
capability: ModelCapability,
capabilitiesById: ModelCapabilitiesById
) => modelIds.filter((id) => capabilitiesById[id]?.[capability] ?? true);
let visionCapableModels = [];
$: visionCapableModels = getCapableModelIds(selectedModelIds, 'vision', modelCapabilitiesById);
let fileUploadCapableModels = [];
$: fileUploadCapableModels = (atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).filter(
(model) => $models.find((m) => m.id === model)?.info?.meta?.capabilities?.file_upload ?? true
$: fileUploadCapableModels = getCapableModelIds(
selectedModelIds,
'file_upload',
modelCapabilitiesById
);
let webSearchCapableModels = [];
$: webSearchCapableModels = (atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).filter(
(model) => $models.find((m) => m.id === model)?.info?.meta?.capabilities?.web_search ?? true
$: webSearchCapableModels = getCapableModelIds(
selectedModelIds,
'web_search',
modelCapabilitiesById
);
let imageGenerationCapableModels = [];
$: imageGenerationCapableModels = (
atSelectedModel?.id ? [atSelectedModel.id] : selectedModels
).filter(
(model) =>
$models.find((m) => m.id === model)?.info?.meta?.capabilities?.image_generation ?? true
$: imageGenerationCapableModels = getCapableModelIds(
selectedModelIds,
'image_generation',
modelCapabilitiesById
);
let codeInterpreterCapableModels = [];
$: codeInterpreterCapableModels = (
atSelectedModel?.id ? [atSelectedModel.id] : selectedModels
).filter(
(model) =>
$models.find((m) => m.id === model)?.info?.meta?.capabilities?.code_interpreter ?? true
$: codeInterpreterCapableModels = getCapableModelIds(
selectedModelIds,
'code_interpreter',
modelCapabilitiesById
);
let terminalCapableModels = [];
$: terminalCapableModels = (atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).filter(
(model) => $models.find((m) => m.id === model)?.info?.meta?.capabilities?.terminal ?? true
$: terminalCapableModels = getCapableModelIds(
selectedModelIds,
'terminal',
modelCapabilitiesById
);
let toggleFilters = [];
@@ -518,23 +540,20 @@
let showWebSearchButton = false;
$: showWebSearchButton =
(atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).length ===
webSearchCapableModels.length &&
selectedModelIds.length === webSearchCapableModels.length &&
$config?.features?.enable_web_search &&
($_user.role === 'admin' || $_user?.permissions?.features?.web_search);
let showImageGenerationButton = false;
$: showImageGenerationButton =
(atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).length ===
imageGenerationCapableModels.length &&
selectedModelIds.length === imageGenerationCapableModels.length &&
$config?.features?.enable_image_generation &&
($_user.role === 'admin' || $_user?.permissions?.features?.image_generation);
let showCodeInterpreterButton = false;
$: showCodeInterpreterButton =
!$selectedTerminalId &&
(atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).length ===
codeInterpreterCapableModels.length &&
selectedModelIds.length === codeInterpreterCapableModels.length &&
$config?.features?.enable_code_interpreter &&
($_user.role === 'admin' || $_user?.permissions?.features?.code_interpreter);
@@ -600,7 +619,7 @@
return null;
}
if (fileUploadCapableModels.length !== selectedModels.length) {
if (fileUploadCapableModels.length !== selectedModelIds.length) {
toast.error($i18n.t('Model(s) do not support file upload'));
return null;
}
@@ -1340,11 +1359,11 @@
alt=""
imageClassName=" size-10 rounded-xl object-cover"
/>
{#if atSelectedModel ? visionCapableModels.length === 0 : selectedModels.length !== visionCapableModels.length}
{#if selectedModelIds.length !== visionCapableModels.length}
<Tooltip
className=" absolute top-1 left-1"
content={$i18n.t('{{ models }}', {
models: [...(atSelectedModel ? [atSelectedModel] : selectedModels)]
models: selectedModelIds
.filter((id) => !visionCapableModels.includes(id))
.join(', ')
})}
@@ -1617,7 +1636,7 @@
<div class="ml-1 self-end flex items-center flex-1 max-w-[80%]">
<InputMenu
bind:files
selectedModels={atSelectedModel ? [atSelectedModel.id] : selectedModels}
selectedModels={selectedModelIds}
{fileUploadCapableModels}
{screenCaptureHandler}
{inputFilesHandler}
@@ -1683,7 +1702,7 @@
/>
<IntegrationsMenu
selectedModels={atSelectedModel ? [atSelectedModel.id] : selectedModels}
selectedModels={selectedModelIds}
{toggleFilters}
{showWebSearchButton}
{showImageGenerationButton}
@@ -19,6 +19,7 @@
export let allChatsLoaded = false;
export let loadHandler: Function = null;
export let showOwnerInfo = false;
let chatList = null;
@@ -163,12 +164,12 @@
{dayjs(chat?.updated_at * 1000).calendar()}
</div>
{#if chat.user_id && chat.owner_name}
{#if showOwnerInfo && chat.user_id && chat.owner_name}
<Tooltip content={chat.owner_name}>
<img
src="/api/v1/users/{chat.user_id}/profile/image"
alt=""
class="size-5 rounded-full shrink-0 object-cover"
class="size-4 rounded-full shrink-0 object-cover"
/>
</Tooltip>
{/if}
@@ -24,6 +24,12 @@
let chatListLoading = false;
let allChatsLoaded = false;
$: showOwnerInfo = Boolean(
folder?.shared ||
(folder?.user_id && folder.user_id !== $user?.id) ||
(folder?.access_grants?.length ?? 0) > 0
);
const loadChats = async () => {
// getSharedFolderChats returns all users' chats in one shot; no pagination
allChatsLoaded = true;
@@ -96,7 +102,13 @@
<FolderKnowledge />
{:else if selectedTab === 'chats'}
{#if chats !== null}
<ChatList {chats} {chatListLoading} {allChatsLoaded} loadHandler={loadChats} />
<ChatList
{chats}
{chatListLoading}
{allChatsLoaded}
loadHandler={loadChats}
{showOwnerInfo}
/>
{:else}
<div class="py-10">
<Spinner />
@@ -540,7 +540,7 @@
<img
src="/api/v1/users/{ownerUserId}/profile/image"
alt=""
class="size-4 rounded-full shrink-0 object-cover mr-1.5"
class="size-3.5 rounded-full shrink-0 object-cover mr-1.5"
/>
</Tooltip>
{/if}