Skip to content

Commit

Permalink
fix: bring back file upload for multimodal models
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin committed Jan 1, 2025
1 parent 58ed2a6 commit 1f9fd9b
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions src/lib/components/chat/ChatInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -214,40 +214,40 @@
{/if}
</button>
</HoverTooltip>
{#if modelIsMultimodal || modelHasTools}
{@const mimeTypesString = mimeTypes
.map((m) => {
// if the mime type ends in *, grab the first part so image/* becomes image
if (m.endsWith("*")) {
return m.split("/")[0];
}
// otherwise, return the second part for example application/pdf becomes pdf
return m.split("/")[1];
})
.join(", ")}
<form class="flex items-center">
<HoverTooltip
label={`Upload ${mimeTypesString} files`}
position="top"
TooltipClassNames="text-xs !text-left !w-auto whitespace-nowrap !py-1 !mb-0 max-sm:hidden"
>
<label class="base-tool relative" class:active-tool={documentParserIsOn}>
<input
disabled={loading}
class="absolute hidden size-0"
aria-label="Upload file"
type="file"
on:change={onFileChange}
accept={mimeTypes.join(",")}
/>
<IconPaperclip classNames="text-xl" />
{#if documentParserIsOn}
Document Parser
{/if}
</label>
</HoverTooltip>
</form>
{/if}
{/if}
{#if modelIsMultimodal || modelHasTools}
{@const mimeTypesString = mimeTypes
.map((m) => {
// if the mime type ends in *, grab the first part so image/* becomes image
if (m.endsWith("*")) {
return m.split("/")[0];
}
// otherwise, return the second part for example application/pdf becomes pdf
return m.split("/")[1];
})
.join(", ")}
<form class="flex items-center">
<HoverTooltip
label={`Upload ${mimeTypesString} files`}
position="top"
TooltipClassNames="text-xs !text-left !w-auto whitespace-nowrap !py-1 !mb-0 max-sm:hidden"
>
<label class="base-tool relative" class:active-tool={documentParserIsOn}>
<input
disabled={loading}
class="absolute hidden size-0"
aria-label="Upload file"
type="file"
on:change={onFileChange}
accept={mimeTypes.join(",")}
/>
<IconPaperclip classNames="text-xl" />
{#if documentParserIsOn}
Document Parser
{/if}
</label>
</HoverTooltip>
</form>
{/if}
{#if modelHasTools}
{#each extraTools as tool}
Expand Down

0 comments on commit 1f9fd9b

Please sign in to comment.