Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
9bcd4ce5
Unverified
Commit
9bcd4ce5
authored
Jul 09, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jul 09, 2024
Browse files
Merge pull request #3559 from open-webui/dev
0.3.8
parents
824966ad
b38abf23
Changes
178
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
339 additions
and
70 deletions
+339
-70
src/lib/components/common/SensitiveInput.svelte
src/lib/components/common/SensitiveInput.svelte
+2
-2
src/lib/components/common/Tags/TagInput.svelte
src/lib/components/common/Tags/TagInput.svelte
+1
-1
src/lib/components/common/Tooltip.svelte
src/lib/components/common/Tooltip.svelte
+6
-1
src/lib/components/documents/EditDocModal.svelte
src/lib/components/documents/EditDocModal.svelte
+1
-1
src/lib/components/icons/AdjustmentsHorizontal.svelte
src/lib/components/icons/AdjustmentsHorizontal.svelte
+17
-0
src/lib/components/icons/Bookmark.svelte
src/lib/components/icons/Bookmark.svelte
+19
-0
src/lib/components/icons/BookmarkSlash.svelte
src/lib/components/icons/BookmarkSlash.svelte
+19
-0
src/lib/components/icons/ChatMenu.svelte
src/lib/components/icons/ChatMenu.svelte
+124
-0
src/lib/components/icons/Star.svelte
src/lib/components/icons/Star.svelte
+19
-0
src/lib/components/layout/Navbar.svelte
src/lib/components/layout/Navbar.svelte
+21
-4
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+44
-44
src/lib/components/layout/Sidebar/ChatItem.svelte
src/lib/components/layout/Sidebar/ChatItem.svelte
+8
-1
src/lib/components/layout/Sidebar/ChatMenu.svelte
src/lib/components/layout/Sidebar/ChatMenu.svelte
+43
-1
src/lib/components/layout/Sidebar/UserMenu.svelte
src/lib/components/layout/Sidebar/UserMenu.svelte
+1
-1
src/lib/components/workspace/Documents.svelte
src/lib/components/workspace/Documents.svelte
+1
-1
src/lib/components/workspace/Functions.svelte
src/lib/components/workspace/Functions.svelte
+3
-3
src/lib/components/workspace/Models.svelte
src/lib/components/workspace/Models.svelte
+4
-4
src/lib/components/workspace/Models/Knowledge/Selector.svelte
...lib/components/workspace/Models/Knowledge/Selector.svelte
+1
-1
src/lib/components/workspace/Prompts.svelte
src/lib/components/workspace/Prompts.svelte
+2
-2
src/lib/components/workspace/Tools.svelte
src/lib/components/workspace/Tools.svelte
+3
-3
No files found.
src/lib/components/common/SensitiveInput.svelte
View file @
9bcd4ce5
...
...
@@ -4,8 +4,8 @@
export let readOnly = false;
export let outerClassName = 'flex flex-1';
export let inputClassName =
'w-full rounded-l-lg py-2 pl-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none';
export let showButtonClassName = 'px-2 transition rounded-r-lg bg-
white
dark:bg-gray-850';
'w-full rounded-l-lg py-2 pl-4 text-sm
bg-gray-50
dark:text-gray-300 dark:bg-gray-850 outline-none';
export let showButtonClassName = 'px-2 transition rounded-r-lg bg-
gray-50
dark:bg-gray-850';
let show = false;
</script>
...
...
src/lib/components/common/Tags/TagInput.svelte
View file @
9bcd4ce5
...
...
@@ -22,7 +22,7 @@
};
</script>
<div class="flex {showTagInput ? 'flex-row-reverse' : ''}">
<div class="
px-0.5
flex {showTagInput ? 'flex-row-reverse' : ''}">
{#if showTagInput}
<div class="flex items-center">
<input
...
...
src/lib/components/common/Tooltip.svelte
View file @
9bcd4ce5
...
...
@@ -3,11 +3,13 @@
import { marked } from 'marked';
import tippy from 'tippy.js';
import { roundArrow } from 'tippy.js';
export let placement = 'top';
export let content = `I'm a tooltip!`;
export let touch = true;
export let className = 'flex';
export let theme = '';
let tooltipElement;
let tooltipInstance;
...
...
@@ -20,7 +22,10 @@
content: content,
placement: placement,
allowHTML: true,
touch: touch
touch: touch,
...(theme !== '' ? { theme } : { theme: 'dark' }),
arrow: false,
offset: [0, 4]
});
}
} else if (tooltipInstance && content === '') {
...
...
src/lib/components/documents/EditDocModal.svelte
View file @
9bcd4ce5
...
...
@@ -109,7 +109,7 @@
<div class="flex flex-1">
<div
class="bg-gray-200 dark:bg-gray-800 font-bold px-3 py-0.5 border border-r-0 dark:border-gray-800 rounded-l-xl flex items-center"
class="bg-gray-200 dark:bg-gray-800 font-
semi
bold px-3 py-0.5 border border-r-0 dark:border-gray-800 rounded-l-xl flex items-center"
>
#
</div>
...
...
src/lib/components/icons/AdjustmentsHorizontal.svelte
0 → 100644
View file @
9bcd4ce5
<script lang="ts">
export let className = 'w-4 h-4';
export let strokeWidth = '1.5';
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
stroke="currentColor"
fill="currentColor"
class={className}
stroke-width={strokeWidth}
>
<path
d="M18.75 12.75h1.5a.75.75 0 0 0 0-1.5h-1.5a.75.75 0 0 0 0 1.5ZM12 6a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 12 6ZM12 18a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 12 18ZM3.75 6.75h1.5a.75.75 0 1 0 0-1.5h-1.5a.75.75 0 0 0 0 1.5ZM5.25 18.75h-1.5a.75.75 0 0 1 0-1.5h1.5a.75.75 0 0 1 0 1.5ZM3 12a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 3 12ZM9 3.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5ZM12.75 12a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0ZM9 15.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Z"
/>
</svg>
src/lib/components/icons/Bookmark.svelte
0 → 100644
View file @
9bcd4ce5
<script lang="ts">
export let className = 'w-4 h-4';
export let strokeWidth = '1.5';
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width={strokeWidth}
stroke="currentColor"
class={className}
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0 1 11.186 0Z"
/>
</svg>
src/lib/components/icons/BookmarkSlash.svelte
0 → 100644
View file @
9bcd4ce5
<script lang="ts">
export let className = 'w-4 h-4';
export let strokeWidth = '1.5';
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width={strokeWidth}
stroke="currentColor"
class={className}
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="m3 3 1.664 1.664M21 21l-1.5-1.5m-5.485-1.242L12 17.25 4.5 21V8.742m.164-4.078a2.15 2.15 0 0 1 1.743-1.342 48.507 48.507 0 0 1 11.186 0c1.1.128 1.907 1.077 1.907 2.185V19.5M4.664 4.664 19.5 19.5"
/>
</svg>
src/lib/components/icons/ChatMenu.svelte
0 → 100644
View file @
9bcd4ce5
<script lang="ts">
import { DropdownMenu } from 'bits-ui';
import { flyAndScale } from '$lib/utils/transitions';
import { getContext } from 'svelte';
import Dropdown from '$lib/components/common/Dropdown.svelte';
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
import Pencil from '$lib/components/icons/Pencil.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Tags from '$lib/components/chat/Tags.svelte';
import Share from '$lib/components/icons/Share.svelte';
import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte';
import DocumentDuplicate from '$lib/components/icons/DocumentDuplicate.svelte';
import Star from '$lib/components/icons/Star.svelte';
const i18n = getContext('i18n');
export let pinHandler: Function;
export let shareHandler: Function;
export let cloneChatHandler: Function;
export let archiveChatHandler: Function;
export let renameHandler: Function;
export let deleteHandler: Function;
export let onClose: Function;
export let chatId = '';
let show = false;
</script>
<Dropdown
bind:show
on:change={(e) => {
if (e.detail === false) {
onClose();
}
}}
>
<Tooltip content={$i18n.t('More')}>
<slot />
</Tooltip>
<div slot="content">
<DropdownMenu.Content
class="w-full max-w-[180px] rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow"
sideOffset={-2}
side="bottom"
align="start"
transition={flyAndScale}
>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
pinHandler();
}}
>
<Star strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Pin')}</div>
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
renameHandler();
}}
>
<Pencil strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Rename')}</div>
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
cloneChatHandler();
}}
>
<DocumentDuplicate strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Clone')}</div>
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
archiveChatHandler();
}}
>
<ArchiveBox strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Archive')}</div>
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
shareHandler();
}}
>
<Share />
<div class="flex items-center">{$i18n.t('Share')}</div>
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
deleteHandler();
}}
>
<GarbageBin strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Delete')}</div>
</DropdownMenu.Item>
<hr class="border-gray-100 dark:border-gray-800 mt-2.5 mb-1.5" />
<div class="flex p-1">
<Tags
{chatId}
on:close={() => {
show = false;
onClose();
}}
/>
</div>
</DropdownMenu.Content>
</div>
</Dropdown>
src/lib/components/icons/Star.svelte
0 → 100644
View file @
9bcd4ce5
<script lang="ts">
export let className = 'w-4 h-4';
export let strokeWidth = '1.5';
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width={strokeWidth}
stroke="currentColor"
class={className}
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"
/>
</svg>
src/lib/components/layout/Navbar.svelte
View file @
9bcd4ce5
...
...
@@ -21,6 +21,7 @@
import { page } from '$app/stores';
import UserMenu from './Sidebar/UserMenu.svelte';
import MenuLines from '../icons/MenuLines.svelte';
import AdjustmentsHorizontal from '../icons/AdjustmentsHorizontal.svelte';
const i18n = getContext('i18n');
...
...
@@ -32,6 +33,7 @@
export let selectedModels;
export let showModelSelector = true;
export let showControls = false;
let showShareChatModal = false;
let showDownloadChatModal = false;
...
...
@@ -48,7 +50,7 @@
>
<button
id="sidebar-toggle-button"
class="cursor-pointer px-2 py-2 flex rounded-xl hover:bg-gray-
10
0 dark:hover:bg-gray-850 transition"
class="cursor-pointer px-2 py-2 flex rounded-xl hover:bg-gray-
5
0 dark:hover:bg-gray-850 transition"
on:click={() => {
showSidebar.set(!$showSidebar);
}}
...
...
@@ -58,6 +60,7 @@
</div>
</button>
</div>
<div class="flex-1 overflow-hidden max-w-full">
{#if showModelSelector}
<ModelSelector bind:selectedModels showSetDefault={!shareEnabled} />
...
...
@@ -79,7 +82,7 @@
}}
>
<button
class="hidden md:flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-
10
0 dark:hover:bg-gray-850 transition"
class="hidden md:flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-
5
0 dark:hover:bg-gray-850 transition"
id="chat-context-menu-button"
>
<div class=" m-auto self-center">
...
...
@@ -101,12 +104,26 @@
</button>
</Menu>
{/if}
<Tooltip content={$i18n.t('Controls')}>
<button
class=" flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-850 transition"
on:click={() => {
showControls = !showControls;
}}
>
<div class=" m-auto self-center">
<AdjustmentsHorizontal className=" size-5" strokeWidth="0.5" />
</div>
</button>
</Tooltip>
<Tooltip content={$i18n.t('New Chat')}>
<button
id="new-chat-button"
class=" flex {$showSidebar
? 'md:hidden'
: ''} cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-
10
0 dark:hover:bg-gray-850 transition"
: ''} cursor-pointer px-2 py-2 rounded-xl
text-gray-600 dark:text-gray-400
hover:bg-gray-
5
0 dark:hover:bg-gray-850 transition"
on:click={() => {
initNewChat();
}}
...
...
@@ -140,7 +157,7 @@
}}
>
<button
class="select-none flex rounded-xl p-1.5 w-full hover:bg-gray-
10
0 dark:hover:bg-gray-850 transition"
class="select-none flex rounded-xl p-1.5 w-full hover:bg-gray-
5
0 dark:hover:bg-gray-850 transition"
aria-label="User Menu"
>
<div class=" self-center">
...
...
src/lib/components/layout/Sidebar.svelte
View file @
9bcd4ce5
...
...
@@ -10,7 +10,8 @@
tags,
showSidebar,
mobile,
showArchivedChats
showArchivedChats,
pinnedChats
} from '$lib/stores';
import { onMount, getContext, tick } from 'svelte';
...
...
@@ -46,6 +47,7 @@
let showDeleteConfirm = false;
let showDropdown = false;
let filteredChatList = [];
$: filteredChatList = $chats.filter((chat) => {
...
...
@@ -80,6 +82,8 @@
});
showSidebar.set(window.innerWidth > BREAKPOINT);
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
await chats.set(await getChatList(localStorage.token));
let touchstart;
...
...
@@ -182,6 +186,7 @@
goto('/');
}
await chats.set(await getChatList(localStorage.token));
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
}
};
</script>
...
...
@@ -256,7 +261,7 @@
alt="logo"
/>
</div>
<div class=" self-center font-medium text-sm text-gray-850 dark:text-white">
<div class=" self-center font-medium text-sm text-gray-850 dark:text-white
font-primary
">
{$i18n.t('New Chat')}
</div>
<div class="self-center ml-auto">
...
...
@@ -334,7 +339,7 @@
</div>
<div class="flex self-center">
<div class=" self-center font-medium text-sm">{$i18n.t('Workspace')}</div>
<div class=" self-center font-medium text-sm
font-primary
">{$i18n.t('Workspace')}</div>
</div>
</a>
</div>
...
...
@@ -412,7 +417,7 @@
</div>
</div>
{#if $tags.length > 0}
{#if $tags.
filter((t) => t.name !== 'pinned').
length > 0}
<div class="px-2.5 mb-2 flex gap-1 flex-wrap">
<button
class="px-2.5 text-xs font-medium bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800 transition rounded-full"
...
...
@@ -422,7 +427,7 @@
>
{$i18n.t('all')}
</button>
{#each $tags as tag}
{#each $tags
.filter((t) => t.name !== 'pinned')
as tag}
<button
class="px-2.5 text-xs font-medium bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800 transition rounded-full"
on:click={async () => {
...
...
@@ -440,6 +445,38 @@
</div>
{/if}
{#if $pinnedChats.length > 0}
<div class="pl-2 py-2 flex flex-col space-y-1">
<div class="">
<div class="w-full pl-2.5 text-xs text-gray-500 dark:text-gray-500 font-medium pb-1.5">
{$i18n.t('Pinned')}
</div>
{#each $pinnedChats as chat, idx}
<ChatItem
{chat}
{shiftKey}
selected={selectedChatId === chat.id}
on:select={() => {
selectedChatId = chat.id;
}}
on:unselect={() => {
selectedChatId = null;
}}
on:delete={(e) => {
if ((e?.detail ?? '') === 'shift') {
deleteChatHandler(chat.id);
} else {
deleteChat = chat;
showDeleteConfirm = true;
}
}}
/>
{/each}
</div>
</div>
{/if}
<div class="pl-2 my-2 flex-1 flex flex-col space-y-1 overflow-y-auto scrollbar-hidden">
{#each filteredChatList as chat, idx}
{#if idx === 0 || (idx > 0 && chat.time_range !== filteredChatList[idx - 1].time_range)}
...
...
@@ -496,7 +533,7 @@
<div class="px-2.5">
<!-- <hr class=" border-gray-900 mb-1 w-full" /> -->
<div class="flex flex-col">
<div class="flex flex-col
font-primary
">
{#if $user !== undefined}
<UserMenu
role={$user.role}
...
...
@@ -519,50 +556,13 @@
alt="User profile"
/>
</div>
<div class=" self-center font-
semibold
">{$user.name}</div>
<div class=" self-center font-
medium
">{$user.name}</div>
</button>
</UserMenu>
{/if}
</div>
</div>
</div>
<!-- <div
id="sidebar-handle"
class=" hidden md:fixed left-0 top-[50dvh] -translate-y-1/2 transition-transform translate-x-[255px] md:translate-x-[260px] rotate-0"
>
<Tooltip
placement="right"
content={`${$showSidebar ? $i18n.t('Close') : $i18n.t('Open')} ${$i18n.t('sidebar')}`}
touch={false}
>
<button
id="sidebar-toggle-button"
class=" group"
on:click={() => {
showSidebar.set(!$showSidebar);
}}
><span class="" data-state="closed"
><div
class="flex h-[72px] w-8 items-center justify-center opacity-50 group-hover:opacity-100 transition"
>
<div class="flex h-6 w-6 flex-col items-center">
<div
class="h-3 w-1 rounded-full bg-[#0f0f0f] dark:bg-white rotate-0 translate-y-[0.15rem] {$showSidebar
? 'group-hover:rotate-[15deg]'
: 'group-hover:rotate-[-15deg]'}"
/>
<div
class="h-3 w-1 rounded-full bg-[#0f0f0f] dark:bg-white rotate-0 translate-y-[-0.15rem] {$showSidebar
? 'group-hover:rotate-[-15deg]'
: 'group-hover:rotate-[15deg]'}"
/>
</div>
</div>
</span>
</button>
</Tooltip>
</div> -->
</div>
<style>
...
...
src/lib/components/layout/Sidebar/ChatItem.svelte
View file @
9bcd4ce5
...
...
@@ -11,9 +11,10 @@
cloneChatById,
deleteChatById,
getChatList,
getChatListByTagName,
updateChatById
} from '$lib/apis/chats';
import { chatId, chats, mobile, showSidebar } from '$lib/stores';
import { chatId, chats, mobile,
pinnedChats,
showSidebar } from '$lib/stores';
import ChatMenu from './ChatMenu.svelte';
import ShareChatModal from '$lib/components/chat/ShareChatModal.svelte';
...
...
@@ -40,6 +41,7 @@
title: _title
});
await chats.set(await getChatList(localStorage.token));
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
}
};
...
...
@@ -52,12 +54,14 @@
if (res) {
goto(`/c/${res.id}`);
await chats.set(await getChatList(localStorage.token));
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
}
};
const archiveChatHandler = async (id) => {
await archiveChatById(localStorage.token, id);
await chats.set(await getChatList(localStorage.token));
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
};
const focusEdit = async (node: HTMLInputElement) => {
...
...
@@ -233,6 +237,9 @@
onClose={() => {
dispatch('unselect');
}}
on:change={async () => {
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
}}
>
<button
aria-label="Chat Menu"
...
...
src/lib/components/layout/Sidebar/ChatMenu.svelte
View file @
9bcd4ce5
<script lang="ts">
import { DropdownMenu } from 'bits-ui';
import { flyAndScale } from '$lib/utils/transitions';
import { getContext } from 'svelte';
import { getContext, createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
import Dropdown from '$lib/components/common/Dropdown.svelte';
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
...
...
@@ -11,6 +13,9 @@
import Share from '$lib/components/icons/Share.svelte';
import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte';
import DocumentDuplicate from '$lib/components/icons/DocumentDuplicate.svelte';
import Bookmark from '$lib/components/icons/Bookmark.svelte';
import BookmarkSlash from '$lib/components/icons/BookmarkSlash.svelte';
import { addTagById, deleteTagById, getTagsById } from '$lib/apis/chats';
const i18n = getContext('i18n');
...
...
@@ -24,6 +29,28 @@
export let chatId = '';
let show = false;
let pinned = false;
const pinHandler = async () => {
if (pinned) {
await deleteTagById(localStorage.token, chatId, 'pinned');
} else {
await addTagById(localStorage.token, chatId, 'pinned');
}
dispatch('change');
};
const checkPinned = async () => {
pinned = (
await getTagsById(localStorage.token, chatId).catch(async (error) => {
return [];
})
).find((tag) => tag.name === 'pinned');
};
$: if (show) {
checkPinned();
}
</script>
<Dropdown
...
...
@@ -46,6 +73,21 @@
align="start"
transition={flyAndScale}
>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
pinHandler();
}}
>
{#if pinned}
<BookmarkSlash strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Unpin')}</div>
{:else}
<Bookmark strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Pin')}</div>
{/if}
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
...
...
src/lib/components/layout/Sidebar/UserMenu.svelte
View file @
9bcd4ce5
...
...
@@ -30,7 +30,7 @@
<slot name="content">
<DropdownMenu.Content
class="w-full {className} text-sm rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow"
class="w-full {className} text-sm rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow
font-primary
"
sideOffset={8}
side="bottom"
align="start"
...
...
src/lib/components/workspace/Documents.svelte
View file @
9bcd4ce5
...
...
@@ -407,7 +407,7 @@
{/if}
</div>
<div class=" self-center flex-1">
<div class=" font-bold line-clamp-1">#{doc.name} ({doc.filename})</div>
<div class=" font-
semi
bold line-clamp-1">#{doc.name} ({doc.filename})</div>
<div class=" text-xs overflow-hidden text-ellipsis line-clamp-1">
{doc.title}
</div>
...
...
src/lib/components/workspace/Functions.svelte
View file @
9bcd4ce5
...
...
@@ -200,14 +200,14 @@
<div class=" flex-1 self-center pl-1">
<div class=" font-semibold flex items-center gap-1.5">
<div
class=" text-xs font-b
lack
px-1 rounded uppercase line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
class=" text-xs font-b
old
px-1 rounded uppercase line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
>
{func.type}
</div>
{#if func?.meta?.manifest?.version}
<div
class="text-xs font-b
lack
px-1 rounded line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
class="text-xs font-b
old
px-1 rounded line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
>
v{func?.meta?.manifest?.version ?? ''}
</div>
...
...
@@ -430,7 +430,7 @@
</div>
<div class=" self-center">
<div class=" font-bold line-clamp-1">{$i18n.t('Discover a function')}</div>
<div class=" font-
semi
bold line-clamp-1">{$i18n.t('Discover a function')}</div>
<div class=" text-sm line-clamp-1">
{$i18n.t('Discover, download, and explore custom functions')}
</div>
...
...
src/lib/components/workspace/Models.svelte
View file @
9bcd4ce5
...
...
@@ -271,7 +271,7 @@
</div>
<div class=" self-center">
<div class=" font-bold line-clamp-1">{$i18n.t('Create a model')}</div>
<div class=" font-
semi
bold line-clamp-1">{$i18n.t('Create a model')}</div>
<div class=" text-sm line-clamp-1">{$i18n.t('Customize models for a specific purpose')}</div>
</div>
</a>
...
...
@@ -297,7 +297,7 @@
: ''} "
>
<img
src={model?.info?.meta?.profile_image_url ?? '/favicon.png'}
src={model?.info?.meta?.profile_image_url ?? '/
static/
favicon.png'}
alt="modelfile profile"
class=" rounded-full w-full h-auto object-cover"
/>
...
...
@@ -307,7 +307,7 @@
<div
class=" flex-1 self-center {model?.info?.meta?.hidden ?? false ? 'text-gray-500' : ''}"
>
<div class=" font-bold line-clamp-1">{model.name}</div>
<div class=" font-
semi
bold line-clamp-1">{model.name}</div>
<div class=" text-xs overflow-hidden text-ellipsis line-clamp-1">
{!!model?.info?.meta?.description ? model?.info?.meta?.description : model.id}
</div>
...
...
@@ -518,7 +518,7 @@
</div>
<div class=" self-center">
<div class=" font-bold line-clamp-1">{$i18n.t('Discover a model')}</div>
<div class=" font-
semi
bold line-clamp-1">{$i18n.t('Discover a model')}</div>
<div class=" text-sm line-clamp-1">
{$i18n.t('Discover, download, and explore model presets')}
</div>
...
...
src/lib/components/workspace/Models/Knowledge/Selector.svelte
View file @
9bcd4ce5
...
...
@@ -119,7 +119,7 @@
<div class="flex items-center">
<div class="flex flex-col">
<div
class=" w-fit text-xs font-b
lack
px-1 rounded uppercase line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
class=" w-fit text-xs font-b
old
px-1 rounded uppercase line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
>
{item?.type ?? 'Document'}
</div>
...
...
src/lib/components/workspace/Prompts.svelte
View file @
9bcd4ce5
...
...
@@ -119,7 +119,7 @@
<div class=" flex flex-1 space-x-4 cursor-pointer w-full">
<a href={`/workspace/prompts/edit?command=${encodeURIComponent(prompt.command)}`}>
<div class=" flex-1 self-center pl-5">
<div class=" font-bold line-clamp-1">{prompt.command}</div>
<div class=" font-
semi
bold line-clamp-1">{prompt.command}</div>
<div class=" text-xs overflow-hidden text-ellipsis line-clamp-1">
{prompt.title}
</div>
...
...
@@ -299,7 +299,7 @@
</div>
<div class=" self-center">
<div class=" font-bold line-clamp-1">{$i18n.t('Discover a prompt')}</div>
<div class=" font-
semi
bold line-clamp-1">{$i18n.t('Discover a prompt')}</div>
<div class=" text-sm line-clamp-1">
{$i18n.t('Discover, download, and explore custom prompts')}
</div>
...
...
src/lib/components/workspace/Tools.svelte
View file @
9bcd4ce5
...
...
@@ -177,14 +177,14 @@
<div class=" flex-1 self-center pl-1">
<div class=" font-semibold flex items-center gap-1.5">
<div
class=" text-xs font-b
lack
px-1 rounded uppercase line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
class=" text-xs font-b
old
px-1 rounded uppercase line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
>
TOOL
</div>
{#if tool?.meta?.manifest?.version}
<div
class="text-xs font-b
lack
px-1 rounded line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
class="text-xs font-b
old
px-1 rounded line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"
>
v{tool?.meta?.manifest?.version ?? ''}
</div>
...
...
@@ -389,7 +389,7 @@
</div>
<div class=" self-center">
<div class=" font-bold line-clamp-1">{$i18n.t('Discover a tool')}</div>
<div class=" font-
semi
bold line-clamp-1">{$i18n.t('Discover a tool')}</div>
<div class=" text-sm line-clamp-1">
{$i18n.t('Discover, download, and explore custom tools')}
</div>
...
...
Prev
1
2
3
4
5
6
7
8
9
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment