mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-18 07:15:20 +00:00
refac
This commit is contained in:
parent
b775826a27
commit
025eef754f
1 changed files with 37 additions and 37 deletions
|
|
@ -43,14 +43,16 @@
|
||||||
|
|
||||||
items = [
|
items = [
|
||||||
...items,
|
...items,
|
||||||
...res.map((item) => {
|
...res
|
||||||
return {
|
.filter((item) => item?.id !== $chatId)
|
||||||
...item,
|
.map((item) => {
|
||||||
type: 'chat',
|
return {
|
||||||
name: item.title,
|
...item,
|
||||||
description: dayjs(item.updated_at * 1000).fromNow()
|
type: 'chat',
|
||||||
};
|
name: item.title,
|
||||||
})
|
description: dayjs(item.updated_at * 1000).fromNow()
|
||||||
|
};
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
itemsLoading = false;
|
itemsLoading = false;
|
||||||
|
|
@ -71,35 +73,33 @@
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex flex-col gap-0.5">
|
<div class="flex flex-col gap-0.5">
|
||||||
{#each items as item, idx}
|
{#each items as item, idx}
|
||||||
{#if item?.id !== $chatId}
|
<button
|
||||||
<button
|
class=" px-2.5 py-1 rounded-xl w-full text-left flex justify-between items-center text-sm {idx ===
|
||||||
class=" px-2.5 py-1 rounded-xl w-full text-left flex justify-between items-center text-sm {idx ===
|
selectedIdx
|
||||||
selectedIdx
|
? ' bg-gray-50 dark:bg-gray-800 dark:text-gray-100 selected-command-option-button'
|
||||||
? ' bg-gray-50 dark:bg-gray-800 dark:text-gray-100 selected-command-option-button'
|
: ''}"
|
||||||
: ''}"
|
type="button"
|
||||||
type="button"
|
on:click={() => {
|
||||||
on:click={() => {
|
onSelect(item);
|
||||||
onSelect(item);
|
}}
|
||||||
}}
|
on:mousemove={() => {
|
||||||
on:mousemove={() => {
|
selectedIdx = idx;
|
||||||
selectedIdx = idx;
|
}}
|
||||||
}}
|
on:mouseleave={() => {
|
||||||
on:mouseleave={() => {
|
if (idx === 0) {
|
||||||
if (idx === 0) {
|
selectedIdx = -1;
|
||||||
selectedIdx = -1;
|
}
|
||||||
}
|
}}
|
||||||
}}
|
data-selected={idx === selectedIdx}
|
||||||
data-selected={idx === selectedIdx}
|
>
|
||||||
>
|
<div class="text-black dark:text-gray-100 flex items-center gap-1.5">
|
||||||
<div class="text-black dark:text-gray-100 flex items-center gap-1.5">
|
<Tooltip content={item.description || decodeString(item?.name)} placement="top-start">
|
||||||
<Tooltip content={item.description || decodeString(item?.name)} placement="top-start">
|
<div class="line-clamp-1 flex-1">
|
||||||
<div class="line-clamp-1 flex-1">
|
{decodeString(item?.name)}
|
||||||
{decodeString(item?.name)}
|
</div>
|
||||||
</div>
|
</Tooltip>
|
||||||
</Tooltip>
|
</div>
|
||||||
</div>
|
</button>
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
{#if !allItemsLoaded}
|
{#if !allItemsLoaded}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue