Spaces:
Runtime error
Runtime error
feat: put file upload icon first so its always visible and make tools scrollable on mobile
Browse files
src/lib/components/chat/ChatInput.svelte
CHANGED
|
@@ -142,8 +142,46 @@
|
|
| 142 |
</div>
|
| 143 |
{#if !assistant}
|
| 144 |
<div
|
| 145 |
-
class="-ml-0.5 flex flex-wrap items-center justify-start gap-2.5 px-3 pb-2.5
|
|
|
|
| 146 |
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
<HoverTooltip
|
| 148 |
label="Search the web"
|
| 149 |
position="top"
|
|
@@ -226,43 +264,6 @@
|
|
| 226 |
</button>
|
| 227 |
{/each}
|
| 228 |
{/if}
|
| 229 |
-
{#if modelIsMultimodal || modelHasTools}
|
| 230 |
-
{@const mimeTypesString = mimeTypes
|
| 231 |
-
.map((m) => {
|
| 232 |
-
// if the mime type ends in *, grab the first part so image/* becomes image
|
| 233 |
-
if (m.endsWith("*")) {
|
| 234 |
-
return m.split("/")[0];
|
| 235 |
-
}
|
| 236 |
-
// otherwise, return the second part for example application/pdf becomes pdf
|
| 237 |
-
return m.split("/")[1];
|
| 238 |
-
})
|
| 239 |
-
.join(", ")}
|
| 240 |
-
<form class="flex items-center">
|
| 241 |
-
<HoverTooltip
|
| 242 |
-
label={`Upload ${mimeTypesString} files`}
|
| 243 |
-
position="top"
|
| 244 |
-
TooltipClassNames="text-xs !text-left !w-auto whitespace-nowrap !py-1 !mb-0 max-sm:hidden"
|
| 245 |
-
>
|
| 246 |
-
<button
|
| 247 |
-
class="base-tool relative"
|
| 248 |
-
class:active-tool={documentParserIsOn}
|
| 249 |
-
disabled={loading}
|
| 250 |
-
>
|
| 251 |
-
<input
|
| 252 |
-
class="absolute w-full cursor-pointer opacity-0"
|
| 253 |
-
aria-label="Upload file"
|
| 254 |
-
type="file"
|
| 255 |
-
on:change={onFileChange}
|
| 256 |
-
accept={mimeTypes.join(",")}
|
| 257 |
-
/>
|
| 258 |
-
<IconPaperclip classNames="text-xl" />
|
| 259 |
-
{#if documentParserIsOn}
|
| 260 |
-
Document Parser
|
| 261 |
-
{/if}
|
| 262 |
-
</button>
|
| 263 |
-
</HoverTooltip>
|
| 264 |
-
</form>
|
| 265 |
-
{/if}
|
| 266 |
{#if modelHasTools}
|
| 267 |
<HoverTooltip
|
| 268 |
label="Browse more tools"
|
|
|
|
| 142 |
</div>
|
| 143 |
{#if !assistant}
|
| 144 |
<div
|
| 145 |
+
class="scrollbar-custom -ml-0.5 flex max-w-[90dvw] flex-wrap items-center justify-start gap-2.5 px-3 pb-2.5
|
| 146 |
+
text-gray-500 dark:text-gray-400 max-md:flex-nowrap max-md:overflow-x-auto"
|
| 147 |
>
|
| 148 |
+
{#if modelIsMultimodal || modelHasTools}
|
| 149 |
+
{@const mimeTypesString = mimeTypes
|
| 150 |
+
.map((m) => {
|
| 151 |
+
// if the mime type ends in *, grab the first part so image/* becomes image
|
| 152 |
+
if (m.endsWith("*")) {
|
| 153 |
+
return m.split("/")[0];
|
| 154 |
+
}
|
| 155 |
+
// otherwise, return the second part for example application/pdf becomes pdf
|
| 156 |
+
return m.split("/")[1];
|
| 157 |
+
})
|
| 158 |
+
.join(", ")}
|
| 159 |
+
<form class="flex items-center">
|
| 160 |
+
<HoverTooltip
|
| 161 |
+
label={`Upload ${mimeTypesString} files`}
|
| 162 |
+
position="top"
|
| 163 |
+
TooltipClassNames="text-xs !text-left !w-auto whitespace-nowrap !py-1 !mb-0 max-sm:hidden"
|
| 164 |
+
>
|
| 165 |
+
<button
|
| 166 |
+
class="base-tool relative"
|
| 167 |
+
class:active-tool={documentParserIsOn}
|
| 168 |
+
disabled={loading}
|
| 169 |
+
>
|
| 170 |
+
<input
|
| 171 |
+
class="absolute w-full cursor-pointer opacity-0"
|
| 172 |
+
aria-label="Upload file"
|
| 173 |
+
type="file"
|
| 174 |
+
on:change={onFileChange}
|
| 175 |
+
accept={mimeTypes.join(",")}
|
| 176 |
+
/>
|
| 177 |
+
<IconPaperclip classNames="text-xl" />
|
| 178 |
+
{#if documentParserIsOn}
|
| 179 |
+
Document Parser
|
| 180 |
+
{/if}
|
| 181 |
+
</button>
|
| 182 |
+
</HoverTooltip>
|
| 183 |
+
</form>
|
| 184 |
+
{/if}
|
| 185 |
<HoverTooltip
|
| 186 |
label="Search the web"
|
| 187 |
position="top"
|
|
|
|
| 264 |
</button>
|
| 265 |
{/each}
|
| 266 |
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
{#if modelHasTools}
|
| 268 |
<HoverTooltip
|
| 269 |
label="Browse more tools"
|