Spaces:
Running
Running
quick fix file input
Browse files
src/lib/components/chat/ChatInput.svelte
CHANGED
@@ -147,43 +147,6 @@
|
|
147 |
class="scrollbar-custom -ml-0.5 flex max-w-[calc(100%-40px)] flex-wrap items-center justify-start gap-2 sm:gap-2.5 px-3 pb-2.5 pt-0.5
|
148 |
text-gray-500 dark:text-gray-400 max-md:flex-nowrap max-md:overflow-x-auto"
|
149 |
>
|
150 |
-
{#if modelIsMultimodal || modelHasTools}
|
151 |
-
{@const mimeTypesString = mimeTypes
|
152 |
-
.map((m) => {
|
153 |
-
// if the mime type ends in *, grab the first part so image/* becomes image
|
154 |
-
if (m.endsWith("*")) {
|
155 |
-
return m.split("/")[0];
|
156 |
-
}
|
157 |
-
// otherwise, return the second part for example application/pdf becomes pdf
|
158 |
-
return m.split("/")[1];
|
159 |
-
})
|
160 |
-
.join(", ")}
|
161 |
-
<form class="flex items-center">
|
162 |
-
<HoverTooltip
|
163 |
-
label={`Upload ${mimeTypesString} files`}
|
164 |
-
position="top"
|
165 |
-
TooltipClassNames="text-xs !text-left !w-auto whitespace-nowrap !py-1 !mb-0 max-sm:hidden"
|
166 |
-
>
|
167 |
-
<button
|
168 |
-
class="base-tool relative"
|
169 |
-
class:active-tool={documentParserIsOn}
|
170 |
-
disabled={loading}
|
171 |
-
>
|
172 |
-
<input
|
173 |
-
class="absolute w-full cursor-pointer opacity-0"
|
174 |
-
aria-label="Upload file"
|
175 |
-
type="file"
|
176 |
-
on:change={onFileChange}
|
177 |
-
accept={mimeTypes.join(",")}
|
178 |
-
/>
|
179 |
-
<IconPaperclip classNames="text-xl" />
|
180 |
-
{#if documentParserIsOn}
|
181 |
-
Document Parser
|
182 |
-
{/if}
|
183 |
-
</button>
|
184 |
-
</HoverTooltip>
|
185 |
-
</form>
|
186 |
-
{/if}
|
187 |
<HoverTooltip
|
188 |
label="Search the web"
|
189 |
position="top"
|
@@ -251,6 +214,43 @@
|
|
251 |
{/if}
|
252 |
</button>
|
253 |
</HoverTooltip>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
{/if}
|
255 |
{#if modelHasTools}
|
256 |
{#each extraTools as tool}
|
|
|
147 |
class="scrollbar-custom -ml-0.5 flex max-w-[calc(100%-40px)] flex-wrap items-center justify-start gap-2 sm:gap-2.5 px-3 pb-2.5 pt-0.5
|
148 |
text-gray-500 dark:text-gray-400 max-md:flex-nowrap max-md:overflow-x-auto"
|
149 |
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
<HoverTooltip
|
151 |
label="Search the web"
|
152 |
position="top"
|
|
|
214 |
{/if}
|
215 |
</button>
|
216 |
</HoverTooltip>
|
217 |
+
{#if modelIsMultimodal || modelHasTools}
|
218 |
+
{@const mimeTypesString = mimeTypes
|
219 |
+
.map((m) => {
|
220 |
+
// if the mime type ends in *, grab the first part so image/* becomes image
|
221 |
+
if (m.endsWith("*")) {
|
222 |
+
return m.split("/")[0];
|
223 |
+
}
|
224 |
+
// otherwise, return the second part for example application/pdf becomes pdf
|
225 |
+
return m.split("/")[1];
|
226 |
+
})
|
227 |
+
.join(", ")}
|
228 |
+
<form class="flex items-center">
|
229 |
+
<HoverTooltip
|
230 |
+
label={`Upload ${mimeTypesString} files`}
|
231 |
+
position="top"
|
232 |
+
TooltipClassNames="text-xs !text-left !w-auto whitespace-nowrap !py-1 !mb-0 max-sm:hidden"
|
233 |
+
>
|
234 |
+
<label
|
235 |
+
class="base-tool relative"
|
236 |
+
class:active-tool={documentParserIsOn}
|
237 |
+
>
|
238 |
+
<input
|
239 |
+
disabled={loading}
|
240 |
+
class="absolute size-0 hidden"
|
241 |
+
aria-label="Upload file"
|
242 |
+
type="file"
|
243 |
+
on:change={onFileChange}
|
244 |
+
accept={mimeTypes.join(",")}
|
245 |
+
/>
|
246 |
+
<IconPaperclip classNames="text-xl" />
|
247 |
+
{#if documentParserIsOn}
|
248 |
+
Document Parser
|
249 |
+
{/if}
|
250 |
+
</label>
|
251 |
+
</HoverTooltip>
|
252 |
+
</form>
|
253 |
+
{/if}
|
254 |
{/if}
|
255 |
{#if modelHasTools}
|
256 |
{#each extraTools as tool}
|