Skip to content

Commit

Permalink
fix: upload of files on multimodal assistant on first message (#1513)
Browse files Browse the repository at this point in the history
there was a bug that prevented users from uploading images to assistants before starting a conversation
  • Loading branch information
nsarrazin authored Oct 11, 2024
1 parent 6451bee commit 341e632
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 2 additions & 9 deletions src/lib/components/chat/ChatIntroduction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@
import AnnouncementBanner from "../AnnouncementBanner.svelte";
import type { Model } from "$lib/types/Model";
import ModelCardMetadata from "../ModelCardMetadata.svelte";
import { findCurrentModel } from "$lib/utils/models";
import { base } from "$app/paths";
import { useSettingsStore } from "$lib/stores/settings";
import JSON5 from "json5";
export let currentModel: Model;
export let models: Model[];
const settings = useSettingsStore();
$: currentModelMetadata = findCurrentModel(models, $settings.activeModel);
const announcementBanners = envPublic.PUBLIC_ANNOUNCEMENT_BANNERS
? JSON5.parse(envPublic.PUBLIC_ANNOUNCEMENT_BANNERS)
Expand Down Expand Up @@ -79,11 +72,11 @@
<ModelCardMetadata variant="dark" model={currentModel} />
</div>
</div>
{#if currentModelMetadata.promptExamples}
{#if currentModel.promptExamples}
<div class="lg:col-span-3 lg:mt-6">
<p class="mb-3 text-gray-600 dark:text-gray-300">Examples</p>
<div class="grid gap-3 lg:grid-cols-3 lg:gap-5">
{#each currentModelMetadata.promptExamples as example}
{#each currentModel.promptExamples as example}
<button
type="button"
class="rounded-xl border bg-gray-50 p-3 text-gray-600 hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 max-xl:text-sm xl:p-3.5"
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/chat/ChatWindow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@
/>
{:else if !assistant}
<ChatIntroduction
{models}
{currentModel}
on:message={(ev) => {
if ($page.data.loginRequired) {
Expand Down
9 changes: 8 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
const query = $page.url.searchParams.get("q");
if (query) createConversation(query);
});
$: currentModel = findCurrentModel(
[...data.models, ...data.oldModels],
!$settings.assistants.includes($settings.activeModel)
? $settings.activeModel
: data.assistant?.modelId
);
</script>

<svelte:head>
Expand All @@ -88,7 +95,7 @@
on:message={(ev) => createConversation(ev.detail)}
{loading}
assistant={data.assistant}
currentModel={findCurrentModel([...data.models, ...data.oldModels], $settings.activeModel)}
{currentModel}
models={data.models}
bind:files
/>

0 comments on commit 341e632

Please sign in to comment.