Spaces:
Paused
Paused
Misc tools release (#1192)
Browse files* hide details triangle on safari
* image size in chatmessage
* truncate file name
* fix a spacing
src/lib/components/OpenWebSearchResults.svelte
CHANGED
|
@@ -83,7 +83,7 @@
|
|
| 83 |
</h3>
|
| 84 |
</div>
|
| 85 |
{#if message.args}
|
| 86 |
-
<p class="mt-
|
| 87 |
{message.args}
|
| 88 |
</p>
|
| 89 |
{/if}
|
|
@@ -99,7 +99,7 @@
|
|
| 99 |
</h3>
|
| 100 |
</div>
|
| 101 |
{#if message.args}
|
| 102 |
-
<p class="mt-
|
| 103 |
{message.args}
|
| 104 |
</p>
|
| 105 |
{/if}
|
|
|
|
| 83 |
</h3>
|
| 84 |
</div>
|
| 85 |
{#if message.args}
|
| 86 |
+
<p class="mt-0.5 pl-4 text-gray-500 dark:text-gray-400">
|
| 87 |
{message.args}
|
| 88 |
</p>
|
| 89 |
{/if}
|
|
|
|
| 99 |
</h3>
|
| 100 |
</div>
|
| 101 |
{#if message.args}
|
| 102 |
+
<p class="mt-0.5 pl-4 text-gray-500 dark:text-gray-400">
|
| 103 |
{message.args}
|
| 104 |
</p>
|
| 105 |
{/if}
|
src/lib/components/ToolsMenu.svelte
CHANGED
|
@@ -73,3 +73,9 @@
|
|
| 73 |
</div>
|
| 74 |
</div>
|
| 75 |
</details>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
</div>
|
| 74 |
</div>
|
| 75 |
</details>
|
| 76 |
+
|
| 77 |
+
<style>
|
| 78 |
+
details summary::-webkit-details-marker {
|
| 79 |
+
display: none;
|
| 80 |
+
}
|
| 81 |
+
</style>
|
src/lib/components/chat/ChatMessage.svelte
CHANGED
|
@@ -277,14 +277,14 @@
|
|
| 277 |
<img
|
| 278 |
src={urlNotTrailing + "/output/" + file.value}
|
| 279 |
alt="output from assistant"
|
| 280 |
-
class="my-2 aspect-auto max-h-48 cursor-pointer rounded-lg shadow-lg"
|
| 281 |
/>
|
| 282 |
{:else}
|
| 283 |
<!-- handle the case where this is a base64 encoded image -->
|
| 284 |
<img
|
| 285 |
src={`data:${file.mime};base64,${file.value}`}
|
| 286 |
alt="output from assistant"
|
| 287 |
-
class="my-2 aspect-auto max-h-48 cursor-pointer rounded-lg shadow-lg"
|
| 288 |
/>
|
| 289 |
{/if}
|
| 290 |
</button>
|
|
|
|
| 277 |
<img
|
| 278 |
src={urlNotTrailing + "/output/" + file.value}
|
| 279 |
alt="output from assistant"
|
| 280 |
+
class="my-2 aspect-auto max-h-48 cursor-pointer rounded-lg shadow-lg xl:max-h-56"
|
| 281 |
/>
|
| 282 |
{:else}
|
| 283 |
<!-- handle the case where this is a base64 encoded image -->
|
| 284 |
<img
|
| 285 |
src={`data:${file.mime};base64,${file.value}`}
|
| 286 |
alt="output from assistant"
|
| 287 |
+
class="my-2 aspect-auto max-h-48 cursor-pointer rounded-lg shadow-lg xl:max-h-56"
|
| 288 |
/>
|
| 289 |
{/if}
|
| 290 |
</button>
|
src/lib/components/chat/UploadedFile.svelte
CHANGED
|
@@ -8,6 +8,18 @@
|
|
| 8 |
export let file: MessageFile;
|
| 9 |
export let canClose = true;
|
| 10 |
const dispatch = createEventDispatcher<{ close: void }>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
</script>
|
| 12 |
|
| 13 |
<div
|
|
@@ -36,7 +48,7 @@
|
|
| 36 |
</div>
|
| 37 |
<dl class="flex flex-col truncate leading-tight">
|
| 38 |
<dd class="text-sm">
|
| 39 |
-
{file.name}
|
| 40 |
</dd>
|
| 41 |
<dt class="text-xs text-gray-400">{file.mime.split("/")[1].toUpperCase()}</dt>
|
| 42 |
</dl>
|
|
|
|
| 8 |
export let file: MessageFile;
|
| 9 |
export let canClose = true;
|
| 10 |
const dispatch = createEventDispatcher<{ close: void }>();
|
| 11 |
+
|
| 12 |
+
function truncateMiddle(text: string, maxLength: number): string {
|
| 13 |
+
if (text.length <= maxLength) {
|
| 14 |
+
return text;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const halfLength = Math.floor((maxLength - 1) / 2);
|
| 18 |
+
const start = text.substring(0, halfLength);
|
| 19 |
+
const end = text.substring(text.length - halfLength);
|
| 20 |
+
|
| 21 |
+
return `${start}…${end}`;
|
| 22 |
+
}
|
| 23 |
</script>
|
| 24 |
|
| 25 |
<div
|
|
|
|
| 48 |
</div>
|
| 49 |
<dl class="flex flex-col truncate leading-tight">
|
| 50 |
<dd class="text-sm">
|
| 51 |
+
{truncateMiddle(file.name, 28)}
|
| 52 |
</dd>
|
| 53 |
<dt class="text-xs text-gray-400">{file.mime.split("/")[1].toUpperCase()}</dt>
|
| 54 |
</dl>
|