chore: format
This commit is contained in:
@@ -44,78 +44,78 @@
|
||||
</div>
|
||||
{/if}
|
||||
<div class="max-h-[22rem] overflow-y-scroll">
|
||||
{#if loading && (!chatList || chatList.length === 0)}
|
||||
<div class="flex justify-center py-8">
|
||||
<Spinner />
|
||||
</div>
|
||||
{:else if !chatList || chatList.length === 0}
|
||||
<div class="text-center text-gray-500 text-sm py-8">
|
||||
{$i18n.t(emptyMessage)}
|
||||
</div>
|
||||
{:else}
|
||||
{#each chatList as chat, idx (chat.id)}
|
||||
{#if chat.time_range && (idx === 0 || chat.time_range !== chatList[idx - 1]?.time_range)}
|
||||
<div
|
||||
class="w-full text-xs text-gray-500 dark:text-gray-500 font-medium {idx === 0
|
||||
? ''
|
||||
: 'pt-5'} pb-2 px-2"
|
||||
>
|
||||
{$i18n.t(chat.time_range)}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div
|
||||
class="w-full flex items-center rounded-lg text-sm py-2 px-3 hover:bg-gray-50 dark:hover:bg-gray-850"
|
||||
>
|
||||
{#if showUserInfo && chat.user_id}
|
||||
<div class="w-32 shrink-0 flex items-center gap-2">
|
||||
<img
|
||||
src="{WEBUI_API_BASE_URL}/users/{chat.user_id}/profile/image"
|
||||
alt={chat.user_name || 'User'}
|
||||
class="size-5 rounded-full object-cover shrink-0"
|
||||
/>
|
||||
<span class="text-xs text-gray-600 dark:text-gray-400 truncate"
|
||||
>{chat.user_name || 'Unknown'}</span
|
||||
>
|
||||
{#if loading && (!chatList || chatList.length === 0)}
|
||||
<div class="flex justify-center py-8">
|
||||
<Spinner />
|
||||
</div>
|
||||
{:else if !chatList || chatList.length === 0}
|
||||
<div class="text-center text-gray-500 text-sm py-8">
|
||||
{$i18n.t(emptyMessage)}
|
||||
</div>
|
||||
{:else}
|
||||
{#each chatList as chat, idx (chat.id)}
|
||||
{#if chat.time_range && (idx === 0 || chat.time_range !== chatList[idx - 1]?.time_range)}
|
||||
<div
|
||||
class="w-full text-xs text-gray-500 dark:text-gray-500 font-medium {idx === 0
|
||||
? ''
|
||||
: 'pt-5'} pb-2 px-2"
|
||||
>
|
||||
{$i18n.t(chat.time_range)}
|
||||
</div>
|
||||
{/if}
|
||||
<a
|
||||
class={showUserInfo ? 'flex-1' : 'basis-3/5'}
|
||||
href={shareUrl ? `/s/${chat.id}` : `/c/${chat.id}`}
|
||||
on:click={() => onChatClick?.(chat.id)}
|
||||
|
||||
<div
|
||||
class="w-full flex items-center rounded-lg text-sm py-2 px-3 hover:bg-gray-50 dark:hover:bg-gray-850"
|
||||
>
|
||||
<div class="text-ellipsis line-clamp-1 w-full">
|
||||
{chat.title}
|
||||
</div>
|
||||
</a>
|
||||
{#if showUserInfo && chat.user_id}
|
||||
<div class="w-32 shrink-0 flex items-center gap-2">
|
||||
<img
|
||||
src="{WEBUI_API_BASE_URL}/users/{chat.user_id}/profile/image"
|
||||
alt={chat.user_name || 'User'}
|
||||
class="size-5 rounded-full object-cover shrink-0"
|
||||
/>
|
||||
<span class="text-xs text-gray-600 dark:text-gray-400 truncate"
|
||||
>{chat.user_name || 'Unknown'}</span
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
<a
|
||||
class={showUserInfo ? 'flex-1' : 'basis-3/5'}
|
||||
href={shareUrl ? `/s/${chat.id}` : `/c/${chat.id}`}
|
||||
on:click={() => onChatClick?.(chat.id)}
|
||||
>
|
||||
<div class="text-ellipsis line-clamp-1 w-full">
|
||||
{chat.title}
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div class="{showUserInfo ? 'w-28' : 'basis-2/5'} flex items-center justify-end">
|
||||
<div class="hidden sm:flex text-gray-500 dark:text-gray-400 text-xs">
|
||||
{dayjs(chat.updated_at * 1000).calendar(null, {
|
||||
sameDay: '[Today] h:mm A',
|
||||
lastDay: '[Yesterday] h:mm A',
|
||||
lastWeek: 'MMM D',
|
||||
sameElse: 'MMM D, YYYY'
|
||||
})}
|
||||
<div class="{showUserInfo ? 'w-28' : 'basis-2/5'} flex items-center justify-end">
|
||||
<div class="hidden sm:flex text-gray-500 dark:text-gray-400 text-xs">
|
||||
{dayjs(chat.updated_at * 1000).calendar(null, {
|
||||
sameDay: '[Today] h:mm A',
|
||||
lastDay: '[Yesterday] h:mm A',
|
||||
lastWeek: 'MMM D',
|
||||
sameElse: 'MMM D, YYYY'
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
{/each}
|
||||
|
||||
{#if !allLoaded && onLoadMore}
|
||||
<Loader
|
||||
on:visible={() => {
|
||||
if (!loading) {
|
||||
onLoadMore();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="w-full flex justify-center py-1 text-xs animate-pulse items-center gap-2">
|
||||
<Spinner className="size-4" />
|
||||
<div>{$i18n.t('Loading...')}</div>
|
||||
</div>
|
||||
</Loader>
|
||||
{#if !allLoaded && onLoadMore}
|
||||
<Loader
|
||||
on:visible={() => {
|
||||
if (!loading) {
|
||||
onLoadMore();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="w-full flex justify-center py-1 text-xs animate-pulse items-center gap-2">
|
||||
<Spinner className="size-4" />
|
||||
<div>{$i18n.t('Loading...')}</div>
|
||||
</div>
|
||||
</Loader>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -60,60 +60,89 @@
|
||||
</script>
|
||||
|
||||
<div {id} class={className}>
|
||||
{#if title !== null}
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
{#if title !== null}
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="{buttonClassName} {disabled ? '' : 'cursor-pointer'}"
|
||||
on:pointerup={() => {
|
||||
if (!disabled) {
|
||||
open = !open;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="{buttonClassName} {disabled ? '' : 'cursor-pointer'}"
|
||||
on:pointerup={() => {
|
||||
if (!disabled) {
|
||||
open = !open;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class=" w-full font-medium flex items-center justify-between gap-2 {attributes?.done &&
|
||||
attributes?.done !== 'true'
|
||||
? 'shimmer'
|
||||
: ''}
|
||||
class=" w-full font-medium flex items-center justify-between gap-2 {attributes?.done &&
|
||||
attributes?.done !== 'true'
|
||||
? 'shimmer'
|
||||
: ''}
|
||||
"
|
||||
>
|
||||
{#if attributes?.done && attributes?.done !== 'true'}
|
||||
<div>
|
||||
<Spinner className="size-4" />
|
||||
</div>
|
||||
{/if}
|
||||
>
|
||||
{#if attributes?.done && attributes?.done !== 'true'}
|
||||
<div>
|
||||
<Spinner className="size-4" />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="">
|
||||
{#if attributes?.type === 'reasoning'}
|
||||
{#if attributes?.done === 'true' && attributes?.duration}
|
||||
{#if attributes.duration < 1}
|
||||
{$i18n.t('Thought for less than a second')}
|
||||
{:else if attributes.duration < 60}
|
||||
{$i18n.t('Thought for {{DURATION}} seconds', {
|
||||
DURATION: attributes.duration
|
||||
})}
|
||||
{:else}
|
||||
{$i18n.t('Thought for {{DURATION}}', {
|
||||
DURATION: dayjs.duration(attributes.duration, 'seconds').humanize()
|
||||
})}
|
||||
{/if}
|
||||
<div class="">
|
||||
{#if attributes?.type === 'reasoning'}
|
||||
{#if attributes?.done === 'true' && attributes?.duration}
|
||||
{#if attributes.duration < 1}
|
||||
{$i18n.t('Thought for less than a second')}
|
||||
{:else if attributes.duration < 60}
|
||||
{$i18n.t('Thought for {{DURATION}} seconds', {
|
||||
DURATION: attributes.duration
|
||||
})}
|
||||
{:else}
|
||||
{$i18n.t('Thinking...')}
|
||||
{/if}
|
||||
{:else if attributes?.type === 'code_interpreter'}
|
||||
{#if attributes?.done === 'true'}
|
||||
{$i18n.t('Analyzed')}
|
||||
{:else}
|
||||
{$i18n.t('Analyzing...')}
|
||||
{$i18n.t('Thought for {{DURATION}}', {
|
||||
DURATION: dayjs.duration(attributes.duration, 'seconds').humanize()
|
||||
})}
|
||||
{/if}
|
||||
{:else}
|
||||
{title}
|
||||
{$i18n.t('Thinking...')}
|
||||
{/if}
|
||||
{:else if attributes?.type === 'code_interpreter'}
|
||||
{#if attributes?.done === 'true'}
|
||||
{$i18n.t('Analyzed')}
|
||||
{:else}
|
||||
{$i18n.t('Analyzing...')}
|
||||
{/if}
|
||||
{:else}
|
||||
{title}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if !disabled}
|
||||
<div class="flex self-center translate-y-[1px]">
|
||||
{#if open}
|
||||
<ChevronUp strokeWidth="3.5" className="size-3.5" />
|
||||
{:else}
|
||||
<ChevronDown strokeWidth="3.5" className="size-3.5" />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="{buttonClassName} cursor-pointer"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
on:pointerup={(e) => {
|
||||
if (!disabled) {
|
||||
open = !open;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<div class="flex items-start justify-between">
|
||||
<slot />
|
||||
|
||||
{#if !disabled}
|
||||
<div class="flex self-center translate-y-[1px]">
|
||||
{#if chevron}
|
||||
<div class="flex self-start translate-y-1">
|
||||
{#if open}
|
||||
<ChevronUp strokeWidth="3.5" className="size-3.5" />
|
||||
{:else}
|
||||
@@ -122,57 +151,28 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="{buttonClassName} cursor-pointer"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
on:pointerup={(e) => {
|
||||
if (!disabled) {
|
||||
open = !open;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<div class="flex items-start justify-between">
|
||||
<slot />
|
||||
|
||||
{#if chevron}
|
||||
<div class="flex self-start translate-y-1">
|
||||
{#if open}
|
||||
<ChevronUp strokeWidth="3.5" className="size-3.5" />
|
||||
{:else}
|
||||
<ChevronDown strokeWidth="3.5" className="size-3.5" />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if grow}
|
||||
{#if open && !hide}
|
||||
<div
|
||||
transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}
|
||||
on:pointerup={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<slot name="content" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if grow}
|
||||
{#if open && !hide}
|
||||
<div
|
||||
transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}
|
||||
on:pointerup={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<slot name="content" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !grow}
|
||||
{#if open && !hide}
|
||||
<div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}>
|
||||
<slot name="content" />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !grow}
|
||||
{#if open && !hide}
|
||||
<div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}>
|
||||
<slot name="content" />
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -119,11 +119,13 @@
|
||||
const range = XLSX.utils.decode_range(worksheet['!ref'] || 'A1:A1');
|
||||
rowCount = range.e.r - range.s.r + 1;
|
||||
|
||||
excelHtml = DOMPurify.sanitize(XLSX.utils.sheet_to_html(worksheet, {
|
||||
id: 'excel-table',
|
||||
editable: false,
|
||||
header: ''
|
||||
}));
|
||||
excelHtml = DOMPurify.sanitize(
|
||||
XLSX.utils.sheet_to_html(worksheet, {
|
||||
id: 'excel-table',
|
||||
editable: false,
|
||||
header: ''
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
$: if (selectedSheet && excelWorkbook) {
|
||||
|
||||
@@ -165,19 +165,11 @@
|
||||
{#each files ?? [] as file, idx}
|
||||
{#if typeof file === 'string'}
|
||||
{#if file.startsWith('data:image/')}
|
||||
<Image
|
||||
id={`${componentId}-tool-call-result-${idx}`}
|
||||
src={file}
|
||||
alt="Image"
|
||||
/>
|
||||
<Image id={`${componentId}-tool-call-result-${idx}`} src={file} alt="Image" />
|
||||
{/if}
|
||||
{:else if typeof file === 'object'}
|
||||
{#if (file.type === 'image' || (file?.content_type ?? '').startsWith('image/')) && file.url}
|
||||
<Image
|
||||
id={`${componentId}-tool-call-result-${idx}`}
|
||||
src={file.url}
|
||||
alt="Image"
|
||||
/>
|
||||
<Image id={`${componentId}-tool-call-result-${idx}`} src={file.url} alt="Image" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
@@ -105,7 +105,9 @@
|
||||
/>
|
||||
{:else if valvesSpec.properties[property]?.input ?? null}
|
||||
{#if valvesSpec.properties[property]?.input?.type === 'password'}
|
||||
<div class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 border border-gray-100/30 dark:border-gray-850/30">
|
||||
<div
|
||||
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 border border-gray-100/30 dark:border-gray-850/30"
|
||||
>
|
||||
<SensitiveInput
|
||||
id="valve-{property}"
|
||||
placeholder={valvesSpec.properties[property]?.description ?? ''}
|
||||
@@ -124,7 +126,10 @@
|
||||
dispatch('change');
|
||||
}}
|
||||
>
|
||||
<option value="" disabled>{valvesSpec.properties[property]?.description ?? $i18n.t('Select an option')}</option>
|
||||
<option value="" disabled
|
||||
>{valvesSpec.properties[property]?.description ??
|
||||
$i18n.t('Select an option')}</option
|
||||
>
|
||||
{#each valvesSpec.properties[property].input.options as option}
|
||||
{#if typeof option === 'object' && option !== null}
|
||||
<option value={option.value} selected={option.value === valves[property]}>
|
||||
|
||||
Reference in New Issue
Block a user