mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-01 17:32:52 -05:00
refac
This commit is contained in:
1 parent
6e3e87b116
commit
2ca21e5f2e
77 files changed
+4108
-4042
No files matched your search
@@ -74,6 +74,9 @@
|
||||
'directory'
|
||||
].includes(tab);
|
||||
|
||||
$: showImageCapture = visionCapableModels.length > 0 && $visibleControls['chat.capture'];
|
||||
$: showCapture = showImageCapture || !!recordActions;
|
||||
|
||||
let showAttachWebpageModal = false;
|
||||
$: showAddContext =
|
||||
$visibleControls['chat.attach_webpage'] ||
|
||||
@@ -268,7 +271,55 @@
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
{#if visionCapableModels.length > 0 && $visibleControls['chat.capture']}
|
||||
{#if showCapture}
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
tab = 'capture';
|
||||
}}
|
||||
>
|
||||
<Camera />
|
||||
<div class="flex items-center w-full justify-between">
|
||||
<div>{$i18n.t('Capture')}</div>
|
||||
<div class="text-base-500"><ChevronRight /></div>
|
||||
</div>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if showAddContext}
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
tab = 'attachments';
|
||||
}}
|
||||
>
|
||||
<DocumentDuplicate />
|
||||
<div class="flex items-center w-full justify-between">
|
||||
<div>{$i18n.t('Attachments')}</div>
|
||||
<div class="text-base-500"><ChevronRight /></div>
|
||||
</div>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if tab === 'capture' && showCapture}
|
||||
<div in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
tab = '';
|
||||
}}
|
||||
>
|
||||
<ChevronLeft />
|
||||
<div>{$i18n.t('Capture')}</div>
|
||||
</button>
|
||||
|
||||
{#if showImageCapture}
|
||||
<Tooltip
|
||||
content={fileUploadCapableModels.length !== selectedModels.length
|
||||
? $i18n.t('Model(s) do not support file upload')
|
||||
@@ -298,76 +349,32 @@
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Camera />
|
||||
<div class=" line-clamp-1">{$i18n.t('Capture')}</div>
|
||||
<Camera className="size-4" />
|
||||
<div class="line-clamp-1">
|
||||
{detectMobile() ? $i18n.t('Camera') : $i18n.t('Screenshot')}
|
||||
</div>
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
{#if recordActions}
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
tab = 'record';
|
||||
}}
|
||||
>
|
||||
<Mic />
|
||||
<div class="flex items-center w-full justify-between">
|
||||
<div>{$i18n.t('Record')}</div>
|
||||
<div class="text-base-500"><ChevronRight /></div>
|
||||
</div>
|
||||
</button>
|
||||
<!-- i18n:parse cannot see keys passed in as variables, so these keep them in the locale files: $i18n.t('Record') $i18n.t('Capture Audio') -->
|
||||
<!-- Earlier wording, kept so i18n:parse does not drop its translations: $i18n.t('Upload Audio') -->
|
||||
{#each [{ label: 'Record', icon: Mic, action: recordActions.record }, { label: 'Capture Audio', icon: CursorArrowRays, action: recordActions.captureAudio }] as item}
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
show = false;
|
||||
item.action();
|
||||
}}
|
||||
>
|
||||
<svelte:component this={item.icon} className="size-4" />
|
||||
<div class="line-clamp-1">{$i18n.t(item.label)}</div>
|
||||
</button>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if showAddContext}
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
tab = 'attachments';
|
||||
}}
|
||||
>
|
||||
<DocumentDuplicate />
|
||||
<div class="flex items-center w-full justify-between">
|
||||
<div>{$i18n.t('Attachments')}</div>
|
||||
<div class="text-base-500"><ChevronRight /></div>
|
||||
</div>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if tab === 'record' && recordActions}
|
||||
<div in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
tab = '';
|
||||
}}
|
||||
>
|
||||
<ChevronLeft />
|
||||
<div>{$i18n.t('Record')}</div>
|
||||
</button>
|
||||
|
||||
<!-- i18n:parse cannot see keys passed in as variables, so these keep them in the locale files: $i18n.t('Capture Audio') -->
|
||||
<!-- Earlier wording, kept so i18n:parse does not drop its translations: $i18n.t('Upload Audio') -->
|
||||
{#each [{ label: 'Record', icon: Mic, action: recordActions.record }, { label: 'Capture Audio', icon: CursorArrowRays, action: recordActions.captureAudio }] as item}
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl text-left"
|
||||
on:click={() => {
|
||||
show = false;
|
||||
item.action();
|
||||
}}
|
||||
>
|
||||
<svelte:component this={item.icon} className="size-4" />
|
||||
<div class="line-clamp-1">{$i18n.t(item.label)}</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{:else if tab === 'attachments'}
|
||||
<div in:fly={{ x: 20, duration: 150 }}>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy } from 'svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
import { config, user } from '$lib/stores';
|
||||
import { commentsRequest, type CommentResource, type ResourceComment } from '$lib/apis/comments';
|
||||
import Dropdown from '$lib/components/common/Dropdown.svelte';
|
||||
import CommentButton from './CommentButton.svelte';
|
||||
import CommentsPanel, { type CommentsRequest } from './CommentsPanel.svelte';
|
||||
|
||||
const { url: pageUrl } = getPageContext();
|
||||
|
||||
export let resource: CommentResource;
|
||||
/** Shared across a page so a menu item can open the popover anchored to its row's button. */
|
||||
export let view: CommentsRequest | null = null;
|
||||
/** Open the popover when the page URL carries ?comment=<id> for this resource. */
|
||||
export let deepLink = false;
|
||||
/** Show the resource name above the thread, for lists where the anchor alone is ambiguous. */
|
||||
export let showResource = false;
|
||||
export let className = '';
|
||||
export let wrapperClassName = '';
|
||||
|
||||
$: enabled = !!($config?.features?.enable_comments && $user && resource.resource_id);
|
||||
$: open =
|
||||
enabled &&
|
||||
view?.resource_type === resource.resource_type &&
|
||||
view?.resource_id === resource.resource_id;
|
||||
|
||||
let alive = true;
|
||||
onDestroy(() => {
|
||||
alive = false;
|
||||
});
|
||||
let linked = '';
|
||||
const loadLink = async (id: string, url: string) => {
|
||||
try {
|
||||
const comment = await commentsRequest<ResourceComment>(`/${encodeURIComponent(id)}`);
|
||||
if (
|
||||
alive &&
|
||||
url === $pageUrl.href &&
|
||||
comment.resource_type === resource.resource_type &&
|
||||
comment.resource_id === resource.resource_id
|
||||
)
|
||||
view = { ...resource, comment_id: id };
|
||||
} catch (e) {
|
||||
if (alive && url === $pageUrl.href) toast.error(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
};
|
||||
$: if (deepLink && enabled && $pageUrl.href !== linked) {
|
||||
linked = $pageUrl.href;
|
||||
const id = $pageUrl.searchParams.get('comment');
|
||||
if (id) loadLink(id, linked);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if enabled}
|
||||
<Dropdown
|
||||
show={open}
|
||||
align="end"
|
||||
maxHeight="min(36rem, calc(100dvh - 6rem))"
|
||||
contentClass="w-[min(24rem,calc(100vw-2rem))] h-[min(36rem,calc(100dvh-6rem))] rounded-3xl border border-base-100/50 dark:border-base-800/50 bg-base-0 dark:bg-base-900 shadow-lg overflow-hidden! z-50"
|
||||
onOpenChange={(state) => {
|
||||
if (!state) {
|
||||
if (open) view = null;
|
||||
} else if (!open) view = { ...resource };
|
||||
}}
|
||||
>
|
||||
<CommentButton
|
||||
{className}
|
||||
{wrapperClassName}
|
||||
{resource}
|
||||
onComment={(request) => (view = open ? null : request)}
|
||||
/>
|
||||
<div slot="content" class="h-full">
|
||||
{#if open && view}
|
||||
{#key `${$user?.id}:${resource.resource_type}:${resource.resource_id}:${view.comment_id ?? ''}`}
|
||||
<CommentsPanel bind:view modal={showResource} onClose={() => (view = null)} />
|
||||
{/key}
|
||||
{/if}
|
||||
</div>
|
||||
</Dropdown>
|
||||
{/if}
|
||||
@@ -3,10 +3,9 @@
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import WorkspaceAccessModal from './common/WorkspaceAccessModal.svelte';
|
||||
let accessModal: WorkspaceAccessModal;
|
||||
import dayjs from 'dayjs';
|
||||
@@ -318,299 +317,293 @@
|
||||
|
||||
<h1 class="sr-only">{$i18n.t('Knowledge')}</h1>
|
||||
|
||||
<Comments modal bind:view={comments} resourceType="knowledge">
|
||||
{#if loaded && items !== null && total !== null}
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
on:confirm={() => {
|
||||
deleteHandler(selectedItem);
|
||||
{#if loaded && items !== null && total !== null}
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
on:confirm={() => {
|
||||
deleteHandler(selectedItem);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Modal bind:show={showCreateModal} size="md" ariaLabel={$i18n.t('Create a knowledge base')}>
|
||||
<KnowledgeEditor
|
||||
modal={true}
|
||||
onBack={() => {
|
||||
closeCreateModal();
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<Modal bind:show={showCreateModal} size="md" ariaLabel={$i18n.t('Create a knowledge base')}>
|
||||
<KnowledgeEditor
|
||||
modal={true}
|
||||
onBack={() => {
|
||||
closeCreateModal();
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
<input
|
||||
class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Knowledge')}
|
||||
placeholder={$i18n.t('Search Knowledge')}
|
||||
/>
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
|
||||
await tick();
|
||||
<input
|
||||
class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Knowledge')}
|
||||
placeholder={$i18n.t('Search Knowledge')}
|
||||
/>
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
/>
|
||||
|
||||
<TagSelector
|
||||
bind:value={sourceOption}
|
||||
align="end"
|
||||
placeholder={$i18n.t('All Sources')}
|
||||
items={[
|
||||
{ value: 'local', label: $i18n.t('Local') },
|
||||
{ value: 'external', label: $i18n.t('Connected') }
|
||||
]}
|
||||
onChange={async () => {
|
||||
localStorage.workspaceKnowledgeSourceOption = sourceOption;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if items !== null && total !== null}
|
||||
{#if (items ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
|
||||
<TagSelector
|
||||
bind:value={sourceOption}
|
||||
align="end"
|
||||
placeholder={$i18n.t('All Sources')}
|
||||
items={[
|
||||
{ value: 'local', label: $i18n.t('Local') },
|
||||
{ value: 'external', label: $i18n.t('Connected') }
|
||||
]}
|
||||
onChange={async () => {
|
||||
localStorage.workspaceKnowledgeSourceOption = sourceOption;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if items !== null && total !== null}
|
||||
{#if (items ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each items as item}
|
||||
{@const metaPreview = getKnowledgeMetaPreview(item)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group cursor-pointer text-left"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openKnowledge(item);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip
|
||||
content={item?.description ?? item.name}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
>
|
||||
{#if !item?.meta?.document}
|
||||
<a
|
||||
href={`/workspace/knowledge/${item.id}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{item.name}</a
|
||||
>
|
||||
{:else}
|
||||
<span
|
||||
class="block truncate text-[0.8125rem] leading-5 text-base-800 group-hover:underline dark:text-base-200"
|
||||
>{item.name}</span
|
||||
>
|
||||
{/if}
|
||||
</Tooltip>
|
||||
{#if !item?.write_access || item?.meta?.source === 'external'}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
{#if item?.meta?.source === 'external'}
|
||||
<Badge
|
||||
type="muted"
|
||||
content={item?.meta?.external?.provider ?? $i18n.t('Connected')}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if metaPreview}
|
||||
<Tooltip content={metaPreview} className="min-w-0" placement="top-start">
|
||||
<div
|
||||
class="truncate text-xs leading-4 text-base-500 dark:text-base-400"
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each items as item}
|
||||
{@const metaPreview = getKnowledgeMetaPreview(item)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group cursor-pointer text-left"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openKnowledge(item);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip
|
||||
content={item?.description ?? item.name}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
>
|
||||
{#if !item?.meta?.document}
|
||||
<a
|
||||
href={`/workspace/knowledge/${item.id}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{item.name}</a
|
||||
>
|
||||
{metaPreview}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<span
|
||||
class="block truncate text-[0.8125rem] leading-5 text-base-800 group-hover:underline dark:text-base-200"
|
||||
>{item.name}</span
|
||||
>
|
||||
{/if}
|
||||
</Tooltip>
|
||||
{#if !item?.write_access || item?.meta?.source === 'external'}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
{#if item?.meta?.source === 'external'}
|
||||
<Badge
|
||||
type="muted"
|
||||
content={item?.meta?.external?.provider ?? $i18n.t('Connected')}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={item?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={item?.user?.id
|
||||
? `/api/v1/users/${item.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
item?.user?.name ?? item?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs(item.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div
|
||||
class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400"
|
||||
>
|
||||
{dayjs(item.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if metaPreview}
|
||||
<Tooltip content={metaPreview} className="min-w-0" placement="top-start">
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{metaPreview}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
modal
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'knowledge', resource_id: item.id }}
|
||||
/>
|
||||
{#if item?.write_access || $user?.role === 'admin'}
|
||||
<div class="flex shrink-0 flex-row items-center self-center">
|
||||
<ItemMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={item.id}
|
||||
accessHandler={$user?.permissions?.sharing?.knowledge ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(item.id)
|
||||
: null}
|
||||
onExport={$user?.role === 'admin'
|
||||
? () => {
|
||||
exportHandler(item);
|
||||
}
|
||||
: null}
|
||||
on:delete={() => {
|
||||
selectedItem = item;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if !allItemsLoaded}
|
||||
<Loader
|
||||
on:visible={(e) => {
|
||||
if (!itemsLoading) {
|
||||
loadMoreItems();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="w-full flex justify-center py-4 text-xs animate-pulse items-center gap-2">
|
||||
<Spinner className=" size-4" />
|
||||
<div class=" ">{$i18n.t('Loading...')}</div>
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={item?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={item?.user?.id
|
||||
? `/api/v1/users/${item.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
item?.user?.name ?? item?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs(item.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400">
|
||||
{dayjs(item.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
<CommentsDropdown
|
||||
bind:view={comments}
|
||||
showResource
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'knowledge', resource_id: item.id }}
|
||||
/>
|
||||
{#if item?.write_access || $user?.role === 'admin'}
|
||||
<div class="flex shrink-0 flex-row items-center self-center">
|
||||
<ItemMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={item.id}
|
||||
accessHandler={$user?.permissions?.sharing?.knowledge ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(item.id)
|
||||
: null}
|
||||
onExport={$user?.role === 'admin'
|
||||
? () => {
|
||||
exportHandler(item);
|
||||
}
|
||||
: null}
|
||||
on:delete={() => {
|
||||
selectedItem = item;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</Loader>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No knowledge found') : $i18n.t('No knowledge yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if !allItemsLoaded}
|
||||
<Loader
|
||||
on:visible={(e) => {
|
||||
if (!itemsLoading) {
|
||||
loadMoreItems();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="w-full flex justify-center py-4 text-xs animate-pulse items-center gap-2">
|
||||
<Spinner className=" size-4" />
|
||||
<div class=" ">{$i18n.t('Loading...')}</div>
|
||||
</div>
|
||||
</Loader>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center py-10">
|
||||
<Spinner className="size-4" />
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No knowledge found') : $i18n.t('No knowledge yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
</Comments>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center py-10">
|
||||
<Spinner className="size-4" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
@@ -2,10 +2,9 @@
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@@ -944,214 +943,213 @@
|
||||
}}
|
||||
/>
|
||||
|
||||
<Comments bind:view={comments} resourceType="knowledge">
|
||||
<div
|
||||
class="flex h-full min-h-0 w-full flex-col overflow-hidden"
|
||||
id="collection-container"
|
||||
bind:this={collection}
|
||||
>
|
||||
{#if id && knowledge}
|
||||
<AccessControlModal
|
||||
bind:show={showAccessControlModal}
|
||||
bind:accessGrants={knowledge.access_grants}
|
||||
share={$user?.permissions?.sharing?.knowledge || $user?.role === 'admin'}
|
||||
sharePublic={$user?.permissions?.sharing?.public_knowledge || $user?.role === 'admin'}
|
||||
shareUsers={($user?.permissions?.access_grants?.allow_users ?? true) ||
|
||||
$user?.role === 'admin'}
|
||||
allowGroups={($user?.permissions?.access_grants?.allow_groups ?? true) ||
|
||||
$user?.role === 'admin'}
|
||||
onChange={async () => {
|
||||
try {
|
||||
const saved = await updateKnowledgeAccessGrants(
|
||||
localStorage.token,
|
||||
id,
|
||||
knowledge.access_grants ?? []
|
||||
);
|
||||
savedAccessGrants = structuredClone(saved.access_grants);
|
||||
toast.success($i18n.t('Saved'));
|
||||
} catch (error) {
|
||||
knowledge.access_grants = structuredClone(savedAccessGrants);
|
||||
toast.error(`${error}`);
|
||||
}
|
||||
}}
|
||||
accessRoles={['read', 'write']}
|
||||
/>
|
||||
<div class="flex min-h-7 shrink-0 items-center justify-between gap-2 pr-0.5">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
on:click={() => goto('/workspace/knowledge')}
|
||||
><ChevronLeft className="size-3" strokeWidth="2" />{$i18n.t('Back')}</button
|
||||
>
|
||||
<!-- Previous file count label: {$i18n.t('{{COUNT}} files')} -->
|
||||
<div class="flex items-center gap-2">
|
||||
{#if !isExternalKnowledge && knowledge?.id}<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
wrapperClassName="me-1"
|
||||
resource={{ resource_type: 'knowledge', resource_id: knowledge.id }}
|
||||
/>{/if}
|
||||
{#if !isExternalKnowledge && (knowledge.user_id === $user?.id || $user?.role === 'admin')}
|
||||
<Dropdown closeOnSelect align="end">
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('More Options')}
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-500 hover:bg-base-100 dark:hover:bg-base-800"
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
<div slot="content">
|
||||
<DropdownMenu className="min-w-36">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-[1.6875rem] w-full items-center gap-2 rounded-xl px-2 text-xs hover:text-base-900 dark:hover:text-base-100"
|
||||
on:click={() => {
|
||||
showSettings = true;
|
||||
}}
|
||||
>
|
||||
<Cog6 className="size-3.5" />
|
||||
{$i18n.t('Settings')}
|
||||
</button>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
<div
|
||||
class="flex h-full min-h-0 w-full flex-col overflow-hidden"
|
||||
id="collection-container"
|
||||
bind:this={collection}
|
||||
>
|
||||
{#if id && knowledge}
|
||||
<AccessControlModal
|
||||
bind:show={showAccessControlModal}
|
||||
bind:accessGrants={knowledge.access_grants}
|
||||
share={$user?.permissions?.sharing?.knowledge || $user?.role === 'admin'}
|
||||
sharePublic={$user?.permissions?.sharing?.public_knowledge || $user?.role === 'admin'}
|
||||
shareUsers={($user?.permissions?.access_grants?.allow_users ?? true) ||
|
||||
$user?.role === 'admin'}
|
||||
allowGroups={($user?.permissions?.access_grants?.allow_groups ?? true) ||
|
||||
$user?.role === 'admin'}
|
||||
onChange={async () => {
|
||||
try {
|
||||
const saved = await updateKnowledgeAccessGrants(
|
||||
localStorage.token,
|
||||
id,
|
||||
knowledge.access_grants ?? []
|
||||
);
|
||||
savedAccessGrants = structuredClone(saved.access_grants);
|
||||
toast.success($i18n.t('Saved'));
|
||||
} catch (error) {
|
||||
knowledge.access_grants = structuredClone(savedAccessGrants);
|
||||
toast.error(`${error}`);
|
||||
}
|
||||
}}
|
||||
accessRoles={['read', 'write']}
|
||||
/>
|
||||
<div class="flex min-h-7 shrink-0 items-center justify-between gap-2 pr-0.5">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
on:click={() => goto('/workspace/knowledge')}
|
||||
><ChevronLeft className="size-3" strokeWidth="2" />{$i18n.t('Back')}</button
|
||||
>
|
||||
<!-- Previous file count label: {$i18n.t('{{COUNT}} files')} -->
|
||||
<div class="flex items-center gap-2">
|
||||
{#if !isExternalKnowledge && knowledge?.id}<CommentsDropdown
|
||||
bind:view={comments}
|
||||
deepLink
|
||||
wrapperClassName="me-1"
|
||||
resource={{ resource_type: 'knowledge', resource_id: knowledge.id }}
|
||||
/>{/if}
|
||||
{#if !isExternalKnowledge && (knowledge.user_id === $user?.id || $user?.role === 'admin')}
|
||||
<Dropdown closeOnSelect align="end">
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('More Options')}
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-500 hover:bg-base-100 dark:hover:bg-base-800"
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
<div slot="content">
|
||||
<DropdownMenu className="min-w-36">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-[1.6875rem] w-full items-center gap-2 rounded-xl px-2 text-xs hover:text-base-900 dark:hover:text-base-100"
|
||||
on:click={() => {
|
||||
showSettings = true;
|
||||
}}
|
||||
>
|
||||
<Cog6 className="size-3.5" />
|
||||
{$i18n.t('Settings')}
|
||||
</button>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
{/if}
|
||||
{#if knowledge.write_access}
|
||||
{#if $user?.permissions?.sharing?.knowledge || $user?.role === 'admin'}
|
||||
<AccessButton
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(knowledge.access_grants ?? []);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{#if knowledge.write_access}
|
||||
{#if $user?.permissions?.sharing?.knowledge || $user?.role === 'admin'}
|
||||
<AccessButton
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(knowledge.access_grants ?? []);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{:else}
|
||||
<span class="text-xs text-base-500">{$i18n.t('Read Only')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<span class="text-xs text-base-500">{$i18n.t('Read Only')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="shrink-0 px-1 pb-2.5">
|
||||
</div>
|
||||
<div class="shrink-0 px-1 pb-2.5">
|
||||
<input
|
||||
class="w-full bg-transparent text-sm outline-hidden"
|
||||
bind:value={knowledge.name}
|
||||
aria-label={$i18n.t('Knowledge Name')}
|
||||
placeholder={$i18n.t('Knowledge Name')}
|
||||
disabled={!knowledge.write_access}
|
||||
on:input={changeDebounceHandler}
|
||||
/>
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
<input
|
||||
class="w-full bg-transparent text-sm outline-hidden"
|
||||
bind:value={knowledge.name}
|
||||
aria-label={$i18n.t('Knowledge Name')}
|
||||
placeholder={$i18n.t('Knowledge Name')}
|
||||
class="min-w-0 flex-1 bg-transparent outline-hidden"
|
||||
bind:value={knowledge.description}
|
||||
aria-label={$i18n.t('Knowledge Description')}
|
||||
placeholder={$i18n.t('Knowledge Description')}
|
||||
disabled={!knowledge.write_access}
|
||||
on:input={changeDebounceHandler}
|
||||
/>
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
<input
|
||||
class="min-w-0 flex-1 bg-transparent outline-hidden"
|
||||
bind:value={knowledge.description}
|
||||
aria-label={$i18n.t('Knowledge Description')}
|
||||
placeholder={$i18n.t('Knowledge Description')}
|
||||
disabled={!knowledge.write_access}
|
||||
on:input={changeDebounceHandler}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
title={$i18n.t('Click to copy ID')}
|
||||
class="max-w-[40%] shrink-0 truncate font-mono"
|
||||
on:click={() => {
|
||||
copyToClipboard(id);
|
||||
toast.success($i18n.t('ID copied to clipboard'));
|
||||
}}>{id}</button
|
||||
>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
title={$i18n.t('Click to copy ID')}
|
||||
class="max-w-[40%] shrink-0 truncate font-mono"
|
||||
on:click={() => {
|
||||
copyToClipboard(id);
|
||||
toast.success($i18n.t('ID copied to clipboard'));
|
||||
}}>{id}</button
|
||||
>
|
||||
</div>
|
||||
<div class="mb-2 min-h-0 flex-1">
|
||||
{#if isExternalKnowledge}<div
|
||||
class="h-full overflow-auto rounded-2xl border border-base-100/80 dark:border-base-0/[0.04]"
|
||||
>
|
||||
<div class="p-5 flex flex-col gap-4">
|
||||
<div class="flex flex-wrap gap-2 text-xs">
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{$i18n.t('Connected')}
|
||||
</div>
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{$i18n.t('Read Only')}
|
||||
</div>
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{knowledge?.meta?.external?.provider ?? $i18n.t('Provider')}
|
||||
</div>
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{$i18n.t('Service Account')}
|
||||
</div>
|
||||
<div class="mb-2 min-h-0 flex-1">
|
||||
{#if isExternalKnowledge}<div
|
||||
class="h-full overflow-auto rounded-2xl border border-base-100/80 dark:border-base-0/[0.04]"
|
||||
>
|
||||
<div class="p-5 flex flex-col gap-4">
|
||||
<div class="flex flex-wrap gap-2 text-xs">
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{$i18n.t('Connected')}
|
||||
</div>
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{$i18n.t('Read Only')}
|
||||
</div>
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{knowledge?.meta?.external?.provider ?? $i18n.t('Provider')}
|
||||
</div>
|
||||
<div class="px-2 py-1 rounded-lg bg-base-50 dark:bg-base-850">
|
||||
{$i18n.t('Service Account')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-sm">
|
||||
<div>
|
||||
<div class="text-xs text-base-500 mb-1">{$i18n.t('Mapped Source')}</div>
|
||||
<div class="rounded-xl bg-base-50 dark:bg-base-850 px-3 py-2">
|
||||
{knowledge?.meta?.external?.source?.name ?? $i18n.t('Not configured')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-sm">
|
||||
<div>
|
||||
<div class="text-xs text-base-500 mb-1">{$i18n.t('Mapped Source')}</div>
|
||||
<div class="rounded-xl bg-base-50 dark:bg-base-850 px-3 py-2">
|
||||
{knowledge?.meta?.external?.source?.name ?? $i18n.t('Not configured')}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-xs text-base-500 mb-1">{$i18n.t('Auth Mode')}</div>
|
||||
<div class="rounded-xl bg-base-50 dark:bg-base-850 px-3 py-2">
|
||||
{$i18n.t('Admin-managed service account')}
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-xs text-base-500 mb-1">{$i18n.t('Auth Mode')}</div>
|
||||
<div class="rounded-xl bg-base-50 dark:bg-base-850 px-3 py-2">
|
||||
{$i18n.t('Admin-managed service account')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-xs text-base-500">
|
||||
<!-- LICENSE covers this Open WebUI wordmark.
|
||||
<div class="text-xs text-base-500">
|
||||
<!-- LICENSE covers this Open WebUI wordmark.
|
||||
Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
https://docs.openwebui.com/license. -->
|
||||
{$i18n.t(
|
||||
'This knowledge base retrieves from a connected source. Open WebUI can query it, but cannot upload, sync, edit, delete, reset, or reindex its source data.'
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="text-xs">{$i18n.t('Test Query')}</div>
|
||||
<div class="flex gap-2">
|
||||
<input
|
||||
aria-label={$i18n.t('Test Query')}
|
||||
class="w-full text-xs rounded-xl bg-base-50 dark:bg-base-850 px-3 py-2 outline-hidden"
|
||||
bind:value={externalTestQuery}
|
||||
placeholder={$i18n.t('Ask this knowledge source a test question')}
|
||||
/>
|
||||
<button
|
||||
class="flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs font-normal text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
on:click={externalTestHandler}
|
||||
>
|
||||
{$i18n.t('Test')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if externalTestResult}
|
||||
<div class="rounded-xl bg-base-50 dark:bg-base-850 p-3 text-xs">
|
||||
<div class="mb-2">{$i18n.t('Preview')}</div>
|
||||
{#each externalTestResult.documents ?? [] as document, idx}
|
||||
<div class="border-t border-base-100 dark:border-base-800 py-2">
|
||||
<div class="line-clamp-4">{document}</div>
|
||||
<div class="text-base-500 mt-1">
|
||||
{externalTestResult.metadatas?.[idx]?.source ?? ''}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{$i18n.t(
|
||||
'This knowledge base retrieves from a connected source. Open WebUI can query it, but cannot upload, sync, edit, delete, reset, or reindex its source data.'
|
||||
)}
|
||||
</div>
|
||||
</div>{:else}
|
||||
<KnowledgeBrowser
|
||||
bind:this={browser}
|
||||
{knowledge}
|
||||
transfers={fileItems}
|
||||
{syncing}
|
||||
onUpload={requestUpload}
|
||||
onSync={async () => {
|
||||
pendingSyncFiles = await collectDirectoryFiles();
|
||||
if (pendingSyncFiles?.length) showSyncConfirmModal = true;
|
||||
}}
|
||||
onReset={() => (showResetConfirm = true)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}<Spinner className="size-5" />{/if}
|
||||
</div>
|
||||
</Comments>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="text-xs">{$i18n.t('Test Query')}</div>
|
||||
<div class="flex gap-2">
|
||||
<input
|
||||
aria-label={$i18n.t('Test Query')}
|
||||
class="w-full text-xs rounded-xl bg-base-50 dark:bg-base-850 px-3 py-2 outline-hidden"
|
||||
bind:value={externalTestQuery}
|
||||
placeholder={$i18n.t('Ask this knowledge source a test question')}
|
||||
/>
|
||||
<button
|
||||
class="flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs font-normal text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
on:click={externalTestHandler}
|
||||
>
|
||||
{$i18n.t('Test')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if externalTestResult}
|
||||
<div class="rounded-xl bg-base-50 dark:bg-base-850 p-3 text-xs">
|
||||
<div class="mb-2">{$i18n.t('Preview')}</div>
|
||||
{#each externalTestResult.documents ?? [] as document, idx}
|
||||
<div class="border-t border-base-100 dark:border-base-800 py-2">
|
||||
<div class="line-clamp-4">{document}</div>
|
||||
<div class="text-base-500 mt-1">
|
||||
{externalTestResult.metadatas?.[idx]?.source ?? ''}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>{:else}
|
||||
<KnowledgeBrowser
|
||||
bind:this={browser}
|
||||
{knowledge}
|
||||
transfers={fileItems}
|
||||
{syncing}
|
||||
onUpload={requestUpload}
|
||||
onSync={async () => {
|
||||
pendingSyncFiles = await collectDirectoryFiles();
|
||||
if (pendingSyncFiles?.length) showSyncConfirmModal = true;
|
||||
}}
|
||||
onReset={() => (showResetConfirm = true)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}<Spinner className="size-5" />{/if}
|
||||
</div>
|
||||
|
||||
<Modal bind:show={showSettings} size="md" ariaLabel={$i18n.t('Settings')}>
|
||||
{#if knowledge}
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import WorkspaceAccessModal from './common/WorkspaceAccessModal.svelte';
|
||||
let accessModal: WorkspaceAccessModal;
|
||||
import dayjs from 'dayjs';
|
||||
@@ -522,519 +521,515 @@
|
||||
|
||||
<h1 class="sr-only">{$i18n.t('Models')}</h1>
|
||||
|
||||
<Comments modal bind:view={comments} resourceType="model">
|
||||
{#if loaded && models !== null && total !== null}
|
||||
<ModelDeleteConfirmDialog
|
||||
bind:show={showModelDeleteConfirm}
|
||||
on:confirm={() => {
|
||||
deleteModelHandler(selectedModel);
|
||||
}}
|
||||
/>
|
||||
{#if loaded && models !== null && total !== null}
|
||||
<ModelDeleteConfirmDialog
|
||||
bind:show={showModelDeleteConfirm}
|
||||
on:confirm={() => {
|
||||
deleteModelHandler(selectedModel);
|
||||
}}
|
||||
/>
|
||||
|
||||
<input
|
||||
id="models-import-input"
|
||||
bind:this={modelsImportInputElement}
|
||||
bind:files={importFiles}
|
||||
type="file"
|
||||
accept=".json"
|
||||
hidden
|
||||
on:change={() => {
|
||||
console.log(importFiles);
|
||||
<input
|
||||
id="models-import-input"
|
||||
bind:this={modelsImportInputElement}
|
||||
bind:files={importFiles}
|
||||
type="file"
|
||||
accept=".json"
|
||||
hidden
|
||||
on:change={() => {
|
||||
console.log(importFiles);
|
||||
|
||||
let reader = new FileReader();
|
||||
reader.onload = async (event) => {
|
||||
let savedModels = [];
|
||||
try {
|
||||
savedModels = JSON.parse(event.target.result);
|
||||
console.log(savedModels);
|
||||
} catch (e) {
|
||||
toast.error($i18n.t('Invalid JSON file'));
|
||||
return;
|
||||
}
|
||||
let reader = new FileReader();
|
||||
reader.onload = async (event) => {
|
||||
let savedModels = [];
|
||||
try {
|
||||
savedModels = JSON.parse(event.target.result);
|
||||
console.log(savedModels);
|
||||
} catch (e) {
|
||||
toast.error($i18n.t('Invalid JSON file'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Array.isArray(savedModels)) {
|
||||
toast.error($i18n.t('Invalid JSON file'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await importModels(
|
||||
localStorage.token,
|
||||
savedModels.map((model) => model.info ?? model)
|
||||
);
|
||||
} catch (error: any) {
|
||||
toast.error(`${error?.detail ?? error}`);
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(savedModels)) {
|
||||
toast.error($i18n.t('Invalid JSON file'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await importModels(
|
||||
localStorage.token,
|
||||
savedModels.map((model) => model.info ?? model)
|
||||
);
|
||||
} catch (error: any) {
|
||||
toast.error(`${error?.detail ?? error}`);
|
||||
return;
|
||||
}
|
||||
|
||||
await _models.set(await getModels(localStorage.token));
|
||||
await _models.set(await getModels(localStorage.token));
|
||||
|
||||
page = 1;
|
||||
getModelList();
|
||||
};
|
||||
page = 1;
|
||||
getModelList();
|
||||
};
|
||||
|
||||
reader.readAsText(importFiles[0]);
|
||||
}}
|
||||
/>
|
||||
reader.readAsText(importFiles[0]);
|
||||
}}
|
||||
/>
|
||||
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 flex-1 items-center w-full gap-2">
|
||||
<div class="flex min-w-0 flex-1 items-center">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
<input
|
||||
class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
aria-label={$i18n.t('Search Models')}
|
||||
placeholder={$i18n.t('Search Models')}
|
||||
maxlength="500"
|
||||
on:input={() => {
|
||||
searchController?.abort();
|
||||
clearTimeout(searchDebounceTimer);
|
||||
searchDebounceTimer = setTimeout(() => {
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 flex-1 items-center w-full gap-2">
|
||||
<div class="flex min-w-0 flex-1 items-center">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
<input
|
||||
class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
aria-label={$i18n.t('Search Models')}
|
||||
placeholder={$i18n.t('Search Models')}
|
||||
maxlength="500"
|
||||
on:input={() => {
|
||||
searchController?.abort();
|
||||
clearTimeout(searchDebounceTimer);
|
||||
searchDebounceTimer = setTimeout(() => {
|
||||
page = 1;
|
||||
getModelList();
|
||||
}, 300);
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
page = 1;
|
||||
getModelList();
|
||||
}, 300);
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex max-w-[60%] shrink-0 items-center gap-1 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
page = 1;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
page = 1;
|
||||
getModelList();
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex max-w-[60%] shrink-0 items-center gap-1 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
{#if (tags ?? []).length > 0}
|
||||
<TagSelector
|
||||
bind:value={selectedTag}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
items={tags.map((tag) => {
|
||||
return { value: tag, label: tag };
|
||||
})}
|
||||
onChange={async () => {
|
||||
page = 1;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if (tags ?? []).length > 0}
|
||||
<TagSelector
|
||||
bind:value={selectedTag}
|
||||
align="end"
|
||||
items={tags.map((tag) => {
|
||||
return { value: tag, label: tag };
|
||||
})}
|
||||
onChange={async () => {
|
||||
page = 1;
|
||||
await tick();
|
||||
<Dropdown align="end">
|
||||
<Tooltip content={$i18n.t('Actions')}>
|
||||
<button
|
||||
class="flex h-8 min-w-0 max-w-28 items-center gap-1.5 rounded-xl bg-transparent px-1.5 text-[0.8125rem] font-normal text-base-700 transition hover:text-base-900 dark:text-base-200 dark:hover:text-base-100"
|
||||
type="button"
|
||||
>
|
||||
<span class="min-w-0 truncate">{$i18n.t('Actions')}</span>
|
||||
<ChevronDown className="size-3" strokeWidth="2.5" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<div slot="content">
|
||||
<DropdownMenu className="min-w-[10.625rem] shadow-sm">
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
enableAllHandler();
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
>
|
||||
<CheckCircle className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Enable All')}</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
disableAllHandler();
|
||||
}}
|
||||
>
|
||||
<Minus className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Disable All')}</div>
|
||||
</button>
|
||||
|
||||
<hr class="mx-1 my-0.5 border-base-100 dark:border-base-800" />
|
||||
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
showAllHandler();
|
||||
}}
|
||||
>
|
||||
<Eye className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Show All')}</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
hideAllHandler();
|
||||
}}
|
||||
>
|
||||
<EyeSlash className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Hide All')}</div>
|
||||
</button>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if models !== null}
|
||||
{#if (models ?? []).length !== 0}
|
||||
<!-- Previous labels retained for i18n extraction: {$i18n.t('Sort by')} -->
|
||||
<div class="@container" id="model-list">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
|
||||
<Dropdown align="end">
|
||||
<Tooltip content={$i18n.t('Actions')}>
|
||||
<button
|
||||
class="flex h-8 min-w-0 max-w-28 items-center gap-1.5 rounded-xl bg-transparent px-1.5 text-[0.8125rem] font-normal text-base-700 transition hover:text-base-900 dark:text-base-200 dark:hover:text-base-100"
|
||||
type="button"
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each models as model (model.id)}
|
||||
{@const localizedModelName = resolveLocalizedModelName(model, $i18n.language)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group text-left {model.write_access
|
||||
? 'cursor-pointer'
|
||||
: ''} {model?.meta?.hidden ? 'opacity-50 dark:opacity-50' : ''}"
|
||||
id="model-item-{model.id}"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openModel(model);
|
||||
}}
|
||||
>
|
||||
<span class="min-w-0 truncate">{$i18n.t('Actions')}</span>
|
||||
<ChevronDown className="size-3" strokeWidth="2.5" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<div slot="content">
|
||||
<DropdownMenu className="min-w-[10.625rem] shadow-sm">
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
enableAllHandler();
|
||||
}}
|
||||
>
|
||||
<CheckCircle className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Enable All')}</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
disableAllHandler();
|
||||
}}
|
||||
>
|
||||
<Minus className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Disable All')}</div>
|
||||
</button>
|
||||
|
||||
<hr class="mx-1 my-0.5 border-base-100 dark:border-base-800" />
|
||||
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
showAllHandler();
|
||||
}}
|
||||
>
|
||||
<Eye className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Show All')}</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
hideAllHandler();
|
||||
}}
|
||||
>
|
||||
<EyeSlash className="size-3.5" />
|
||||
<div class="flex items-center">{$i18n.t('Hide All')}</div>
|
||||
</button>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if models !== null}
|
||||
{#if (models ?? []).length !== 0}
|
||||
<!-- Previous labels retained for i18n extraction: {$i18n.t('Sort by')} -->
|
||||
<div class="@container" id="model-list">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each models as model (model.id)}
|
||||
{@const localizedModelName = resolveLocalizedModelName(model, $i18n.language)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group text-left {model.write_access
|
||||
? 'cursor-pointer'
|
||||
: ''} {model?.meta?.hidden ? 'opacity-50 dark:opacity-50' : ''}"
|
||||
id="model-item-{model.id}"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openModel(model);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<div class="shrink-0 self-center">
|
||||
<div
|
||||
class="{model.is_active ? '' : 'opacity-50 dark:opacity-50'} bg-transparent"
|
||||
>
|
||||
<img
|
||||
src={`${WEBUI_API_BASE_URL}/models/model/profile/image?id=${model.id}&lang=${$i18n.language}`}
|
||||
alt=""
|
||||
class="size-7 rounded-lg object-cover"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
on:error={(e) => {
|
||||
// LICENSE covers this Open WebUI fallback logo.
|
||||
// Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
// https://docs.openwebui.com/license.
|
||||
e.target.src = '/favicon.png';
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<div class="shrink-0 self-center">
|
||||
<div
|
||||
class="{model.is_active ? '' : 'opacity-50 dark:opacity-50'} bg-transparent"
|
||||
>
|
||||
<img
|
||||
src={`${WEBUI_API_BASE_URL}/models/model/profile/image?id=${model.id}&lang=${$i18n.language}`}
|
||||
alt=""
|
||||
class="size-7 rounded-lg object-cover"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
on:error={(e) => {
|
||||
// LICENSE covers this Open WebUI fallback logo.
|
||||
// Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
// https://docs.openwebui.com/license.
|
||||
e.target.src = '/favicon.png';
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<Tooltip content={model.id} className="min-w-0" placement="top-start">
|
||||
{#if model.write_access}
|
||||
<a
|
||||
href={`/workspace/models/edit?id=${encodeURIComponent(model.id)}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{localizedModelName}</a
|
||||
>
|
||||
{:else}
|
||||
<span
|
||||
class="block truncate text-[0.8125rem] leading-5 text-base-800 dark:text-base-200"
|
||||
>{localizedModelName}</span
|
||||
>
|
||||
{/if}
|
||||
</Tooltip>
|
||||
{#if !model.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Try in chat')}
|
||||
className="-ml-0.5 h-5 w-4 shrink-0"
|
||||
tippyOptions={{ trigger: 'mouseenter focusin' }}
|
||||
>
|
||||
</div>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<Tooltip content={model.id} className="min-w-0" placement="top-start">
|
||||
{#if model.write_access}
|
||||
<a
|
||||
href={`/?model=${encodeURIComponent(model.id)}`}
|
||||
aria-label={`${$i18n.t('Try in chat')}: ${localizedModelName}`}
|
||||
class="focus-ring flex h-5 w-4 items-center justify-center rounded text-base-400 hover:text-base-700 dark:text-base-500 dark:hover:text-base-200"
|
||||
><ArrowRight className="size-3 -rotate-45" strokeWidth="2" /></a
|
||||
href={`/workspace/models/edit?id=${encodeURIComponent(model.id)}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{localizedModelName}</a
|
||||
>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<span
|
||||
class="block truncate text-[0.8125rem] leading-5 text-base-800 dark:text-base-200"
|
||||
>{localizedModelName}</span
|
||||
>
|
||||
{/if}
|
||||
</Tooltip>
|
||||
{#if !model.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
<div class="mt-0.5 min-w-0">
|
||||
<Tooltip
|
||||
content={(
|
||||
resolveLocalizedModelDescription(model, $i18n.language) ?? ''
|
||||
).trim() || $i18n.t('No description')}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
content={$i18n.t('Try in chat')}
|
||||
className="-ml-0.5 h-5 w-4 shrink-0"
|
||||
tippyOptions={{ trigger: 'mouseenter focusin' }}
|
||||
>
|
||||
<div
|
||||
class="truncate text-xs leading-4 text-base-500 dark:text-base-400"
|
||||
<a
|
||||
href={`/?model=${encodeURIComponent(model.id)}`}
|
||||
aria-label={`${$i18n.t('Try in chat')}: ${localizedModelName}`}
|
||||
class="focus-ring flex h-5 w-4 items-center justify-center rounded text-base-400 hover:text-base-700 dark:text-base-500 dark:hover:text-base-200"
|
||||
><ArrowRight className="size-3 -rotate-45" strokeWidth="2" /></a
|
||||
>
|
||||
{(
|
||||
resolveLocalizedModelDescription(model, $i18n.language) ?? ''
|
||||
).trim() || $i18n.t('No description')}
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={model?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={model?.user?.id
|
||||
? `/api/v1/users/${model.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
model?.user?.name ?? model?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs(model.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<span class="text-xs leading-5 text-base-500 dark:text-base-400"
|
||||
>{dayjs(model.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}</span
|
||||
>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
{#if shiftKey && model.write_access}
|
||||
<Tooltip content={model?.meta?.hidden ? $i18n.t('Show') : $i18n.t('Hide')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={model?.meta?.hidden ? $i18n.t('Show') : $i18n.t('Hide')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
hideModelHandler(model);
|
||||
}}
|
||||
>
|
||||
{#if model?.meta?.hidden}
|
||||
<EyeSlash className="size-4" />
|
||||
{:else}
|
||||
<Eye className="size-4" />
|
||||
{/if}
|
||||
</button>
|
||||
<div class="mt-0.5 min-w-0">
|
||||
<Tooltip
|
||||
content={(
|
||||
resolveLocalizedModelDescription(model, $i18n.language) ?? ''
|
||||
).trim() || $i18n.t('No description')}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
>
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{(
|
||||
resolveLocalizedModelDescription(model, $i18n.language) ?? ''
|
||||
).trim() || $i18n.t('No description')}
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
confirmDeleteModel(model);
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
modal
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'model', resource_id: model.id }}
|
||||
/>
|
||||
<ModelMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
accessHandler={$user?.permissions?.sharing?.models ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(model.id)
|
||||
: null}
|
||||
user={$user}
|
||||
{model}
|
||||
writeAccess={model.write_access}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/models/edit?id=${encodeURIComponent(model.id)}`);
|
||||
}}
|
||||
shareHandler={() => {
|
||||
shareModelHandler(model);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneModelHandler(model);
|
||||
}}
|
||||
exportHandler={() => {
|
||||
exportModelHandler(model);
|
||||
}}
|
||||
hideHandler={() => {
|
||||
hideModelHandler(model);
|
||||
}}
|
||||
pinModelHandler={() => {
|
||||
pinModelHandler(model.id);
|
||||
}}
|
||||
copyLinkHandler={() => {
|
||||
copyLinkHandler(model);
|
||||
}}
|
||||
deleteHandler={() => {
|
||||
confirmDeleteModel(model);
|
||||
}}
|
||||
onClose={() => {}}
|
||||
>
|
||||
<div
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</div>
|
||||
</ModelMenu>
|
||||
|
||||
{#if model.write_access}
|
||||
<Tooltip
|
||||
content={updatingModels[model.id]
|
||||
? $i18n.t('Saving...')
|
||||
: model.is_active
|
||||
? $i18n.t('Enabled')
|
||||
: $i18n.t('Disabled')}
|
||||
>
|
||||
<Switch
|
||||
bind:state={model.is_active}
|
||||
disabled={updatingModels[model.id] ?? false}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${localizedModelName}`}
|
||||
on:change={() => toggleModelHandler(model)}
|
||||
/>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<Switch
|
||||
state={model.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${localizedModelName}`}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if total > 30}
|
||||
<Pagination bind:page count={total} perPage={30} />
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No models found') : $i18n.t('No models yet')}
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={model?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={model?.user?.id
|
||||
? `/api/v1/users/${model.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
model?.user?.name ?? model?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs(model.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<span class="text-xs leading-5 text-base-500 dark:text-base-400"
|
||||
>{dayjs(model.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}</span
|
||||
>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
{#if shiftKey && model.write_access}
|
||||
<Tooltip content={model?.meta?.hidden ? $i18n.t('Show') : $i18n.t('Hide')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={model?.meta?.hidden ? $i18n.t('Show') : $i18n.t('Hide')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
hideModelHandler(model);
|
||||
}}
|
||||
>
|
||||
{#if model?.meta?.hidden}
|
||||
<EyeSlash className="size-4" />
|
||||
{:else}
|
||||
<Eye className="size-4" />
|
||||
{/if}
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
confirmDeleteModel(model);
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
<CommentsDropdown
|
||||
bind:view={comments}
|
||||
showResource
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'model', resource_id: model.id }}
|
||||
/>
|
||||
<ModelMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
accessHandler={$user?.permissions?.sharing?.models ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(model.id)
|
||||
: null}
|
||||
user={$user}
|
||||
{model}
|
||||
writeAccess={model.write_access}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/models/edit?id=${encodeURIComponent(model.id)}`);
|
||||
}}
|
||||
shareHandler={() => {
|
||||
shareModelHandler(model);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneModelHandler(model);
|
||||
}}
|
||||
exportHandler={() => {
|
||||
exportModelHandler(model);
|
||||
}}
|
||||
hideHandler={() => {
|
||||
hideModelHandler(model);
|
||||
}}
|
||||
pinModelHandler={() => {
|
||||
pinModelHandler(model.id);
|
||||
}}
|
||||
copyLinkHandler={() => {
|
||||
copyLinkHandler(model);
|
||||
}}
|
||||
deleteHandler={() => {
|
||||
confirmDeleteModel(model);
|
||||
}}
|
||||
onClose={() => {}}
|
||||
>
|
||||
<div
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</div>
|
||||
</ModelMenu>
|
||||
|
||||
{#if model.write_access}
|
||||
<Tooltip
|
||||
content={updatingModels[model.id]
|
||||
? $i18n.t('Saving...')
|
||||
: model.is_active
|
||||
? $i18n.t('Enabled')
|
||||
: $i18n.t('Disabled')}
|
||||
>
|
||||
<Switch
|
||||
bind:state={model.is_active}
|
||||
disabled={updatingModels[model.id] ?? false}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${localizedModelName}`}
|
||||
on:change={() => toggleModelHandler(model)}
|
||||
/>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<Switch
|
||||
state={model.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${localizedModelName}`}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if total > 30}
|
||||
<Pagination bind:page count={total} perPage={30} />
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center py-10">
|
||||
<Spinner className="size-4" />
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No models found') : $i18n.t('No models yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if $config?.features.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=model"
|
||||
title={$i18n.t('Discover a model')}
|
||||
description={$i18n.t('Discover, download, and explore model presets')}
|
||||
/>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center py-10">
|
||||
<Spinner className="size-4" />
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $config?.features.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=model"
|
||||
title={$i18n.t('Discover a model')}
|
||||
description={$i18n.t('Discover, download, and explore model presets')}
|
||||
/>
|
||||
{/if}
|
||||
</Comments>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,10 +3,9 @@
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import WorkspaceAccessModal from './common/WorkspaceAccessModal.svelte';
|
||||
let accessModal: WorkspaceAccessModal;
|
||||
import dayjs from 'dayjs';
|
||||
@@ -405,421 +404,419 @@
|
||||
|
||||
<h1 class="sr-only">{$i18n.t('Prompts')}</h1>
|
||||
|
||||
<Comments modal bind:view={comments} resourceType="prompt">
|
||||
{#if loaded && prompts !== null}
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
title={$i18n.t('Delete prompt?')}
|
||||
on:confirm={() => {
|
||||
deleteHandler(deletePrompt);
|
||||
}}
|
||||
>
|
||||
<div class=" text-sm text-base-500 truncate">
|
||||
{$i18n.t('This will delete')} <span class=" font-normal">{deletePrompt.command}</span>.
|
||||
</div>
|
||||
</DeleteConfirmDialog>
|
||||
{#if loaded && prompts !== null}
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
title={$i18n.t('Delete prompt?')}
|
||||
on:confirm={() => {
|
||||
deleteHandler(deletePrompt);
|
||||
}}
|
||||
>
|
||||
<div class=" text-sm text-base-500 truncate">
|
||||
{$i18n.t('This will delete')} <span class=" font-normal">{deletePrompt.command}</span>.
|
||||
</div>
|
||||
</DeleteConfirmDialog>
|
||||
|
||||
<Modal
|
||||
bind:show={showCreateModal}
|
||||
size="full"
|
||||
ariaLabel={createPrompt !== null ? $i18n.t('Clone Prompt') : $i18n.t('Create Prompt')}
|
||||
className="!w-[calc(100vw-2rem)] sm:!w-[calc(100vw-3rem)] lg:!w-[calc(100vw-4rem)] !max-w-[80rem] h-[min(54rem,calc(100dvh-4rem))] max-h-[calc(100dvh-4rem)] flex flex-col bg-base-0 dark:bg-base-900 rounded-4xl"
|
||||
>
|
||||
{#key createPrompt}
|
||||
<PromptEditor
|
||||
modal={true}
|
||||
prompt={createPrompt}
|
||||
clone={createPrompt !== null}
|
||||
onSubmit={createPromptHandler}
|
||||
onCancel={() => {
|
||||
closeCreateModal();
|
||||
}}
|
||||
/>
|
||||
{/key}
|
||||
</Modal>
|
||||
<Modal
|
||||
bind:show={showCreateModal}
|
||||
size="full"
|
||||
ariaLabel={createPrompt !== null ? $i18n.t('Clone Prompt') : $i18n.t('Create Prompt')}
|
||||
className="!w-[calc(100vw-2rem)] sm:!w-[calc(100vw-3rem)] lg:!w-[calc(100vw-4rem)] !max-w-[80rem] h-[min(54rem,calc(100dvh-4rem))] max-h-[calc(100dvh-4rem)] flex flex-col bg-base-0 dark:bg-base-900 rounded-4xl"
|
||||
>
|
||||
{#key createPrompt}
|
||||
<PromptEditor
|
||||
modal={true}
|
||||
prompt={createPrompt}
|
||||
clone={createPrompt !== null}
|
||||
onSubmit={createPromptHandler}
|
||||
onCancel={() => {
|
||||
closeCreateModal();
|
||||
}}
|
||||
/>
|
||||
{/key}
|
||||
</Modal>
|
||||
|
||||
<input
|
||||
id="prompts-import-input"
|
||||
bind:this={promptsImportInputElement}
|
||||
bind:files={importFiles}
|
||||
type="file"
|
||||
accept=".json"
|
||||
hidden
|
||||
on:change={() => {
|
||||
console.log(importFiles);
|
||||
if (!importFiles || importFiles.length === 0) return;
|
||||
<input
|
||||
id="prompts-import-input"
|
||||
bind:this={promptsImportInputElement}
|
||||
bind:files={importFiles}
|
||||
type="file"
|
||||
accept=".json"
|
||||
hidden
|
||||
on:change={() => {
|
||||
console.log(importFiles);
|
||||
if (!importFiles || importFiles.length === 0) return;
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = async (event) => {
|
||||
const savedPrompts = JSON.parse(event.target.result);
|
||||
console.log(savedPrompts);
|
||||
const reader = new FileReader();
|
||||
reader.onload = async (event) => {
|
||||
const savedPrompts = JSON.parse(event.target.result);
|
||||
console.log(savedPrompts);
|
||||
|
||||
try {
|
||||
for (const prompt of savedPrompts) {
|
||||
await createNewPrompt(localStorage.token, {
|
||||
command: prompt.command,
|
||||
name: prompt.name,
|
||||
content: prompt.content
|
||||
}).catch((error) => {
|
||||
toast.error(typeof error === 'string' ? error : JSON.stringify(error));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
page = 1;
|
||||
await getPromptList();
|
||||
} finally {
|
||||
importFiles = null;
|
||||
promptsImportInputElement.value = '';
|
||||
try {
|
||||
for (const prompt of savedPrompts) {
|
||||
await createNewPrompt(localStorage.token, {
|
||||
command: prompt.command,
|
||||
name: prompt.name,
|
||||
content: prompt.content
|
||||
}).catch((error) => {
|
||||
toast.error(typeof error === 'string' ? error : JSON.stringify(error));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsText(importFiles[0]);
|
||||
}}
|
||||
/>
|
||||
page = 1;
|
||||
await getPromptList();
|
||||
} finally {
|
||||
importFiles = null;
|
||||
promptsImportInputElement.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
reader.readAsText(importFiles[0]);
|
||||
}}
|
||||
/>
|
||||
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
<input
|
||||
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Prompts')}
|
||||
placeholder={$i18n.t('Search Prompts')}
|
||||
/>
|
||||
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
<input
|
||||
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Prompts')}
|
||||
placeholder={$i18n.t('Search Prompts')}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
page = 1;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
{#if (tags ?? []).length > 0}
|
||||
<TagSelector
|
||||
bind:value={selectedTag}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
items={tags.map((tag) => ({ value: tag, label: tag }))}
|
||||
onChange={async () => {
|
||||
page = 1;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if (tags ?? []).length > 0}
|
||||
<TagSelector
|
||||
bind:value={selectedTag}
|
||||
align="end"
|
||||
items={tags.map((tag) => ({ value: tag, label: tag }))}
|
||||
onChange={async () => {
|
||||
page = 1;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if prompts === null}
|
||||
<div class="w-full h-full flex justify-center items-center my-16 mb-24">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{:else if (prompts ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
{#if prompts === null}
|
||||
<div class="w-full h-full flex justify-center items-center my-16 mb-24">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{:else if (prompts ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each prompts as prompt (prompt.id)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group cursor-pointer text-left"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openPrompt(prompt);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip content={prompt.name} className="min-w-0" placement="top-start">
|
||||
<a
|
||||
href={`/workspace/prompts/${prompt.id}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{prompt.name}</a
|
||||
>
|
||||
</Tooltip>
|
||||
{#if !prompt.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if prompt.content}
|
||||
<Tooltip content={prompt.content} className="min-w-0" placement="top-start">
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{prompt.content}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each prompts as prompt (prompt.id)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group cursor-pointer text-left"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openPrompt(prompt);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip content={prompt.name} className="min-w-0" placement="top-start">
|
||||
<a
|
||||
href={`/workspace/prompts/${prompt.id}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{prompt.name}</a
|
||||
>
|
||||
</Tooltip>
|
||||
{#if !prompt.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={prompt?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={prompt?.user?.id
|
||||
? `/api/v1/users/${prompt.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
prompt?.user?.name ?? prompt?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs((prompt.updated_at ?? prompt.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400">
|
||||
{dayjs((prompt.updated_at ?? prompt.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
{#if shiftKey}
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
disabled={!prompt.write_access}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
deleteHandler(prompt);
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
</button>
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if prompt.content}
|
||||
<Tooltip content={prompt.content} className="min-w-0" placement="top-start">
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{prompt.content}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
<Tooltip content={$i18n.t('Copy Prompt')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Copy Prompt')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
copyHandler(prompt);
|
||||
}}
|
||||
>
|
||||
{#if copiedId === prompt.command}
|
||||
<Check className="size-4" strokeWidth="1.5" />
|
||||
{:else}
|
||||
<Clipboard className="size-4" strokeWidth="1.5" />
|
||||
{/if}
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
modal
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'prompt', resource_id: prompt.id }}
|
||||
/>
|
||||
<PromptMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={prompt.id}
|
||||
accessHandler={$user?.permissions?.sharing?.prompts ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(prompt.id)
|
||||
: null}
|
||||
writeAccess={prompt.write_access}
|
||||
show={openPromptMenuId === prompt.id}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/prompts/${prompt.id}`);
|
||||
}}
|
||||
shareHandler={() => {
|
||||
shareHandler(prompt);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneHandler(prompt);
|
||||
}}
|
||||
exportHandler={() => {
|
||||
exportHandler(prompt);
|
||||
}}
|
||||
deleteHandler={async () => {
|
||||
deletePrompt = prompt;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
onClose={() => {
|
||||
openPromptMenuId = null;
|
||||
}}
|
||||
>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Prompt Menu')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openPromptMenuId = openPromptMenuId === prompt.id ? null : prompt.id;
|
||||
}}
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
</PromptMenu>
|
||||
|
||||
{#if prompt.write_access}
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Tooltip
|
||||
content={prompt.is_active !== false
|
||||
? $i18n.t('Enabled')
|
||||
: $i18n.t('Disabled')}
|
||||
>
|
||||
<Switch
|
||||
bind:state={prompt.is_active}
|
||||
ariaLabel={$i18n.t('Enabled')}
|
||||
on:change={async () => {
|
||||
togglePromptById(localStorage.token, prompt.id);
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{:else}
|
||||
<Switch
|
||||
state={prompt.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${prompt.name}`}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if total > 30}
|
||||
<div class="flex justify-center mt-4 mb-2">
|
||||
<Pagination bind:page count={total} perPage={30} />
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No prompts found') : $i18n.t('No prompts yet')}
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={prompt?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={prompt?.user?.id
|
||||
? `/api/v1/users/${prompt.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
prompt?.user?.name ?? prompt?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs((prompt.updated_at ?? prompt.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400">
|
||||
{dayjs((prompt.updated_at ?? prompt.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
{#if shiftKey}
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
disabled={!prompt.write_access}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
deleteHandler(prompt);
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
<Tooltip content={$i18n.t('Copy Prompt')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Copy Prompt')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
copyHandler(prompt);
|
||||
}}
|
||||
>
|
||||
{#if copiedId === prompt.command}
|
||||
<Check className="size-4" strokeWidth="1.5" />
|
||||
{:else}
|
||||
<Clipboard className="size-4" strokeWidth="1.5" />
|
||||
{/if}
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<CommentsDropdown
|
||||
bind:view={comments}
|
||||
showResource
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'prompt', resource_id: prompt.id }}
|
||||
/>
|
||||
<PromptMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={prompt.id}
|
||||
accessHandler={$user?.permissions?.sharing?.prompts ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(prompt.id)
|
||||
: null}
|
||||
writeAccess={prompt.write_access}
|
||||
show={openPromptMenuId === prompt.id}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/prompts/${prompt.id}`);
|
||||
}}
|
||||
shareHandler={() => {
|
||||
shareHandler(prompt);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneHandler(prompt);
|
||||
}}
|
||||
exportHandler={() => {
|
||||
exportHandler(prompt);
|
||||
}}
|
||||
deleteHandler={async () => {
|
||||
deletePrompt = prompt;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
onClose={() => {
|
||||
openPromptMenuId = null;
|
||||
}}
|
||||
>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Prompt Menu')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openPromptMenuId = openPromptMenuId === prompt.id ? null : prompt.id;
|
||||
}}
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
</PromptMenu>
|
||||
|
||||
{#if prompt.write_access}
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Tooltip
|
||||
content={prompt.is_active !== false
|
||||
? $i18n.t('Enabled')
|
||||
: $i18n.t('Disabled')}
|
||||
>
|
||||
<Switch
|
||||
bind:state={prompt.is_active}
|
||||
ariaLabel={$i18n.t('Enabled')}
|
||||
on:change={async () => {
|
||||
togglePromptById(localStorage.token, prompt.id);
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{:else}
|
||||
<Switch
|
||||
state={prompt.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${prompt.name}`}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if total > 30}
|
||||
<div class="flex justify-center mt-4 mb-2">
|
||||
<Pagination bind:page count={total} perPage={30} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if $config?.features.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=prompt"
|
||||
title={$i18n.t('Discover a prompt')}
|
||||
description={$i18n.t('Discover, download, and explore custom prompts')}
|
||||
/>
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No prompts found') : $i18n.t('No prompts yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $config?.features.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=prompt"
|
||||
title={$i18n.t('Discover a prompt')}
|
||||
description={$i18n.t('Discover, download, and explore custom prompts')}
|
||||
/>
|
||||
{/if}
|
||||
</Comments>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
@@ -2,10 +2,9 @@
|
||||
import { getPageContext, onTabLeave } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import { onMount, onDestroy, tick, getContext } from 'svelte';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import type { i18n as i18nType } from 'i18next';
|
||||
@@ -443,316 +442,313 @@
|
||||
}}
|
||||
/>
|
||||
|
||||
<Comments bind:view={comments} resourceType={modal ? null : 'prompt'} {modal}>
|
||||
<div
|
||||
class="flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden {modal
|
||||
? 'px-5 pt-3 pb-1'
|
||||
: ''}"
|
||||
<div
|
||||
class="flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden {modal
|
||||
? 'px-5 pt-3 pb-1'
|
||||
: ''}"
|
||||
>
|
||||
<form
|
||||
class="flex h-full min-h-0 min-w-0 flex-col"
|
||||
aria-label={edit ? $i18n.t('Edit Prompt') : $i18n.t('Create Prompt')}
|
||||
inert={loading}
|
||||
on:submit|preventDefault={submitHandler}
|
||||
>
|
||||
<form
|
||||
class="flex h-full min-h-0 min-w-0 flex-col"
|
||||
aria-label={edit ? $i18n.t('Edit Prompt') : $i18n.t('Create Prompt')}
|
||||
inert={loading}
|
||||
on:submit|preventDefault={submitHandler}
|
||||
>
|
||||
<div class="flex min-h-7 shrink-0 items-center justify-between gap-2">
|
||||
{#if modal}
|
||||
<span class="text-xs text-base-500"
|
||||
>{clone ? $i18n.t('Clone Prompt') : $i18n.t('Create Prompt')}</span
|
||||
>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 transition-colors hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
on:click={() => goto('/workspace/prompts')}
|
||||
>
|
||||
<ChevronLeft className="size-3" strokeWidth="2" />{$i18n.t('Back')}
|
||||
</button>
|
||||
{/if}
|
||||
<div class="flex shrink-0 items-center gap-1 pr-0.5">
|
||||
{#if edit && prompt?.id}<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
wrapperClassName="me-2"
|
||||
resource={{ resource_type: 'prompt', resource_id: prompt.id }}
|
||||
<div class="flex min-h-7 shrink-0 items-center justify-between gap-2">
|
||||
{#if modal}
|
||||
<span class="text-xs text-base-500"
|
||||
>{clone ? $i18n.t('Clone Prompt') : $i18n.t('Create Prompt')}</span
|
||||
>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 transition-colors hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
on:click={() => goto('/workspace/prompts')}
|
||||
>
|
||||
<ChevronLeft className="size-3" strokeWidth="2" />{$i18n.t('Back')}
|
||||
</button>
|
||||
{/if}
|
||||
<div class="flex shrink-0 items-center gap-1 pr-0.5">
|
||||
{#if edit && prompt?.id}<CommentsDropdown
|
||||
bind:view={comments}
|
||||
deepLink={!modal}
|
||||
wrapperClassName="me-2"
|
||||
resource={{ resource_type: 'prompt', resource_id: prompt.id }}
|
||||
/>{/if}
|
||||
|
||||
{#if !disabled}{#if $user?.permissions?.sharing?.prompts || $user?.role === 'admin'}<AccessButton
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(accessGrants);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
/>{/if}
|
||||
|
||||
{#if !disabled}{#if $user?.permissions?.sharing?.prompts || $user?.role === 'admin'}<AccessButton
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(accessGrants);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
/>{/if}
|
||||
{:else}<span class="px-2 py-1 text-xs text-base-500">{$i18n.t('Read Only')}</span>{/if}
|
||||
{#if modal}<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('Close')}
|
||||
class="p-1 text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
on:click={() => confirmDiscard(() => onCancel())}><XMark className="size-4" /></button
|
||||
>{/if}
|
||||
</div>
|
||||
{:else}<span class="px-2 py-1 text-xs text-base-500">{$i18n.t('Read Only')}</span>{/if}
|
||||
{#if modal}<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('Close')}
|
||||
class="p-1 text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
on:click={() => confirmDiscard(() => onCancel())}><XMark className="size-4" /></button
|
||||
>{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 px-1 pb-2">
|
||||
<input
|
||||
class="w-full {($settings?.highContrastMode ?? false)
|
||||
? 'min-h-6'
|
||||
: ''} bg-transparent text-sm outline-hidden"
|
||||
placeholder={$i18n.t('Prompt Name')}
|
||||
aria-label={$i18n.t('Prompt Name')}
|
||||
bind:value={name}
|
||||
on:input={debouncedSaveMetadata}
|
||||
required
|
||||
{disabled}
|
||||
/>
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
<Tooltip
|
||||
className="min-w-0 flex-1"
|
||||
content={`${$i18n.t('Only alphanumeric characters and hyphens are allowed')} - ${$i18n.t(
|
||||
'Activate this command by typing "/{{COMMAND}}" to chat input.',
|
||||
{
|
||||
COMMAND: command
|
||||
}
|
||||
)}`}
|
||||
placement="bottom-start"
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-0.5">
|
||||
<span>/</span>
|
||||
<input
|
||||
class="min-w-0 flex-1 {($settings?.highContrastMode ?? false)
|
||||
? 'min-h-6'
|
||||
: ''} bg-transparent outline-hidden"
|
||||
placeholder={$i18n.t('command')}
|
||||
aria-label={$i18n.t('Command')}
|
||||
bind:value={command}
|
||||
on:input={() => {
|
||||
hasManualEdit = true;
|
||||
debouncedSaveMetadata();
|
||||
}}
|
||||
required
|
||||
{disabled}
|
||||
/>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{#if edit}
|
||||
<Tooltip className="min-w-0 max-w-[45%]" content={$i18n.t('Click to copy ID')}>
|
||||
<button
|
||||
type="button"
|
||||
class="w-full truncate font-mono text-xs text-base-400 hover:text-base-700 dark:hover:text-base-300"
|
||||
on:click={async () => {
|
||||
if (await copyToClipboard(prompt.id))
|
||||
toast.success($i18n.t('ID copied to clipboard'));
|
||||
}}>{prompt.id}</button
|
||||
>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
<Tags
|
||||
{tags}
|
||||
{disabled}
|
||||
{suggestionTags}
|
||||
on:add={(e) => {
|
||||
tags = [...tags, { name: e.detail }];
|
||||
debouncedSaveMetadata();
|
||||
}}
|
||||
on:delete={(e) => {
|
||||
tags = tags.filter((tag) => tag.name !== e.detail);
|
||||
debouncedSaveMetadata();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border border-base-100/80 bg-base-0 dark:border-base-0/[0.04] dark:bg-base-900"
|
||||
>
|
||||
{#if historyDiff}
|
||||
<VersionDiff
|
||||
diff={historyDiff}
|
||||
currentLabel="Production"
|
||||
showFileHeaders={false}
|
||||
loadFileDiff={async () => ({
|
||||
diff: historyDiff.content,
|
||||
line_endings_only: historyDiff.line_endings_only
|
||||
})}
|
||||
onClose={() => (historyDiff = null)}
|
||||
/>
|
||||
{:else}
|
||||
<div
|
||||
class="flex shrink-0 items-center gap-1 bg-base-50/60 px-2.5 py-1.5 text-xs dark:bg-base-1000"
|
||||
>
|
||||
<div class="min-w-0 flex-1">
|
||||
{#if edit}
|
||||
<Dropdown bind:show={showHistory} align="start">
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('History')}
|
||||
class="flex max-w-full items-center gap-2 py-0.5 text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
disabled={loading}
|
||||
>
|
||||
<span class="truncate"
|
||||
>{historical
|
||||
? selectedHistoryEntry.commit_message || selectedVersionId.slice(0, 7)
|
||||
: $i18n.t('Live')}{editingHistory ? ` · ${$i18n.t('Editing')}` : ''}</span
|
||||
><ChevronDown className="size-3 shrink-0" />
|
||||
</button>
|
||||
<div slot="content">
|
||||
<DropdownMenu
|
||||
className="w-72 max-w-[calc(100vw-2rem)] max-h-80 overflow-y-auto"
|
||||
>
|
||||
<VersionMenuItem
|
||||
entry={history.find((entry) => entry.id === prompt?.version_id) ||
|
||||
(productionEntry?.id === prompt?.version_id ? productionEntry : null)}
|
||||
status={$i18n.t('Live')}
|
||||
deleteDisabledReason={disabled
|
||||
? ''
|
||||
: $i18n.t('Cannot delete the production version')}
|
||||
selected={!historical}
|
||||
onSelect={() => chooseVersion()}
|
||||
/>
|
||||
{#if history.some((entry) => entry.id !== prompt?.version_id)}<hr
|
||||
class="border-base-100 dark:border-base-800"
|
||||
/>{/if}
|
||||
{#each history.filter((entry) => entry.id !== prompt?.version_id) as entry (entry.id)}
|
||||
<VersionMenuItem
|
||||
{entry}
|
||||
selected={selectedVersionId === entry.id}
|
||||
onSelect={() => chooseVersion(entry)}
|
||||
onDelete={disabled
|
||||
? undefined
|
||||
: () => {
|
||||
deleteVersionId = entry.id;
|
||||
showHistory = false;
|
||||
showDeleteVersion = true;
|
||||
}}
|
||||
/>
|
||||
{/each}
|
||||
{#if historyLoading}<div
|
||||
class="flex items-center gap-2 px-2 py-1 text-xs text-base-500"
|
||||
>
|
||||
<Spinner className="size-3" />{$i18n.t('Loading...')}
|
||||
</div>
|
||||
{:else if historyError}<button
|
||||
type="button"
|
||||
on:click={() => loadHistory(historyPage === 0)}>{$i18n.t('Retry')}</button
|
||||
>
|
||||
{:else if !history.length}<div class="px-2 py-2 text-xs text-base-400">
|
||||
{$i18n.t('No history available')}
|
||||
</div>
|
||||
{:else if historyHasMore}<hr class="border-base-100 dark:border-base-800" />
|
||||
<button type="button" on:click={() => loadHistory()}
|
||||
>{$i18n.t('Load more')}</button
|
||||
>{/if}
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
{:else}<span class="text-base-500">{$i18n.t('Prompt Content')}</span>{/if}
|
||||
</div>
|
||||
{#if !readOnly}
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded-md px-2 py-1 text-base-500 hover:bg-base-100 hover:text-base-900 disabled:opacity-50 dark:hover:bg-base-800 dark:hover:text-base-100"
|
||||
disabled={!ready || loading || historyLoading}
|
||||
on:click={compareRevision}>{$i18n.t('Compare revision')}</button
|
||||
>
|
||||
{/if}
|
||||
<Tooltip
|
||||
content={`${$i18n.t('Use')} {{${$i18n.t('variable')}}} ${$i18n.t('for placeholders')}`}
|
||||
><span class="px-1 text-base-400">{'{{'}{$i18n.t('variable')}{'}}'}</span></Tooltip
|
||||
>
|
||||
<div class="shrink-0 px-1 pb-2">
|
||||
<input
|
||||
class="w-full {($settings?.highContrastMode ?? false)
|
||||
? 'min-h-6'
|
||||
: ''} bg-transparent text-sm outline-hidden"
|
||||
placeholder={$i18n.t('Prompt Name')}
|
||||
aria-label={$i18n.t('Prompt Name')}
|
||||
bind:value={name}
|
||||
on:input={debouncedSaveMetadata}
|
||||
required
|
||||
{disabled}
|
||||
/>
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
<Tooltip
|
||||
className="min-w-0 flex-1"
|
||||
content={`${$i18n.t('Only alphanumeric characters and hyphens are allowed')} - ${$i18n.t(
|
||||
'Activate this command by typing "/{{COMMAND}}" to chat input.',
|
||||
{
|
||||
COMMAND: command
|
||||
}
|
||||
)}`}
|
||||
placement="bottom-start"
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-0.5">
|
||||
<span>/</span>
|
||||
<input
|
||||
class="min-w-0 flex-1 {($settings?.highContrastMode ?? false)
|
||||
? 'min-h-6'
|
||||
: ''} bg-transparent outline-hidden"
|
||||
placeholder={$i18n.t('command')}
|
||||
aria-label={$i18n.t('Command')}
|
||||
bind:value={command}
|
||||
on:input={() => {
|
||||
hasManualEdit = true;
|
||||
debouncedSaveMetadata();
|
||||
}}
|
||||
required
|
||||
{disabled}
|
||||
/>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{#if edit}
|
||||
<Tooltip className="min-w-0 max-w-[45%]" content={$i18n.t('Click to copy ID')}>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('Copy content')}
|
||||
class="shrink-0 p-0.5 text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
on:click={copyContent}
|
||||
>{#if contentCopied}<Check className="size-3.5 text-green-500" />{:else}<Clipboard
|
||||
className="size-3.5"
|
||||
/>{/if}</button
|
||||
class="w-full truncate font-mono text-xs text-base-400 hover:text-base-700 dark:hover:text-base-300"
|
||||
on:click={async () => {
|
||||
if (await copyToClipboard(prompt.id))
|
||||
toast.success($i18n.t('ID copied to clipboard'));
|
||||
}}>{prompt.id}</button
|
||||
>
|
||||
</div>
|
||||
<textarea
|
||||
bind:this={contentInput}
|
||||
bind:value={content}
|
||||
aria-label={$i18n.t('Prompt Content')}
|
||||
placeholder={$i18n.t('Write a summary in 50 words that summarizes {{topic}}.')}
|
||||
readonly={readOnly}
|
||||
required
|
||||
spellcheck="false"
|
||||
class="min-h-0 w-full flex-1 resize-none bg-transparent px-3 py-2 font-mono text-xs leading-relaxed outline-hidden"
|
||||
on:keydown={(event) => {
|
||||
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 's') {
|
||||
event.preventDefault();
|
||||
submitHandler();
|
||||
}
|
||||
}}
|
||||
></textarea>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
<Tags
|
||||
{tags}
|
||||
{disabled}
|
||||
{suggestionTags}
|
||||
on:add={(e) => {
|
||||
tags = [...tags, { name: e.detail }];
|
||||
debouncedSaveMetadata();
|
||||
}}
|
||||
on:delete={(e) => {
|
||||
tags = tags.filter((tag) => tag.name !== e.detail);
|
||||
debouncedSaveMetadata();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if historical}
|
||||
<div
|
||||
class="flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border border-base-100/80 bg-base-0 dark:border-base-0/[0.04] dark:bg-base-900"
|
||||
>
|
||||
{#if historyDiff}
|
||||
<VersionDiff
|
||||
diff={historyDiff}
|
||||
currentLabel="Production"
|
||||
showFileHeaders={false}
|
||||
loadFileDiff={async () => ({
|
||||
diff: historyDiff.content,
|
||||
line_endings_only: historyDiff.line_endings_only
|
||||
})}
|
||||
onClose={() => (historyDiff = null)}
|
||||
/>
|
||||
{:else}
|
||||
<div
|
||||
class="flex shrink-0 flex-wrap items-center justify-between gap-2 px-1 py-2 text-xs text-base-500"
|
||||
class="flex shrink-0 items-center gap-1 bg-base-50/60 px-2.5 py-1.5 text-xs dark:bg-base-1000"
|
||||
>
|
||||
<span
|
||||
>{selectedHistoryEntry.id.slice(0, 7)} · {renderDate(
|
||||
selectedHistoryEntry.created_at
|
||||
)}</span
|
||||
>
|
||||
{#if !editingHistory}<div class="ml-auto flex flex-wrap justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-100 px-2.5 text-xs text-base-700 disabled:opacity-60 dark:bg-base-850 dark:text-base-200"
|
||||
disabled={comparing || !!historyDiff}
|
||||
on:click={compareToCurrent}
|
||||
>{#if comparing}<Spinner className="mr-1.5 size-3" />{/if}{$i18n.t(
|
||||
'Compare to current'
|
||||
)}</button
|
||||
>
|
||||
{#if !disabled}
|
||||
<div class="min-w-0 flex-1">
|
||||
{#if edit}
|
||||
<Dropdown bind:show={showHistory} align="start">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-100 px-2.5 text-xs text-base-700 dark:bg-base-850 dark:text-base-200"
|
||||
on:click={editVersion}>{$i18n.t('Edit as new version')}</button
|
||||
><button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
on:click={() => confirmDiscard(setAsProduction)}
|
||||
>{$i18n.t('Set as Production')}</button
|
||||
aria-label={$i18n.t('History')}
|
||||
class="flex max-w-full items-center gap-2 py-0.5 text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
disabled={loading}
|
||||
>
|
||||
{/if}
|
||||
</div>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !readOnly}
|
||||
<div class="flex shrink-0 flex-wrap items-center gap-2 py-2">
|
||||
{#if edit}<input
|
||||
class="min-w-0 flex-1 bg-transparent px-2 text-xs outline-hidden"
|
||||
placeholder={$i18n.t('Describe what changed...')}
|
||||
aria-label={$i18n.t('Commit Message')}
|
||||
bind:value={commitMessage}
|
||||
/>{:else}<div class="flex-1"></div>{/if}
|
||||
<div class="ml-auto flex shrink-0 items-center gap-3">
|
||||
{#if historical}<label
|
||||
class="flex cursor-pointer items-center gap-1.5 whitespace-nowrap text-xs text-base-500"
|
||||
><input
|
||||
type="checkbox"
|
||||
bind:checked={isProduction}
|
||||
class="size-3 rounded border-base-300 dark:border-base-600"
|
||||
/><span>{$i18n.t('Set as Production')}</span></label
|
||||
>{/if}
|
||||
<button
|
||||
type="submit"
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
disabled={loading || !ready || historyLoading}
|
||||
>
|
||||
{edit ? $i18n.t('Save') : $i18n.t('Save & Create')}{#if loading}<Spinner
|
||||
className="size-3"
|
||||
/>{/if}
|
||||
</button>
|
||||
<span class="truncate"
|
||||
>{historical
|
||||
? selectedHistoryEntry.commit_message || selectedVersionId.slice(0, 7)
|
||||
: $i18n.t('Live')}{editingHistory ? ` · ${$i18n.t('Editing')}` : ''}</span
|
||||
><ChevronDown className="size-3 shrink-0" />
|
||||
</button>
|
||||
<div slot="content">
|
||||
<DropdownMenu className="w-72 max-w-[calc(100vw-2rem)] max-h-80 overflow-y-auto">
|
||||
<VersionMenuItem
|
||||
entry={history.find((entry) => entry.id === prompt?.version_id) ||
|
||||
(productionEntry?.id === prompt?.version_id ? productionEntry : null)}
|
||||
status={$i18n.t('Live')}
|
||||
deleteDisabledReason={disabled
|
||||
? ''
|
||||
: $i18n.t('Cannot delete the production version')}
|
||||
selected={!historical}
|
||||
onSelect={() => chooseVersion()}
|
||||
/>
|
||||
{#if history.some((entry) => entry.id !== prompt?.version_id)}<hr
|
||||
class="border-base-100 dark:border-base-800"
|
||||
/>{/if}
|
||||
{#each history.filter((entry) => entry.id !== prompt?.version_id) as entry (entry.id)}
|
||||
<VersionMenuItem
|
||||
{entry}
|
||||
selected={selectedVersionId === entry.id}
|
||||
onSelect={() => chooseVersion(entry)}
|
||||
onDelete={disabled
|
||||
? undefined
|
||||
: () => {
|
||||
deleteVersionId = entry.id;
|
||||
showHistory = false;
|
||||
showDeleteVersion = true;
|
||||
}}
|
||||
/>
|
||||
{/each}
|
||||
{#if historyLoading}<div
|
||||
class="flex items-center gap-2 px-2 py-1 text-xs text-base-500"
|
||||
>
|
||||
<Spinner className="size-3" />{$i18n.t('Loading...')}
|
||||
</div>
|
||||
{:else if historyError}<button
|
||||
type="button"
|
||||
on:click={() => loadHistory(historyPage === 0)}>{$i18n.t('Retry')}</button
|
||||
>
|
||||
{:else if !history.length}<div class="px-2 py-2 text-xs text-base-400">
|
||||
{$i18n.t('No history available')}
|
||||
</div>
|
||||
{:else if historyHasMore}<hr class="border-base-100 dark:border-base-800" />
|
||||
<button type="button" on:click={() => loadHistory()}
|
||||
>{$i18n.t('Load more')}</button
|
||||
>{/if}
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
{:else}<span class="text-base-500">{$i18n.t('Prompt Content')}</span>{/if}
|
||||
</div>
|
||||
{#if !readOnly}
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded-md px-2 py-1 text-base-500 hover:bg-base-100 hover:text-base-900 disabled:opacity-50 dark:hover:bg-base-800 dark:hover:text-base-100"
|
||||
disabled={!ready || loading || historyLoading}
|
||||
on:click={compareRevision}>{$i18n.t('Compare revision')}</button
|
||||
>
|
||||
{/if}
|
||||
<Tooltip
|
||||
content={`${$i18n.t('Use')} {{${$i18n.t('variable')}}} ${$i18n.t('for placeholders')}`}
|
||||
><span class="px-1 text-base-400">{'{{'}{$i18n.t('variable')}{'}}'}</span></Tooltip
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('Copy content')}
|
||||
class="shrink-0 p-0.5 text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
on:click={copyContent}
|
||||
>{#if contentCopied}<Check className="size-3.5 text-green-500" />{:else}<Clipboard
|
||||
className="size-3.5"
|
||||
/>{/if}</button
|
||||
>
|
||||
</div>
|
||||
<textarea
|
||||
bind:this={contentInput}
|
||||
bind:value={content}
|
||||
aria-label={$i18n.t('Prompt Content')}
|
||||
placeholder={$i18n.t('Write a summary in 50 words that summarizes {{topic}}.')}
|
||||
readonly={readOnly}
|
||||
required
|
||||
spellcheck="false"
|
||||
class="min-h-0 w-full flex-1 resize-none bg-transparent px-3 py-2 font-mono text-xs leading-relaxed outline-hidden"
|
||||
on:keydown={(event) => {
|
||||
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 's') {
|
||||
event.preventDefault();
|
||||
submitHandler();
|
||||
}
|
||||
}}
|
||||
></textarea>
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
</Comments>
|
||||
</div>
|
||||
|
||||
{#if historical}
|
||||
<div
|
||||
class="flex shrink-0 flex-wrap items-center justify-between gap-2 px-1 py-2 text-xs text-base-500"
|
||||
>
|
||||
<span
|
||||
>{selectedHistoryEntry.id.slice(0, 7)} · {renderDate(
|
||||
selectedHistoryEntry.created_at
|
||||
)}</span
|
||||
>
|
||||
{#if !editingHistory}<div class="ml-auto flex flex-wrap justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-100 px-2.5 text-xs text-base-700 disabled:opacity-60 dark:bg-base-850 dark:text-base-200"
|
||||
disabled={comparing || !!historyDiff}
|
||||
on:click={compareToCurrent}
|
||||
>{#if comparing}<Spinner className="mr-1.5 size-3" />{/if}{$i18n.t(
|
||||
'Compare to current'
|
||||
)}</button
|
||||
>
|
||||
{#if !disabled}
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-100 px-2.5 text-xs text-base-700 dark:bg-base-850 dark:text-base-200"
|
||||
on:click={editVersion}>{$i18n.t('Edit as new version')}</button
|
||||
><button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
on:click={() => confirmDiscard(setAsProduction)}
|
||||
>{$i18n.t('Set as Production')}</button
|
||||
>
|
||||
{/if}
|
||||
</div>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !readOnly}
|
||||
<div class="flex shrink-0 flex-wrap items-center gap-2 py-2">
|
||||
{#if edit}<input
|
||||
class="min-w-0 flex-1 bg-transparent px-2 text-xs outline-hidden"
|
||||
placeholder={$i18n.t('Describe what changed...')}
|
||||
aria-label={$i18n.t('Commit Message')}
|
||||
bind:value={commitMessage}
|
||||
/>{:else}<div class="flex-1"></div>{/if}
|
||||
<div class="ml-auto flex shrink-0 items-center gap-3">
|
||||
{#if historical}<label
|
||||
class="flex cursor-pointer items-center gap-1.5 whitespace-nowrap text-xs text-base-500"
|
||||
><input
|
||||
type="checkbox"
|
||||
bind:checked={isProduction}
|
||||
class="size-3 rounded border-base-300 dark:border-base-600"
|
||||
/><span>{$i18n.t('Set as Production')}</span></label
|
||||
>{/if}
|
||||
<button
|
||||
type="submit"
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
disabled={loading || !ready || historyLoading}
|
||||
>
|
||||
{edit ? $i18n.t('Save') : $i18n.t('Save & Create')}{#if loading}<Spinner
|
||||
className="size-3"
|
||||
/>{/if}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
@@ -3,10 +3,9 @@
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import WorkspaceAccessModal from './common/WorkspaceAccessModal.svelte';
|
||||
let accessModal: WorkspaceAccessModal;
|
||||
@@ -354,398 +353,391 @@
|
||||
{$i18n.t('Skills')}
|
||||
</h1>
|
||||
|
||||
<Comments modal bind:view={comments} resourceType="skill">
|
||||
{#if loaded && filteredItems !== null && total !== null}
|
||||
<ImportModal
|
||||
bind:show={showImportFromLink}
|
||||
loadUrlHandler={(url) => loadSkillByUrl(localStorage.token, url)}
|
||||
transformResult={(packages) => packages}
|
||||
successMessage={$i18n.t('Skills loaded for preview')}
|
||||
onImport={(packages) => {
|
||||
bundleFiles = [
|
||||
new File([JSON.stringify(packages)], 'skills.json', { type: 'application/json' })
|
||||
];
|
||||
showImport = true;
|
||||
}}
|
||||
/>
|
||||
<SkillImport
|
||||
bind:show={showImport}
|
||||
files={bundleFiles}
|
||||
onImported={async () => {
|
||||
toast.success($i18n.t('Skill imported successfully'));
|
||||
page = 1;
|
||||
await loadSkillItems();
|
||||
_skills.set(await getSkills(localStorage.token));
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
bind:this={importInputElement}
|
||||
type="file"
|
||||
accept=".md,.json,.zip,.skill"
|
||||
multiple
|
||||
hidden
|
||||
on:change={() => {
|
||||
bundleFiles = Array.from(importInputElement.files || []);
|
||||
showImport = true;
|
||||
importInputElement.value = '';
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
bind:this={folderImportInput}
|
||||
type="file"
|
||||
webkitdirectory
|
||||
multiple
|
||||
hidden
|
||||
on:change={() => {
|
||||
bundleFiles = Array.from(folderImportInput.files || []);
|
||||
showImport = true;
|
||||
folderImportInput.value = '';
|
||||
}}
|
||||
/>
|
||||
{#if loaded && filteredItems !== null && total !== null}
|
||||
<ImportModal
|
||||
bind:show={showImportFromLink}
|
||||
loadUrlHandler={(url) => loadSkillByUrl(localStorage.token, url)}
|
||||
transformResult={(packages) => packages}
|
||||
successMessage={$i18n.t('Skills loaded for preview')}
|
||||
onImport={(packages) => {
|
||||
bundleFiles = [
|
||||
new File([JSON.stringify(packages)], 'skills.json', { type: 'application/json' })
|
||||
];
|
||||
showImport = true;
|
||||
}}
|
||||
/>
|
||||
<SkillImport
|
||||
bind:show={showImport}
|
||||
files={bundleFiles}
|
||||
onImported={async () => {
|
||||
toast.success($i18n.t('Skill imported successfully'));
|
||||
page = 1;
|
||||
await loadSkillItems();
|
||||
_skills.set(await getSkills(localStorage.token));
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
bind:this={importInputElement}
|
||||
type="file"
|
||||
accept=".md,.json,.zip,.skill"
|
||||
multiple
|
||||
hidden
|
||||
on:change={() => {
|
||||
bundleFiles = Array.from(importInputElement.files || []);
|
||||
showImport = true;
|
||||
importInputElement.value = '';
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
bind:this={folderImportInput}
|
||||
type="file"
|
||||
webkitdirectory
|
||||
multiple
|
||||
hidden
|
||||
on:change={() => {
|
||||
bundleFiles = Array.from(folderImportInput.files || []);
|
||||
showImport = true;
|
||||
folderImportInput.value = '';
|
||||
}}
|
||||
/>
|
||||
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
<input
|
||||
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Skills')}
|
||||
placeholder={$i18n.t('Search Skills')}
|
||||
/>
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
page = 1;
|
||||
await tick();
|
||||
<input
|
||||
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Skills')}
|
||||
placeholder={$i18n.t('Search Skills')}
|
||||
/>
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if filteredItems === null}
|
||||
<div class="w-full h-full flex justify-center items-center my-16 mb-24">
|
||||
<Spinner className="size-5" />
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
page = 1;
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{:else if (filteredItems ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if filteredItems === null}
|
||||
<div class="w-full h-full flex justify-center items-center my-16 mb-24">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{:else if (filteredItems ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each filteredItems as skill (skill.id)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group cursor-pointer text-left"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openSkill(skill);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip content={skill.id} className="min-w-0" placement="top-start">
|
||||
<a
|
||||
href={`/workspace/skills/edit?id=${encodeURIComponent(skill.id)}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{resolveLocalizedResource(skill, $i18n.language)}</a
|
||||
>
|
||||
</Tooltip>
|
||||
{#if !skill.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
{#if !skill.is_active}
|
||||
<Badge type="muted" content={$i18n.t('Inactive')} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if resolveLocalizedResource(skill, $i18n.language, 'description')}
|
||||
<Tooltip
|
||||
content={resolveLocalizedResource(skill, $i18n.language, 'description')}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each filteredItems as skill (skill.id)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group cursor-pointer text-left"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (shouldIgnoreRowClick(e.target)) return;
|
||||
openSkill(skill);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip content={skill.id} className="min-w-0" placement="top-start">
|
||||
<a
|
||||
href={`/workspace/skills/edit?id=${encodeURIComponent(skill.id)}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{resolveLocalizedResource(skill, $i18n.language)}</a
|
||||
>
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{resolveLocalizedResource(skill, $i18n.language, 'description')}
|
||||
</div>
|
||||
</Tooltip>
|
||||
</Tooltip>
|
||||
{#if !skill.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
{#if !skill.is_active}
|
||||
<Badge type="muted" content={$i18n.t('Inactive')} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={skill?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={skill?.user?.id
|
||||
? `/api/v1/users/${skill.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
skill?.user?.name ?? skill?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs((skill.updated_at ?? skill.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400">
|
||||
{dayjs((skill.updated_at ?? skill.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if resolveLocalizedResource(skill, $i18n.language, 'description')}
|
||||
<Tooltip
|
||||
content={resolveLocalizedResource(skill, $i18n.language, 'description')}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
>
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{resolveLocalizedResource(skill, $i18n.language, 'description')}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
{#if skill.write_access}
|
||||
<div class="flex shrink-0 flex-row items-center self-center">
|
||||
{#if shiftKey}
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview user={skill?.user ?? null} side="bottom" className="w-full min-w-0">
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={skill?.user?.id
|
||||
? `/api/v1/users/${skill.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
skill?.user?.name ?? skill?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs((skill.updated_at ?? skill.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400">
|
||||
{dayjs((skill.updated_at ?? skill.created_at) * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
{#if skill.write_access}
|
||||
<div class="flex shrink-0 flex-row items-center self-center">
|
||||
{#if shiftKey}
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
deleteHandler(skill);
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
<CommentsDropdown
|
||||
bind:view={comments}
|
||||
showResource
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'skill', resource_id: skill.id }}
|
||||
/>
|
||||
<SkillMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={skill.id}
|
||||
shareHandler={() => shareHandler(skill)}
|
||||
accessHandler={$user?.permissions?.sharing?.skills ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(skill.id)
|
||||
: null}
|
||||
show={openSkillMenuId === skill.id}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/skills/edit?id=${encodeURIComponent(skill.id)}`);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneHandler(skill);
|
||||
}}
|
||||
exportHandler={(format) => {
|
||||
exportHandler(skill, format);
|
||||
}}
|
||||
deleteHandler={async () => {
|
||||
selectedSkill = skill;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
onClose={() => {
|
||||
openSkillMenuId = null;
|
||||
}}
|
||||
>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
aria-label={$i18n.t('Skill Menu')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
deleteHandler(skill);
|
||||
openSkillMenuId = openSkillMenuId === skill.id ? null : skill.id;
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
modal
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'skill', resource_id: skill.id }}
|
||||
/>
|
||||
<SkillMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={skill.id}
|
||||
shareHandler={() => shareHandler(skill)}
|
||||
accessHandler={$user?.permissions?.sharing?.skills ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(skill.id)
|
||||
: null}
|
||||
show={openSkillMenuId === skill.id}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/skills/edit?id=${encodeURIComponent(skill.id)}`);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneHandler(skill);
|
||||
}}
|
||||
exportHandler={(format) => {
|
||||
exportHandler(skill, format);
|
||||
}}
|
||||
deleteHandler={async () => {
|
||||
selectedSkill = skill;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
onClose={() => {
|
||||
openSkillMenuId = null;
|
||||
}}
|
||||
</SkillMenu>
|
||||
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Tooltip
|
||||
content={skill.is_active ? $i18n.t('Enabled') : $i18n.t('Disabled')}
|
||||
>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Skill Menu')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openSkillMenuId = openSkillMenuId === skill.id ? null : skill.id;
|
||||
<Switch
|
||||
bind:state={skill.is_active}
|
||||
ariaLabel={$i18n.t('Enabled')}
|
||||
on:change={async () => {
|
||||
await toggleSkillById(localStorage.token, skill.id);
|
||||
_skills.set(await getSkills(localStorage.token));
|
||||
}}
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
</SkillMenu>
|
||||
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Tooltip
|
||||
content={skill.is_active ? $i18n.t('Enabled') : $i18n.t('Disabled')}
|
||||
>
|
||||
<Switch
|
||||
bind:state={skill.is_active}
|
||||
ariaLabel={$i18n.t('Enabled')}
|
||||
on:change={async () => {
|
||||
await toggleSkillById(localStorage.token, skill.id);
|
||||
_skills.set(await getSkills(localStorage.token));
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{#if !skill.write_access}
|
||||
<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
modal
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'skill', resource_id: skill.id }}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{#if !skill.write_access}
|
||||
<CommentsDropdown
|
||||
bind:view={comments}
|
||||
showResource
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'skill', resource_id: skill.id }}
|
||||
/>
|
||||
<span class="size-6 shrink-0" aria-hidden="true"></span>
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Switch
|
||||
state={skill.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${resolveLocalizedResource(skill, $i18n.language)}`}
|
||||
/>
|
||||
<span class="size-6 shrink-0" aria-hidden="true"></span>
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Switch
|
||||
state={skill.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${resolveLocalizedResource(skill, $i18n.language)}`}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if total > 30}
|
||||
<div class="flex justify-center mt-4 mb-2">
|
||||
<Pagination bind:page count={total} perPage={30} />
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No skills found') : $i18n.t('No skills yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
{#if total > 30}
|
||||
<div class="flex justify-center mt-4 mb-2">
|
||||
<Pagination bind:page count={total} perPage={30} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
title={$i18n.t('Delete skill?')}
|
||||
on:confirm={() => {
|
||||
deleteHandler(selectedSkill);
|
||||
}}
|
||||
>
|
||||
<div class=" text-sm text-base-500 truncate">
|
||||
{$i18n.t('This will delete')}
|
||||
<span class=" font-normal">{resolveLocalizedResource(selectedSkill, $i18n.language)}</span
|
||||
>.
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No skills found') : $i18n.t('No skills yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DeleteConfirmDialog>
|
||||
{#if $config?.features?.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=skill"
|
||||
title={$i18n.t('Discover a skill')}
|
||||
description={$i18n.t('Discover, download, and explore community skills')}
|
||||
/>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
title={$i18n.t('Delete skill?')}
|
||||
on:confirm={() => {
|
||||
deleteHandler(selectedSkill);
|
||||
}}
|
||||
>
|
||||
<div class=" text-sm text-base-500 truncate">
|
||||
{$i18n.t('This will delete')}
|
||||
<span class=" font-normal">{resolveLocalizedResource(selectedSkill, $i18n.language)}</span>.
|
||||
</div>
|
||||
</DeleteConfirmDialog>
|
||||
{#if $config?.features?.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=skill"
|
||||
title={$i18n.t('Discover a skill')}
|
||||
description={$i18n.t('Discover, download, and explore community skills')}
|
||||
/>
|
||||
{/if}
|
||||
</Comments>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
@@ -2,10 +2,9 @@
|
||||
import { getPageContext, onTabLeave } from '$lib/utils/page';
|
||||
const { goto, tab: pageTab } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { onMount, tick, getContext } from 'svelte';
|
||||
|
||||
@@ -353,311 +352,307 @@
|
||||
}}
|
||||
/>
|
||||
|
||||
<Comments bind:view={comments} resourceType="skill">
|
||||
<div class="flex h-full w-full min-w-0 flex-col overflow-hidden">
|
||||
<form
|
||||
inert={loading}
|
||||
class="flex h-full min-h-0 min-w-0 flex-col"
|
||||
on:submit|preventDefault={submitHandler}
|
||||
>
|
||||
<div class="flex shrink-0 items-center justify-between gap-2">
|
||||
<button
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 transition-colors duration-75 hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
goto('/workspace/skills');
|
||||
}}
|
||||
>
|
||||
<ChevronLeft className="size-3" strokeWidth="2" />
|
||||
<span>{$i18n.t('Back')}</span>
|
||||
</button>
|
||||
<div class="flex shrink-0 items-center gap-1 pr-0.5">
|
||||
{#if edit && skill?.id}<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
wrapperClassName="me-2"
|
||||
resource={{ resource_type: 'skill', resource_id: skill.id }}
|
||||
/>{/if}
|
||||
<LanguageModeSelect
|
||||
bind:value={locale}
|
||||
translatedLocales={Object.keys(meta.i18n ?? {})}
|
||||
/>
|
||||
<div class="flex h-full w-full min-w-0 flex-col overflow-hidden">
|
||||
<form
|
||||
inert={loading}
|
||||
class="flex h-full min-h-0 min-w-0 flex-col"
|
||||
on:submit|preventDefault={submitHandler}
|
||||
>
|
||||
<div class="flex shrink-0 items-center justify-between gap-2">
|
||||
<button
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 transition-colors duration-75 hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
goto('/workspace/skills');
|
||||
}}
|
||||
>
|
||||
<ChevronLeft className="size-3" strokeWidth="2" />
|
||||
<span>{$i18n.t('Back')}</span>
|
||||
</button>
|
||||
<div class="flex shrink-0 items-center gap-1 pr-0.5">
|
||||
{#if edit && skill?.id}<CommentsDropdown
|
||||
bind:view={comments}
|
||||
deepLink
|
||||
wrapperClassName="me-2"
|
||||
resource={{ resource_type: 'skill', resource_id: skill.id }}
|
||||
/>{/if}
|
||||
<LanguageModeSelect bind:value={locale} translatedLocales={Object.keys(meta.i18n ?? {})} />
|
||||
|
||||
{#if !disabled}
|
||||
{#if $user?.permissions?.sharing?.skills || $user?.role === 'admin'}
|
||||
<AccessButton
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(accessGrants);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{:else}
|
||||
<span class="rounded-lg bg-base-100 px-2 py-1 text-xs text-base-500 dark:bg-base-850">
|
||||
{$i18n.t('Read Only')}
|
||||
</span>
|
||||
{#if !disabled}
|
||||
{#if $user?.permissions?.sharing?.skills || $user?.role === 'admin'}
|
||||
<AccessButton
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(accessGrants);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<span class="rounded-lg bg-base-100 px-2 py-1 text-xs text-base-500 dark:bg-base-850">
|
||||
{$i18n.t('Read Only')}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 pb-2 px-1">
|
||||
<Tooltip content={$i18n.t('e.g. Code Review Guidelines')} placement="top-start">
|
||||
<div class="shrink-0 pb-2 px-1">
|
||||
<Tooltip content={$i18n.t('e.g. Code Review Guidelines')} placement="top-start">
|
||||
<LocalizedField
|
||||
placeholder={$i18n.t('Skill Name')}
|
||||
showControls={false}
|
||||
bind:value={name}
|
||||
bind:translations={meta.i18n}
|
||||
{locale}
|
||||
required
|
||||
disabled={readOnly}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
<Tooltip
|
||||
className="flex min-w-0 flex-1 items-center"
|
||||
content={$i18n.t('e.g. Step-by-step instructions for code reviews')}
|
||||
placement="top-start"
|
||||
>
|
||||
<LocalizedField
|
||||
placeholder={$i18n.t('Skill Name')}
|
||||
placeholder={$i18n.t('Skill Description')}
|
||||
showControls={false}
|
||||
bind:value={name}
|
||||
bind:value={description}
|
||||
bind:translations={meta.i18n}
|
||||
{locale}
|
||||
required
|
||||
field="description"
|
||||
disabled={readOnly}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
{#if edit}
|
||||
<div class="shrink-0 truncate font-mono" title={id}>
|
||||
{id}
|
||||
</div>
|
||||
{:else}
|
||||
<Tooltip
|
||||
className="flex min-w-0 flex-1 items-center"
|
||||
content={$i18n.t('e.g. Step-by-step instructions for code reviews')}
|
||||
className="min-w-[8rem] flex-1"
|
||||
content={$i18n.t('e.g. code-review-guidelines')}
|
||||
placement="top-start"
|
||||
>
|
||||
<LocalizedField
|
||||
placeholder={$i18n.t('Skill Description')}
|
||||
showControls={false}
|
||||
bind:value={description}
|
||||
bind:translations={meta.i18n}
|
||||
{locale}
|
||||
field="description"
|
||||
disabled={readOnly}
|
||||
<input
|
||||
class="w-full bg-transparent font-mono outline-hidden disabled:text-base-500"
|
||||
type="text"
|
||||
placeholder={$i18n.t('Skill ID')}
|
||||
aria-label={$i18n.t('Skill ID')}
|
||||
bind:value={id}
|
||||
required
|
||||
disabled={edit}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
{#if edit}
|
||||
<div class="shrink-0 truncate font-mono" title={id}>
|
||||
{id}
|
||||
</div>
|
||||
{:else}
|
||||
<Tooltip
|
||||
className="min-w-[8rem] flex-1"
|
||||
content={$i18n.t('e.g. code-review-guidelines')}
|
||||
placement="top-start"
|
||||
>
|
||||
<input
|
||||
class="w-full bg-transparent font-mono outline-hidden disabled:text-base-500"
|
||||
type="text"
|
||||
placeholder={$i18n.t('Skill ID')}
|
||||
aria-label={$i18n.t('Skill ID')}
|
||||
bind:value={id}
|
||||
required
|
||||
disabled={edit}
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if conflict}<div
|
||||
role="alert"
|
||||
class="flex flex-wrap gap-3 bg-amber-50 p-3 text-xs text-amber-900 dark:bg-amber-950 dark:text-amber-100"
|
||||
>
|
||||
<span>{$i18n.t('This skill has a newer version. Your draft is preserved.')}</span><button
|
||||
type="button"
|
||||
on:click={() => confirmDiscard(reload)}>{$i18n.t('Reload latest')}</button
|
||||
><button type="button" on:click={saveCopy}>{$i18n.t('Save draft as copy')}</button><button
|
||||
type="button"
|
||||
on:click={() => (conflict = false)}>{$i18n.t('Keep editing')}</button
|
||||
>
|
||||
</div>{/if}
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden rounded-2xl border border-base-100/50 bg-base-50/60 dark:border-base-0/[0.025] dark:bg-base-0/[0.03]"
|
||||
{#if conflict}<div
|
||||
role="alert"
|
||||
class="flex flex-wrap gap-3 bg-amber-50 p-3 text-xs text-amber-900 dark:bg-amber-950 dark:text-amber-100"
|
||||
>
|
||||
{#if historyDiff}
|
||||
<VersionDiff
|
||||
diff={historyDiff}
|
||||
onClose={() => (historyDiff = null)}
|
||||
loadFileDiff={async (path) => {
|
||||
try {
|
||||
return await (
|
||||
await skillRequest(
|
||||
localStorage.token,
|
||||
`/id/${id}/history/diff/file?${new URLSearchParams({ from_id: historyDiff.fromId, to_id: historyDiff.toId, path })}`
|
||||
)
|
||||
).json();
|
||||
} catch (error) {
|
||||
throw new Error(skillError(error));
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{:else if ready}<SkillFiles
|
||||
bind:this={fileEditor}
|
||||
skillId={id}
|
||||
{versionId}
|
||||
{reloadKey}
|
||||
initialContent={content}
|
||||
initialFiles={skill?.files || null}
|
||||
{readOnly}
|
||||
bind:dirty={fileDirty}
|
||||
initialPath={new URLSearchParams(location.search).get('path') || 'SKILL.md'}
|
||||
onSave={submitHandler}
|
||||
onContentChange={handleContentChange}
|
||||
canExport={edit &&
|
||||
($user?.role === 'admin' || $user?.permissions?.workspace?.skills_export)}
|
||||
>
|
||||
{#snippet version()}
|
||||
{#if edit}
|
||||
<div class="min-w-0">
|
||||
<Dropdown
|
||||
bind:show={showHistory}
|
||||
align="start"
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
historyPage = 1;
|
||||
history = [];
|
||||
loadHistory();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('Select version')}
|
||||
class="flex h-7 max-w-full items-center gap-2 rounded-lg bg-transparent px-2 text-xs text-base-500 transition hover:text-base-900 dark:hover:text-base-100"
|
||||
>
|
||||
<span class="truncate"
|
||||
>{historical
|
||||
? versionId?.slice(0, 7)
|
||||
: $i18n.t('Current')}{selectedCommitMessage
|
||||
? ` · ${selectedCommitMessage}`
|
||||
: ''}</span
|
||||
>
|
||||
<ChevronDown className="size-3 shrink-0" />
|
||||
</button>
|
||||
<div slot="content">
|
||||
<DropdownMenu
|
||||
className="w-72 max-w-[calc(100vw-2rem)] max-h-80 overflow-y-auto"
|
||||
>
|
||||
<VersionMenuItem
|
||||
entry={currentHistoryEntry?.id === currentVersionId
|
||||
? currentHistoryEntry
|
||||
: null}
|
||||
status={$i18n.t('Current')}
|
||||
selected={versionId === currentVersionId}
|
||||
onSelect={() => chooseVersion(currentVersionId!)}
|
||||
/>
|
||||
{#if historyLoading || historyError || history.some((entry) => entry.id !== currentVersionId)}
|
||||
<hr class="border-base-100 dark:border-base-800" />
|
||||
{/if}
|
||||
{#if historyLoading}
|
||||
<div class="flex items-center gap-2 px-2 py-2 text-xs text-base-500">
|
||||
<Spinner className="size-3" />{$i18n.t('Loading...')}
|
||||
</div>
|
||||
{:else if historyError}
|
||||
<button type="button" on:click={loadHistory}>{$i18n.t('Retry')}</button>
|
||||
{:else}
|
||||
{#each history.filter((entry) => entry.id !== currentVersionId) as entry}
|
||||
<VersionMenuItem
|
||||
{entry}
|
||||
selected={entry.id === versionId}
|
||||
onSelect={() => chooseVersion(entry.id)}
|
||||
onDelete={disabled
|
||||
? undefined
|
||||
: () => {
|
||||
deleteVersionId = entry.id;
|
||||
showHistory = false;
|
||||
showDeleteVersion = true;
|
||||
}}
|
||||
/>
|
||||
{:else}
|
||||
{#if historyPage > 1}
|
||||
<div class="px-2 py-2 text-xs text-base-500">
|
||||
{$i18n.t('No more versions')}
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{#if historyPage > 1 || history.length === 20}
|
||||
<hr class="border-base-100 dark:border-base-800" />
|
||||
<div class="flex justify-between px-2 py-1 text-xs">
|
||||
<button
|
||||
type="button"
|
||||
disabled={historyLoading || historyPage === 1}
|
||||
class="disabled:opacity-40"
|
||||
on:click={() => {
|
||||
historyPage--;
|
||||
loadHistory();
|
||||
}}>{$i18n.t('Previous')}</button
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
disabled={historyLoading || history.length < 20}
|
||||
class="disabled:opacity-40"
|
||||
on:click={() => {
|
||||
historyPage++;
|
||||
loadHistory();
|
||||
}}>{$i18n.t('Next')}</button
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
{#snippet exports()}
|
||||
<button type="button" on:click={() => exportVersion('skill')}
|
||||
><Download className="size-3.5" />{$i18n.t('Export .skill')}</button
|
||||
>
|
||||
<button type="button" on:click={() => exportVersion('json')}
|
||||
><Download className="size-3.5" />{$i18n.t('Export JSON')}</button
|
||||
>
|
||||
<button type="button" on:click={() => exportVersion('zip')}
|
||||
><Download className="size-3.5" />{$i18n.t('Export ZIP')}</button
|
||||
>
|
||||
{/snippet}
|
||||
</SkillFiles>{/if}
|
||||
</div>
|
||||
|
||||
{#if historical}
|
||||
<div
|
||||
class="flex w-full shrink-0 flex-wrap items-center gap-2 px-1 py-2 text-xs text-base-500"
|
||||
<span>{$i18n.t('This skill has a newer version. Your draft is preserved.')}</span><button
|
||||
type="button"
|
||||
on:click={() => confirmDiscard(reload)}>{$i18n.t('Reload latest')}</button
|
||||
><button type="button" on:click={saveCopy}>{$i18n.t('Save draft as copy')}</button><button
|
||||
type="button"
|
||||
on:click={() => (conflict = false)}>{$i18n.t('Keep editing')}</button
|
||||
>
|
||||
<span class="mr-auto">{$i18n.t('Read Only')}</span>
|
||||
<div class="ml-auto flex flex-wrap justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-100 px-2.5 text-xs text-base-700 disabled:opacity-60 dark:bg-base-850 dark:text-base-200"
|
||||
disabled={comparing || !!historyDiff}
|
||||
on:click={compareToCurrent}
|
||||
>{#if comparing}<Spinner className="mr-1.5 size-3" />{/if}{$i18n.t(
|
||||
'Compare to current'
|
||||
)}</button
|
||||
>
|
||||
{#if !disabled}<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
on:click={setProductionVersion}>{$i18n.t('Set as Production')}</button
|
||||
>{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !readOnly}
|
||||
<div class="flex shrink-0 justify-end gap-3 py-2">
|
||||
<input
|
||||
class="min-w-0 flex-1 bg-transparent px-2 text-xs outline-hidden"
|
||||
placeholder={$i18n.t('Describe this change')}
|
||||
aria-label={$i18n.t('Commit message')}
|
||||
bind:value={commitMessage}
|
||||
/>
|
||||
<button
|
||||
class="flex h-7 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
type="submit"
|
||||
disabled={loading || !fileEditor}
|
||||
>
|
||||
{edit ? $i18n.t('Save') : $i18n.t('Save & Create')}
|
||||
{#if loading}
|
||||
<Spinner className="size-3" />
|
||||
</div>{/if}
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden rounded-2xl border border-base-100/50 bg-base-50/60 dark:border-base-0/[0.025] dark:bg-base-0/[0.03]"
|
||||
>
|
||||
{#if historyDiff}
|
||||
<VersionDiff
|
||||
diff={historyDiff}
|
||||
onClose={() => (historyDiff = null)}
|
||||
loadFileDiff={async (path) => {
|
||||
try {
|
||||
return await (
|
||||
await skillRequest(
|
||||
localStorage.token,
|
||||
`/id/${id}/history/diff/file?${new URLSearchParams({ from_id: historyDiff.fromId, to_id: historyDiff.toId, path })}`
|
||||
)
|
||||
).json();
|
||||
} catch (error) {
|
||||
throw new Error(skillError(error));
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{:else if ready}<SkillFiles
|
||||
bind:this={fileEditor}
|
||||
skillId={id}
|
||||
{versionId}
|
||||
{reloadKey}
|
||||
initialContent={content}
|
||||
initialFiles={skill?.files || null}
|
||||
{readOnly}
|
||||
bind:dirty={fileDirty}
|
||||
initialPath={new URLSearchParams(location.search).get('path') || 'SKILL.md'}
|
||||
onSave={submitHandler}
|
||||
onContentChange={handleContentChange}
|
||||
canExport={edit &&
|
||||
($user?.role === 'admin' || $user?.permissions?.workspace?.skills_export)}
|
||||
>
|
||||
{#snippet version()}
|
||||
{#if edit}
|
||||
<div class="min-w-0">
|
||||
<Dropdown
|
||||
bind:show={showHistory}
|
||||
align="start"
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
historyPage = 1;
|
||||
history = [];
|
||||
loadHistory();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('Select version')}
|
||||
class="flex h-7 max-w-full items-center gap-2 rounded-lg bg-transparent px-2 text-xs text-base-500 transition hover:text-base-900 dark:hover:text-base-100"
|
||||
>
|
||||
<span class="truncate"
|
||||
>{historical
|
||||
? versionId?.slice(0, 7)
|
||||
: $i18n.t('Current')}{selectedCommitMessage
|
||||
? ` · ${selectedCommitMessage}`
|
||||
: ''}</span
|
||||
>
|
||||
<ChevronDown className="size-3 shrink-0" />
|
||||
</button>
|
||||
<div slot="content">
|
||||
<DropdownMenu
|
||||
className="w-72 max-w-[calc(100vw-2rem)] max-h-80 overflow-y-auto"
|
||||
>
|
||||
<VersionMenuItem
|
||||
entry={currentHistoryEntry?.id === currentVersionId
|
||||
? currentHistoryEntry
|
||||
: null}
|
||||
status={$i18n.t('Current')}
|
||||
selected={versionId === currentVersionId}
|
||||
onSelect={() => chooseVersion(currentVersionId!)}
|
||||
/>
|
||||
{#if historyLoading || historyError || history.some((entry) => entry.id !== currentVersionId)}
|
||||
<hr class="border-base-100 dark:border-base-800" />
|
||||
{/if}
|
||||
{#if historyLoading}
|
||||
<div class="flex items-center gap-2 px-2 py-2 text-xs text-base-500">
|
||||
<Spinner className="size-3" />{$i18n.t('Loading...')}
|
||||
</div>
|
||||
{:else if historyError}
|
||||
<button type="button" on:click={loadHistory}>{$i18n.t('Retry')}</button>
|
||||
{:else}
|
||||
{#each history.filter((entry) => entry.id !== currentVersionId) as entry}
|
||||
<VersionMenuItem
|
||||
{entry}
|
||||
selected={entry.id === versionId}
|
||||
onSelect={() => chooseVersion(entry.id)}
|
||||
onDelete={disabled
|
||||
? undefined
|
||||
: () => {
|
||||
deleteVersionId = entry.id;
|
||||
showHistory = false;
|
||||
showDeleteVersion = true;
|
||||
}}
|
||||
/>
|
||||
{:else}
|
||||
{#if historyPage > 1}
|
||||
<div class="px-2 py-2 text-xs text-base-500">
|
||||
{$i18n.t('No more versions')}
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{#if historyPage > 1 || history.length === 20}
|
||||
<hr class="border-base-100 dark:border-base-800" />
|
||||
<div class="flex justify-between px-2 py-1 text-xs">
|
||||
<button
|
||||
type="button"
|
||||
disabled={historyLoading || historyPage === 1}
|
||||
class="disabled:opacity-40"
|
||||
on:click={() => {
|
||||
historyPage--;
|
||||
loadHistory();
|
||||
}}>{$i18n.t('Previous')}</button
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
disabled={historyLoading || history.length < 20}
|
||||
class="disabled:opacity-40"
|
||||
on:click={() => {
|
||||
historyPage++;
|
||||
loadHistory();
|
||||
}}>{$i18n.t('Next')}</button
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</Dropdown>
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
{/snippet}
|
||||
{#snippet exports()}
|
||||
<button type="button" on:click={() => exportVersion('skill')}
|
||||
><Download className="size-3.5" />{$i18n.t('Export .skill')}</button
|
||||
>
|
||||
<button type="button" on:click={() => exportVersion('json')}
|
||||
><Download className="size-3.5" />{$i18n.t('Export JSON')}</button
|
||||
>
|
||||
<button type="button" on:click={() => exportVersion('zip')}
|
||||
><Download className="size-3.5" />{$i18n.t('Export ZIP')}</button
|
||||
>
|
||||
{/snippet}
|
||||
</SkillFiles>{/if}
|
||||
</div>
|
||||
|
||||
{#if historical}
|
||||
<div
|
||||
class="flex w-full shrink-0 flex-wrap items-center gap-2 px-1 py-2 text-xs text-base-500"
|
||||
>
|
||||
<span class="mr-auto">{$i18n.t('Read Only')}</span>
|
||||
<div class="ml-auto flex flex-wrap justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-100 px-2.5 text-xs text-base-700 disabled:opacity-60 dark:bg-base-850 dark:text-base-200"
|
||||
disabled={comparing || !!historyDiff}
|
||||
on:click={compareToCurrent}
|
||||
>{#if comparing}<Spinner className="mr-1.5 size-3" />{/if}{$i18n.t(
|
||||
'Compare to current'
|
||||
)}</button
|
||||
>
|
||||
{#if !disabled}<button
|
||||
type="button"
|
||||
class="flex h-7 items-center rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
on:click={setProductionVersion}>{$i18n.t('Set as Production')}</button
|
||||
>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
</Comments>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !readOnly}
|
||||
<div class="flex shrink-0 justify-end gap-3 py-2">
|
||||
<input
|
||||
class="min-w-0 flex-1 bg-transparent px-2 text-xs outline-hidden"
|
||||
placeholder={$i18n.t('Describe this change')}
|
||||
aria-label={$i18n.t('Commit message')}
|
||||
bind:value={commitMessage}
|
||||
/>
|
||||
<button
|
||||
class="flex h-7 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
type="submit"
|
||||
disabled={loading || !fileEditor}
|
||||
>
|
||||
{edit ? $i18n.t('Save') : $i18n.t('Save & Create')}
|
||||
{#if loading}
|
||||
<Spinner className="size-3" />
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
@@ -3,10 +3,9 @@
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import WorkspaceAccessModal from './common/WorkspaceAccessModal.svelte';
|
||||
let accessModal: WorkspaceAccessModal;
|
||||
import { resolveLocalizedResource } from '$lib/utils/localizedContent';
|
||||
@@ -363,465 +362,456 @@
|
||||
successMessage={$i18n.t('Tool imported successfully')}
|
||||
/>
|
||||
|
||||
<Comments modal bind:view={comments} resourceType="tool">
|
||||
{#if loaded}
|
||||
<input
|
||||
id="documents-import-input"
|
||||
bind:this={toolsImportInputElement}
|
||||
bind:files={importFiles}
|
||||
type="file"
|
||||
accept=".json"
|
||||
hidden
|
||||
on:change={() => {
|
||||
console.log(importFiles);
|
||||
showConfirm = true;
|
||||
}}
|
||||
/>
|
||||
{#if loaded}
|
||||
<input
|
||||
id="documents-import-input"
|
||||
bind:this={toolsImportInputElement}
|
||||
bind:files={importFiles}
|
||||
type="file"
|
||||
accept=".json"
|
||||
hidden
|
||||
on:change={() => {
|
||||
console.log(importFiles);
|
||||
showConfirm = true;
|
||||
}}
|
||||
/>
|
||||
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
<input
|
||||
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Tools')}
|
||||
placeholder={$i18n.t('Search Tools')}
|
||||
/>
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="space-y-0">
|
||||
<div class="flex h-8 w-full items-center gap-2">
|
||||
<div class="flex min-w-0 flex-1">
|
||||
<div class=" self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
|
||||
await tick();
|
||||
<input
|
||||
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
bind:value={query}
|
||||
on:input={handleSearchInput}
|
||||
aria-label={$i18n.t('Search Tools')}
|
||||
placeholder={$i18n.t('Search Tools')}
|
||||
/>
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
handleSearchInput();
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if (filteredItems ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
<div
|
||||
class="flex max-w-[55%] shrink-0 overflow-x-auto scrollbar-none"
|
||||
bind:this={tagsContainerElement}
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex w-fit gap-0.5 text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<ViewSelector
|
||||
bind:value={viewOption}
|
||||
align="end"
|
||||
onChange={async (value) => {
|
||||
localStorage.workspaceViewOption = value;
|
||||
|
||||
await tick();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if (filteredItems ?? []).length !== 0}
|
||||
<div class="@container">
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-6 text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
<button
|
||||
class="flex min-w-0 flex-1 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('name')}
|
||||
>
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
{$i18n.t('Name')}
|
||||
{#if sortKey === 'name'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
<div class="@max-[48rem]:hidden">{$i18n.t('Owner')}</div>
|
||||
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
<button
|
||||
class="@max-[36rem]:hidden flex min-w-0 items-center gap-1 py-0.5 text-left"
|
||||
type="button"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated at')}
|
||||
{#if sortKey === 'updated_at'}
|
||||
{#if sortDirection === 'asc'}
|
||||
<ChevronUp className="size-2" />
|
||||
{:else}
|
||||
<ChevronDown className="size-2" />
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each filteredItems as tool}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group text-left {tool.write_access
|
||||
? 'cursor-pointer'
|
||||
: ''}"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (!tool.write_access || shouldIgnoreRowClick(e.target)) return;
|
||||
openTool(tool);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip content={tool.id} className="min-w-0" placement="top-start">
|
||||
{#if tool.write_access}
|
||||
<a
|
||||
href={`/workspace/tools/edit?id=${encodeURIComponent(tool.id)}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{resolveLocalizedResource(tool, $i18n.language)}</a
|
||||
>
|
||||
{:else}
|
||||
<span
|
||||
class="block truncate text-[0.8125rem] leading-5 text-base-800 dark:text-base-200"
|
||||
>{resolveLocalizedResource(tool, $i18n.language)}</span
|
||||
>
|
||||
{/if}
|
||||
</Tooltip>
|
||||
{#if !tool.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
{#if tool?.meta?.manifest?.version}
|
||||
<div
|
||||
class="min-w-0 max-w-[40%] shrink-0 truncate text-[0.6875rem] leading-5 text-base-500"
|
||||
<div class="grid gap-y-0.5">
|
||||
{#each filteredItems as tool}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_9rem_8rem_9.5rem] items-center gap-x-4 px-2 @max-[48rem]:grid-cols-[minmax(0,1fr)_7rem_9.5rem] @max-[48rem]:gap-x-3 @max-[36rem]:grid-cols-[minmax(0,1fr)_9.5rem] @max-[36rem]:gap-x-2 min-h-12 rounded-lg py-1.5 hover:bg-base-1000/[0.03] dark:hover:bg-base-0/[0.03] group text-left {tool.write_access
|
||||
? 'cursor-pointer'
|
||||
: ''}"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
if (!tool.write_access || shouldIgnoreRowClick(e.target)) return;
|
||||
openTool(tool);
|
||||
}}
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||
<Tooltip content={tool.id} className="min-w-0" placement="top-start">
|
||||
{#if tool.write_access}
|
||||
<a
|
||||
href={`/workspace/tools/edit?id=${encodeURIComponent(tool.id)}`}
|
||||
class="focus-ring block truncate rounded text-[0.8125rem] leading-5 text-base-800 group-hover:underline focus-visible:underline dark:text-base-200"
|
||||
>{resolveLocalizedResource(tool, $i18n.language)}</a
|
||||
>
|
||||
{:else}
|
||||
<span
|
||||
class="block truncate text-[0.8125rem] leading-5 text-base-800 dark:text-base-200"
|
||||
>{resolveLocalizedResource(tool, $i18n.language)}</span
|
||||
>
|
||||
v{tool?.meta?.manifest?.version ?? ''}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{#if !tool.write_access}
|
||||
<Badge type="subtle" content={$i18n.t('Read Only')} />
|
||||
{/if}
|
||||
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if resolveLocalizedResource(tool, $i18n.language, 'description')}
|
||||
<Tooltip
|
||||
content={resolveLocalizedResource(tool, $i18n.language, 'description')}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
{#if tool?.meta?.manifest?.version}
|
||||
<div
|
||||
class="min-w-0 max-w-[40%] shrink-0 truncate text-[0.6875rem] leading-5 text-base-500"
|
||||
>
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{resolveLocalizedResource(tool, $i18n.language, 'description')}
|
||||
</div>
|
||||
</Tooltip>
|
||||
v{tool?.meta?.manifest?.version ?? ''}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview
|
||||
user={tool?.user ?? null}
|
||||
side="bottom"
|
||||
className="w-full min-w-0"
|
||||
>
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={tool?.user?.id
|
||||
? `/api/v1/users/${tool.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
tool?.user?.name ?? tool?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs(tool.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400">
|
||||
{dayjs(tool.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
<div class="mt-0.5 min-w-0">
|
||||
{#if resolveLocalizedResource(tool, $i18n.language, 'description')}
|
||||
<Tooltip
|
||||
content={resolveLocalizedResource(tool, $i18n.language, 'description')}
|
||||
className="min-w-0"
|
||||
placement="top-start"
|
||||
>
|
||||
<div class="truncate text-xs leading-4 text-base-500 dark:text-base-400">
|
||||
{resolveLocalizedResource(tool, $i18n.language, 'description')}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
{#if tool.write_access}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
{#if shiftKey}
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
deleteHandler(tool);
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
{#if tool?.meta?.manifest?.funding_url ?? false}
|
||||
<Tooltip content="Support">
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Support')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
selectedTool = tool;
|
||||
showManifestModal = true;
|
||||
}}
|
||||
>
|
||||
<Heart className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tooltip content={$i18n.t('Valves')}>
|
||||
<div class="@max-[48rem]:hidden min-w-0 text-xs text-base-600 dark:text-base-400">
|
||||
<ProfilePreview user={tool?.user ?? null} side="bottom" className="w-full min-w-0">
|
||||
<span class="flex w-full min-w-0 items-center gap-2">
|
||||
<ProfileImage
|
||||
src={tool?.user?.id
|
||||
? `/api/v1/users/${tool.user.id}/profile/image`
|
||||
: '/user.png'}
|
||||
className="size-5 shrink-0 rounded-full!"
|
||||
/>
|
||||
<span class="min-w-0 truncate">
|
||||
{capitalizeFirstLetter(
|
||||
tool?.user?.name ?? tool?.user?.email ?? $i18n.t('Deleted User')
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</ProfilePreview>
|
||||
</div>
|
||||
<Tooltip
|
||||
content={dayjs(tool.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.format('LLLL')}
|
||||
className="@max-[36rem]:hidden min-w-0"
|
||||
>
|
||||
<div class="shrink-0 truncate text-xs leading-5 text-base-500 dark:text-base-400">
|
||||
{dayjs(tool.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex min-w-0 items-center justify-end gap-1.5">
|
||||
{#if tool.write_access}
|
||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||
{#if shiftKey}
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
deleteHandler(tool);
|
||||
}}
|
||||
>
|
||||
<GarbageBin className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
{#if tool?.meta?.manifest?.funding_url ?? false}
|
||||
<Tooltip content="Support">
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Valves')}
|
||||
aria-label={$i18n.t('Support')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
selectedTool = tool;
|
||||
showValvesModal = true;
|
||||
showManifestModal = true;
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-4"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"
|
||||
/>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"
|
||||
/>
|
||||
</svg>
|
||||
<Heart className="size-4" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
modal
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'tool', resource_id: tool.id }}
|
||||
/>
|
||||
<ToolMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={tool.id}
|
||||
accessHandler={$user?.permissions?.sharing?.tools ||
|
||||
$user?.role === 'admin'
|
||||
? () => accessModal.open(tool.id)
|
||||
: null}
|
||||
show={openToolMenuId === tool.id}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/tools/edit?id=${encodeURIComponent(tool.id)}`);
|
||||
}}
|
||||
shareHandler={() => {
|
||||
shareHandler(tool);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneHandler(tool);
|
||||
}}
|
||||
exportHandler={() => {
|
||||
exportHandler(tool);
|
||||
}}
|
||||
deleteHandler={async () => {
|
||||
selectedTool = tool;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
onClose={() => {
|
||||
openToolMenuId = null;
|
||||
}}
|
||||
>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Tool Menu')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openToolMenuId = openToolMenuId === tool.id ? null : tool.id;
|
||||
}}
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
</ToolMenu>
|
||||
<Tooltip
|
||||
content={updatingTools[tool.id]
|
||||
? $i18n.t('Saving...')
|
||||
: tool.is_active
|
||||
? $i18n.t('Enabled')
|
||||
: $i18n.t('Disabled')}
|
||||
>
|
||||
<Switch
|
||||
bind:state={tool.is_active}
|
||||
disabled={updatingTools[tool.id] ?? false}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${resolveLocalizedResource(tool, $i18n.language)}`}
|
||||
on:change={() => toggleToolHandler(tool)}
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{#if !tool.write_access}
|
||||
<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
modal
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'tool', resource_id: tool.id }}
|
||||
/>
|
||||
<span class="size-6 shrink-0" aria-hidden="true"></span>
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Switch
|
||||
state={tool.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${resolveLocalizedResource(tool, $i18n.language)}`}
|
||||
|
||||
<Tooltip content={$i18n.t('Valves')}>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Valves')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
selectedTool = tool;
|
||||
showValvesModal = true;
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-4"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"
|
||||
/>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<CommentsDropdown
|
||||
bind:view={comments}
|
||||
showResource
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'tool', resource_id: tool.id }}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<ToolMenu
|
||||
onComment={(request) => (comments = request)}
|
||||
resourceId={tool.id}
|
||||
accessHandler={$user?.permissions?.sharing?.tools || $user?.role === 'admin'
|
||||
? () => accessModal.open(tool.id)
|
||||
: null}
|
||||
show={openToolMenuId === tool.id}
|
||||
editHandler={() => {
|
||||
goto(`/workspace/tools/edit?id=${encodeURIComponent(tool.id)}`);
|
||||
}}
|
||||
shareHandler={() => {
|
||||
shareHandler(tool);
|
||||
}}
|
||||
cloneHandler={() => {
|
||||
cloneHandler(tool);
|
||||
}}
|
||||
exportHandler={() => {
|
||||
exportHandler(tool);
|
||||
}}
|
||||
deleteHandler={async () => {
|
||||
selectedTool = tool;
|
||||
showDeleteConfirm = true;
|
||||
}}
|
||||
onClose={() => {
|
||||
openToolMenuId = null;
|
||||
}}
|
||||
>
|
||||
<button
|
||||
class="flex size-6 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Tool Menu')}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openToolMenuId = openToolMenuId === tool.id ? null : tool.id;
|
||||
}}
|
||||
>
|
||||
<EllipsisHorizontal className="size-4" />
|
||||
</button>
|
||||
</ToolMenu>
|
||||
<Tooltip
|
||||
content={updatingTools[tool.id]
|
||||
? $i18n.t('Saving...')
|
||||
: tool.is_active
|
||||
? $i18n.t('Enabled')
|
||||
: $i18n.t('Disabled')}
|
||||
>
|
||||
<Switch
|
||||
bind:state={tool.is_active}
|
||||
disabled={updatingTools[tool.id] ?? false}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${resolveLocalizedResource(tool, $i18n.language)}`}
|
||||
on:change={() => toggleToolHandler(tool)}
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{#if !tool.write_access}
|
||||
<CommentsDropdown
|
||||
bind:view={comments}
|
||||
showResource
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-lg text-base-400 transition dark:text-base-500"
|
||||
resource={{ resource_type: 'tool', resource_id: tool.id }}
|
||||
/>
|
||||
<span class="size-6 shrink-0" aria-hidden="true"></span>
|
||||
<div
|
||||
class="flex h-6 items-center"
|
||||
role="presentation"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Switch
|
||||
state={tool.is_active}
|
||||
disabled
|
||||
tooltip={$i18n.t('Read Only')}
|
||||
ariaLabel={`${$i18n.t('Enabled')}: ${resolveLocalizedResource(tool, $i18n.language)}`}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No tools found') : $i18n.t('No tools yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div class="mb-1.5 text-sm">
|
||||
{hasFilters ? $i18n.t('No tools found') : $i18n.t('No tools yet')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{hasFilters
|
||||
? $i18n.t('Try adjusting your search or filter to find what you are looking for.')
|
||||
: $i18n.t('Items you create or that are shared with you will appear here.')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if $config?.features.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=tool"
|
||||
title={$i18n.t('Discover a tool')}
|
||||
description={$i18n.t('Discover, download, and explore custom tools')}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
title={$i18n.t('Delete tool?')}
|
||||
on:confirm={() => {
|
||||
deleteHandler(selectedTool);
|
||||
}}
|
||||
>
|
||||
<div class=" text-sm text-base-500 truncate">
|
||||
{$i18n.t('This will delete')}
|
||||
<span class=" font-normal">{resolveLocalizedResource(selectedTool, $i18n.language)}</span>.
|
||||
</div>
|
||||
</DeleteConfirmDialog>
|
||||
|
||||
<ValvesModal
|
||||
bind:show={showValvesModal}
|
||||
type="tool"
|
||||
id={selectedTool?.id ?? null}
|
||||
meta={selectedTool?.meta}
|
||||
{#if $config?.features.enable_community_sharing}
|
||||
<CommunityDiscover
|
||||
href="https://openwebui.com/search?type=tool"
|
||||
title={$i18n.t('Discover a tool')}
|
||||
description={$i18n.t('Discover, download, and explore custom tools')}
|
||||
/>
|
||||
<ManifestModal bind:show={showManifestModal} manifest={selectedTool?.meta?.manifest ?? {}} />
|
||||
|
||||
<ConfirmDialog
|
||||
bind:show={showConfirm}
|
||||
on:confirm={() => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = async (event) => {
|
||||
const _tools = JSON.parse(event.target.result);
|
||||
console.log(_tools);
|
||||
|
||||
for (const tool of _tools) {
|
||||
const res = await createNewTool(localStorage.token, tool).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
toast.success($i18n.t('Tool imported successfully'));
|
||||
await init();
|
||||
importFiles = null;
|
||||
toolsImportInputElement.value = '';
|
||||
};
|
||||
|
||||
reader.readAsText(importFiles[0]);
|
||||
}}
|
||||
>
|
||||
<div class="text-sm text-base-500">
|
||||
<div class=" bg-yellow-500/20 text-yellow-700 dark:text-yellow-200 rounded-lg px-4 py-3">
|
||||
<div>{$i18n.t('Please carefully review the following warnings:')}</div>
|
||||
|
||||
<ul class=" mt-1 list-disc pl-4 text-xs">
|
||||
<li>
|
||||
{$i18n.t(
|
||||
'Tools have a function calling system that allows arbitrary code execution.'
|
||||
)}.
|
||||
</li>
|
||||
<li>{$i18n.t('Do not install tools from sources you do not fully trust.')}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="my-3">
|
||||
{$i18n.t(
|
||||
'I acknowledge that I have read and I understand the implications of my action. I am aware of the risks associated with executing arbitrary code and I have verified the trustworthiness of the source.'
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ConfirmDialog>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
</Comments>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
bind:show={showDeleteConfirm}
|
||||
title={$i18n.t('Delete tool?')}
|
||||
on:confirm={() => {
|
||||
deleteHandler(selectedTool);
|
||||
}}
|
||||
>
|
||||
<div class=" text-sm text-base-500 truncate">
|
||||
{$i18n.t('This will delete')}
|
||||
<span class=" font-normal">{resolveLocalizedResource(selectedTool, $i18n.language)}</span>.
|
||||
</div>
|
||||
</DeleteConfirmDialog>
|
||||
|
||||
<ValvesModal
|
||||
bind:show={showValvesModal}
|
||||
type="tool"
|
||||
id={selectedTool?.id ?? null}
|
||||
meta={selectedTool?.meta}
|
||||
/>
|
||||
<ManifestModal bind:show={showManifestModal} manifest={selectedTool?.meta?.manifest ?? {}} />
|
||||
|
||||
<ConfirmDialog
|
||||
bind:show={showConfirm}
|
||||
on:confirm={() => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = async (event) => {
|
||||
const _tools = JSON.parse(event.target.result);
|
||||
console.log(_tools);
|
||||
|
||||
for (const tool of _tools) {
|
||||
const res = await createNewTool(localStorage.token, tool).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
toast.success($i18n.t('Tool imported successfully'));
|
||||
await init();
|
||||
importFiles = null;
|
||||
toolsImportInputElement.value = '';
|
||||
};
|
||||
|
||||
reader.readAsText(importFiles[0]);
|
||||
}}
|
||||
>
|
||||
<div class="text-sm text-base-500">
|
||||
<div class=" bg-yellow-500/20 text-yellow-700 dark:text-yellow-200 rounded-lg px-4 py-3">
|
||||
<div>{$i18n.t('Please carefully review the following warnings:')}</div>
|
||||
|
||||
<ul class=" mt-1 list-disc pl-4 text-xs">
|
||||
<li>
|
||||
{$i18n.t('Tools have a function calling system that allows arbitrary code execution.')}.
|
||||
</li>
|
||||
<li>{$i18n.t('Do not install tools from sources you do not fully trust.')}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="my-3">
|
||||
{$i18n.t(
|
||||
'I acknowledge that I have read and I understand the implications of my action. I am aware of the risks associated with executing arbitrary code and I have verified the trustworthiness of the source.'
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ConfirmDialog>
|
||||
{:else}
|
||||
<div class="w-full h-full flex justify-center items-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
@@ -2,10 +2,9 @@
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { goto } = getPageContext();
|
||||
|
||||
import Comments from '$lib/components/comments/Comments.svelte';
|
||||
import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte';
|
||||
import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte';
|
||||
let comments: CommentsRequest | null = null;
|
||||
import CommentButton from '$lib/components/comments/CommentButton.svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { getContext, onMount, tick } from 'svelte';
|
||||
|
||||
@@ -317,293 +316,292 @@ class Tools:
|
||||
}}
|
||||
/>
|
||||
|
||||
<Comments bind:view={comments} resourceType="tool">
|
||||
<div class="flex h-full w-full min-w-0 flex-col overflow-hidden">
|
||||
<form
|
||||
bind:this={formElement}
|
||||
class="flex h-full min-h-0 min-w-0 flex-col"
|
||||
on:submit|preventDefault={() => {
|
||||
if (selected) return;
|
||||
if (edit) {
|
||||
submitHandler();
|
||||
} else {
|
||||
showConfirm = true;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="flex shrink-0 items-center justify-between gap-2">
|
||||
<div class="flex min-w-0 items-center gap-3">
|
||||
<button
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 transition-colors duration-75 hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
goto('/workspace/tools');
|
||||
}}
|
||||
>
|
||||
<ChevronLeft className="size-3" strokeWidth="2" />
|
||||
<span>{$i18n.t('Back')}</span>
|
||||
</button>
|
||||
<div class="flex h-full w-full min-w-0 flex-col overflow-hidden">
|
||||
<form
|
||||
bind:this={formElement}
|
||||
class="flex h-full min-h-0 min-w-0 flex-col"
|
||||
on:submit|preventDefault={() => {
|
||||
if (selected) return;
|
||||
if (edit) {
|
||||
submitHandler();
|
||||
} else {
|
||||
showConfirm = true;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="flex shrink-0 items-center justify-between gap-2">
|
||||
<div class="flex min-w-0 items-center gap-3">
|
||||
<button
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 transition-colors duration-75 hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
goto('/workspace/tools');
|
||||
}}
|
||||
>
|
||||
<ChevronLeft className="size-3" strokeWidth="2" />
|
||||
<span>{$i18n.t('Back')}</span>
|
||||
</button>
|
||||
|
||||
{#if edit && version_id}
|
||||
<ToolHistory
|
||||
bind:this={historyControl}
|
||||
resource={{ id, version_id }}
|
||||
bind:selected
|
||||
bind:selecting
|
||||
bind:promoting
|
||||
dirty={changed || !!commitMessage}
|
||||
disabled={loading}
|
||||
onProduction={productionHandler}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex shrink-0 items-center gap-1 pr-0.5">
|
||||
{#if edit && id}<CommentButton
|
||||
onComment={(request) => (comments = request)}
|
||||
wrapperClassName="me-2"
|
||||
resource={{ resource_type: 'tool', resource_id: id }}
|
||||
/>{/if}
|
||||
<LanguageModeSelect
|
||||
bind:value={locale}
|
||||
translatedLocales={Object.keys(
|
||||
pruneEmptyLocaleEntries(selected ? selected.snapshot.meta.i18n : meta.i18n)
|
||||
)}
|
||||
{#if edit && version_id}
|
||||
<ToolHistory
|
||||
bind:this={historyControl}
|
||||
resource={{ id, version_id }}
|
||||
bind:selected
|
||||
bind:selecting
|
||||
bind:promoting
|
||||
dirty={changed || !!commitMessage}
|
||||
disabled={loading}
|
||||
onProduction={productionHandler}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex shrink-0 items-center gap-1 pr-0.5">
|
||||
{#if edit && id}<CommentsDropdown
|
||||
bind:view={comments}
|
||||
deepLink
|
||||
wrapperClassName="me-2"
|
||||
resource={{ resource_type: 'tool', resource_id: id }}
|
||||
/>{/if}
|
||||
<LanguageModeSelect
|
||||
bind:value={locale}
|
||||
translatedLocales={Object.keys(
|
||||
pruneEmptyLocaleEntries(selected ? selected.snapshot.meta.i18n : meta.i18n)
|
||||
)}
|
||||
/>
|
||||
|
||||
{#if $user?.permissions?.sharing?.tools || $user?.role === 'admin'}
|
||||
<AccessButton
|
||||
disabled={!!selected || loading || selecting || promoting}
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(accessGrants);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
{#if $user?.permissions?.sharing?.tools || $user?.role === 'admin'}
|
||||
<AccessButton
|
||||
disabled={!!selected || loading || selecting || promoting}
|
||||
on:click={() => {
|
||||
savedAccessGrants = structuredClone(accessGrants);
|
||||
showAccessControlModal = true;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex shrink-0 flex-col gap-2 pb-2 px-1 sm:flex-row sm:items-start">
|
||||
<div class="min-w-0 w-full flex-1">
|
||||
<Tooltip content={$i18n.t('e.g. My Tools')} placement="top-start">
|
||||
{#if selected}
|
||||
<LocalizedField
|
||||
disabled
|
||||
placeholder={$i18n.t('Tool Name')}
|
||||
showControls={false}
|
||||
value={selected.snapshot.name}
|
||||
translations={selected.snapshot.meta.i18n}
|
||||
{locale}
|
||||
required
|
||||
/>
|
||||
{:else}
|
||||
<LocalizedField
|
||||
placeholder={$i18n.t('Tool Name')}
|
||||
showControls={false}
|
||||
bind:value={name}
|
||||
bind:translations={meta.i18n}
|
||||
{locale}
|
||||
required
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
<div class="flex shrink-0 flex-col gap-2 pb-2 px-1 sm:flex-row sm:items-start">
|
||||
<div class="min-w-0 w-full flex-1">
|
||||
<Tooltip content={$i18n.t('e.g. My Tools')} placement="top-start">
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
{#if edit}
|
||||
<div class="shrink-0 truncate font-mono" title={id}>
|
||||
{id}
|
||||
</div>
|
||||
{:else}
|
||||
<Tooltip
|
||||
className="min-w-[8rem] flex-1"
|
||||
content={$i18n.t('e.g. my_tools')}
|
||||
placement="top-start"
|
||||
>
|
||||
<input
|
||||
class="w-full bg-transparent font-mono outline-hidden disabled:text-base-500"
|
||||
type="text"
|
||||
placeholder={$i18n.t('Tool ID')}
|
||||
aria-label={$i18n.t('Tool ID')}
|
||||
bind:value={id}
|
||||
required
|
||||
disabled={edit}
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
<Tooltip
|
||||
className="flex min-w-0 flex-1 items-center"
|
||||
content={$i18n.t('e.g. Tools for performing various operations')}
|
||||
placement="top-start"
|
||||
>
|
||||
{#if selected}
|
||||
<LocalizedField
|
||||
disabled
|
||||
placeholder={$i18n.t('Tool Name')}
|
||||
placeholder={$i18n.t('Tool Description')}
|
||||
showControls={false}
|
||||
value={selected.snapshot.name}
|
||||
value={selected.snapshot.meta.description}
|
||||
translations={selected.snapshot.meta.i18n}
|
||||
{locale}
|
||||
field="description"
|
||||
required
|
||||
/>
|
||||
{:else}
|
||||
<LocalizedField
|
||||
placeholder={$i18n.t('Tool Name')}
|
||||
placeholder={$i18n.t('Tool Description')}
|
||||
showControls={false}
|
||||
bind:value={name}
|
||||
bind:value={meta.description}
|
||||
bind:translations={meta.i18n}
|
||||
{locale}
|
||||
field="description"
|
||||
required
|
||||
/>
|
||||
{/if}
|
||||
</Tooltip>
|
||||
|
||||
<div class="mt-0.5 flex min-w-0 items-center gap-2 text-xs text-base-500">
|
||||
{#if edit}
|
||||
<div class="shrink-0 truncate font-mono" title={id}>
|
||||
{id}
|
||||
</div>
|
||||
{:else}
|
||||
<Tooltip
|
||||
className="min-w-[8rem] flex-1"
|
||||
content={$i18n.t('e.g. my_tools')}
|
||||
placement="top-start"
|
||||
>
|
||||
<input
|
||||
class="w-full bg-transparent font-mono outline-hidden disabled:text-base-500"
|
||||
type="text"
|
||||
placeholder={$i18n.t('Tool ID')}
|
||||
aria-label={$i18n.t('Tool ID')}
|
||||
bind:value={id}
|
||||
required
|
||||
disabled={edit}
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
<Tooltip
|
||||
className="flex min-w-0 flex-1 items-center"
|
||||
content={$i18n.t('e.g. Tools for performing various operations')}
|
||||
placement="top-start"
|
||||
>
|
||||
{#if selected}
|
||||
<LocalizedField
|
||||
disabled
|
||||
placeholder={$i18n.t('Tool Description')}
|
||||
showControls={false}
|
||||
value={selected.snapshot.meta.description}
|
||||
translations={selected.snapshot.meta.i18n}
|
||||
{locale}
|
||||
field="description"
|
||||
required
|
||||
/>
|
||||
{:else}
|
||||
<LocalizedField
|
||||
placeholder={$i18n.t('Tool Description')}
|
||||
showControls={false}
|
||||
bind:value={meta.description}
|
||||
bind:translations={meta.i18n}
|
||||
{locale}
|
||||
field="description"
|
||||
required
|
||||
/>
|
||||
{/if}
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 overflow-hidden rounded-lg flex flex-col">
|
||||
{#if locale && !comparison}
|
||||
{#key selected?.id}
|
||||
{#if selected}
|
||||
<PluginTranslations
|
||||
{id}
|
||||
kind="tool"
|
||||
{locale}
|
||||
readOnly
|
||||
translations={selected.snapshot.meta.i18n}
|
||||
/>
|
||||
{:else}
|
||||
<PluginTranslations
|
||||
id={edit ? id : ''}
|
||||
kind="tool"
|
||||
{locale}
|
||||
bind:translations={meta.i18n}
|
||||
/>
|
||||
{/if}
|
||||
{/key}
|
||||
{/if}
|
||||
<div class="min-h-0 flex-1 overflow-hidden rounded-lg flex flex-col">
|
||||
{#if locale && !comparison}
|
||||
{#key selected?.id}
|
||||
{#if selected}
|
||||
<PluginTranslations
|
||||
{id}
|
||||
kind="tool"
|
||||
{locale}
|
||||
readOnly
|
||||
translations={selected.snapshot.meta.i18n}
|
||||
/>
|
||||
{:else}
|
||||
<PluginTranslations
|
||||
id={edit ? id : ''}
|
||||
kind="tool"
|
||||
{locale}
|
||||
bind:translations={meta.i18n}
|
||||
/>
|
||||
{/if}
|
||||
{/key}
|
||||
{/if}
|
||||
|
||||
{#if comparison}
|
||||
<VersionDiff
|
||||
currentLabel={$i18n.t('Production')}
|
||||
showFileHeaders={false}
|
||||
diff={{
|
||||
fromId: comparison.from_id,
|
||||
toId: comparison.to_id,
|
||||
metadata: comparison.metadata,
|
||||
files:
|
||||
comparison.content_diff || comparison.line_endings_only
|
||||
? [{ path: `${id}.py`, status: 'modified', binary: false }]
|
||||
: []
|
||||
}}
|
||||
loadFileDiff={async () => ({
|
||||
diff: comparison.content_diff,
|
||||
line_endings_only: comparison.line_endings_only
|
||||
})}
|
||||
onClose={() => {
|
||||
comparison = null;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{#if selected && !locale && !comparison}
|
||||
<CodeEditor
|
||||
value={selected.snapshot.content}
|
||||
lang="python"
|
||||
readOnly
|
||||
ariaLabel={$i18n.t('Code Editor')}
|
||||
className="text-[0.6875rem]"
|
||||
/>
|
||||
{/if}
|
||||
<div class={locale || comparison || selected ? 'hidden' : 'h-full min-h-0'}>
|
||||
<CodeEditor
|
||||
bind:this={codeEditor}
|
||||
value={content}
|
||||
readOnly={!!selected || selecting || promoting}
|
||||
lang="python"
|
||||
ariaLabel={$i18n.t('Code Editor')}
|
||||
{boilerplate}
|
||||
className="text-[0.6875rem]"
|
||||
onChange={(e: string) => {
|
||||
if (selected) return;
|
||||
content = e;
|
||||
_content = e;
|
||||
if (!edit) {
|
||||
const fm = extractFrontmatter(e) as Record<string, string>;
|
||||
if (fm.title && !name) {
|
||||
name = formatSkillName(fm.title);
|
||||
id = nameToId(fm.title);
|
||||
}
|
||||
if (fm.description && !meta.description) {
|
||||
meta = { ...meta, description: fm.description };
|
||||
}
|
||||
{#if comparison}
|
||||
<VersionDiff
|
||||
currentLabel={$i18n.t('Production')}
|
||||
showFileHeaders={false}
|
||||
diff={{
|
||||
fromId: comparison.from_id,
|
||||
toId: comparison.to_id,
|
||||
metadata: comparison.metadata,
|
||||
files:
|
||||
comparison.content_diff || comparison.line_endings_only
|
||||
? [{ path: `${id}.py`, status: 'modified', binary: false }]
|
||||
: []
|
||||
}}
|
||||
loadFileDiff={async () => ({
|
||||
diff: comparison.content_diff,
|
||||
line_endings_only: comparison.line_endings_only
|
||||
})}
|
||||
onClose={() => {
|
||||
comparison = null;
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{#if selected && !locale && !comparison}
|
||||
<CodeEditor
|
||||
value={selected.snapshot.content}
|
||||
lang="python"
|
||||
readOnly
|
||||
ariaLabel={$i18n.t('Code Editor')}
|
||||
className="text-[0.6875rem]"
|
||||
/>
|
||||
{/if}
|
||||
<div class={locale || comparison || selected ? 'hidden' : 'h-full min-h-0'}>
|
||||
<CodeEditor
|
||||
bind:this={codeEditor}
|
||||
value={content}
|
||||
readOnly={!!selected || selecting || promoting}
|
||||
lang="python"
|
||||
ariaLabel={$i18n.t('Code Editor')}
|
||||
{boilerplate}
|
||||
className="text-[0.6875rem]"
|
||||
onChange={(e: string) => {
|
||||
if (selected) return;
|
||||
content = e;
|
||||
_content = e;
|
||||
if (!edit) {
|
||||
const fm = extractFrontmatter(e) as Record<string, string>;
|
||||
if (fm.title && !name) {
|
||||
name = formatSkillName(fm.title);
|
||||
id = nameToId(fm.title);
|
||||
}
|
||||
}}
|
||||
onSave={async () => {
|
||||
if (formElement) {
|
||||
formElement.requestSubmit();
|
||||
if (fm.description && !meta.description) {
|
||||
meta = { ...meta, description: fm.description };
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
}}
|
||||
onSave={async () => {
|
||||
if (formElement) {
|
||||
formElement.requestSubmit();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 py-2 text-xs text-base-500">
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<Tooltip
|
||||
className="min-w-0 flex-1"
|
||||
content={warning}
|
||||
allowHTML={false}
|
||||
placement="top-start"
|
||||
>
|
||||
<div class="truncate">{warning}</div>
|
||||
</Tooltip>
|
||||
<div class="shrink-0 py-2 text-xs text-base-500">
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<Tooltip
|
||||
className="min-w-0 flex-1"
|
||||
content={warning}
|
||||
allowHTML={false}
|
||||
placement="top-start"
|
||||
>
|
||||
<div class="truncate">{warning}</div>
|
||||
</Tooltip>
|
||||
|
||||
<div class="ml-auto flex min-w-0 max-w-full shrink-0 items-center gap-3">
|
||||
{#if selected}
|
||||
{#if !comparison}
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 text-xs text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
disabled={comparing || promoting || selecting}
|
||||
on:click={compareToCurrent}
|
||||
>
|
||||
{$i18n.t('Compare to current')}{#if comparing}<Spinner className="size-3" />{/if}
|
||||
</button>
|
||||
{/if}
|
||||
<div class="ml-auto flex min-w-0 max-w-full shrink-0 items-center gap-3">
|
||||
{#if selected}
|
||||
{#if !comparison}
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 disabled:opacity-60 dark:bg-base-100 dark:text-base-900"
|
||||
disabled={promoting || selecting}
|
||||
on:click={() => historyControl?.requestPromotion()}
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 text-xs text-base-500 hover:text-base-900 dark:hover:text-base-100"
|
||||
disabled={comparing || promoting || selecting}
|
||||
on:click={compareToCurrent}
|
||||
>
|
||||
{$i18n.t('Set as Production')}{#if promoting}<Spinner className="size-3" />{/if}
|
||||
</button>
|
||||
{:else}
|
||||
<input
|
||||
class="w-32 min-w-0 flex-1 border-0 bg-transparent text-xs outline-hidden placeholder:text-base-400"
|
||||
aria-label={$i18n.t('Describe this change')}
|
||||
placeholder={$i18n.t('Describe this change')}
|
||||
bind:value={commitMessage}
|
||||
disabled={loading}
|
||||
/>
|
||||
<button
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
type="submit"
|
||||
disabled={loading || selecting || promoting || (edit && !changed)}
|
||||
>
|
||||
{edit ? $i18n.t('Save') : $i18n.t('Save & Create')}
|
||||
{#if loading}
|
||||
<Spinner className="size-3" />
|
||||
{/if}
|
||||
{$i18n.t('Compare to current')}{#if comparing}<Spinner className="size-3" />{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 disabled:opacity-60 dark:bg-base-100 dark:text-base-900"
|
||||
disabled={promoting || selecting}
|
||||
on:click={() => historyControl?.requestPromotion()}
|
||||
>
|
||||
{$i18n.t('Set as Production')}{#if promoting}<Spinner className="size-3" />{/if}
|
||||
</button>
|
||||
{:else}
|
||||
<input
|
||||
class="w-32 min-w-0 flex-1 border-0 bg-transparent text-xs outline-hidden placeholder:text-base-400"
|
||||
aria-label={$i18n.t('Describe this change')}
|
||||
placeholder={$i18n.t('Describe this change')}
|
||||
bind:value={commitMessage}
|
||||
disabled={loading}
|
||||
/>
|
||||
<button
|
||||
class="flex h-7 shrink-0 items-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs text-base-0 transition hover:bg-base-1000 disabled:opacity-60 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
type="submit"
|
||||
disabled={loading || selecting || promoting || (edit && !changed)}
|
||||
>
|
||||
{edit ? $i18n.t('Save') : $i18n.t('Save & Create')}
|
||||
{#if loading}
|
||||
<Spinner className="size-3" />
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Comments>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:show={showConfirm}
|
||||
|
||||
@@ -3094,6 +3094,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "مشاركة الشاشة",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "التمرير إلى الأسفل",
|
||||
"Scroll to Top": "التمرير إلى الأعلى",
|
||||
"Search": "البحث",
|
||||
|
||||
@@ -3094,6 +3094,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "مشاركة الشاشة",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "التمرير إلى الأسفل",
|
||||
"Scroll to Top": "التمرير إلى الأعلى",
|
||||
"Search": "البحث",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "İcazə sahələri",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} tətbiqinin tələb etdiyi icazə sahələri",
|
||||
"Screen Share": "Ekranı paylaş",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Aşağı sürüşdür",
|
||||
"Scroll to Top": "Yuxarı sürüşdür",
|
||||
"Search": "Axtar",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Обхвати на достъп",
|
||||
"Scopes requested by {{APP_NAME}}": "Обхвати, заявени от {{APP_NAME}}",
|
||||
"Screen Share": "Споделяне на екрана",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Превъртане до долу",
|
||||
"Scroll to Top": "Превъртане до горе",
|
||||
"Search": "Търси",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "অনুমতির পরিধি",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}}-এর অনুরোধ করা অনুমতির পরিধি",
|
||||
"Screen Share": "স্ক্রিন শেয়ার",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "একেবারে নিচে স্ক্রল করুন",
|
||||
"Scroll to Top": "একেবারে উপরে স্ক্রল করুন",
|
||||
"Search": "অনুসন্ধান",
|
||||
|
||||
@@ -2974,6 +2974,7 @@
|
||||
"Scopes": "དབང་ཆའི་ཁྱབ་ཁོངས།",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} ཡིས་ཞུས་པའི་དབང་ཆའི་ཁྱབ་ཁོངས།",
|
||||
"Screen Share": "བརྙན་ཡོལ་མཉམ་སྤྱོད།",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "མཐིལ་དུ་འདེད་པ།",
|
||||
"Scroll to Top": "སྟེང་དུ་འདེད་པ།",
|
||||
"Search": "འཚོལ་བཤེར།",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Opsezi dozvola",
|
||||
"Scopes requested by {{APP_NAME}}": "Opsezi dozvola koje traži aplikacija {{APP_NAME}}",
|
||||
"Screen Share": "Dijeljenje ekrana",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Pomakni na dno",
|
||||
"Scroll to Top": "Pomakni na vrh",
|
||||
"Search": "Pretraga",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Àmbits",
|
||||
"Scopes requested by {{APP_NAME}}": "Àmbits sol·licitats per {{APP_NAME}}",
|
||||
"Screen Share": "Compartir la pantalla",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Anar al peu de pàgina",
|
||||
"Scroll to Top": "Anar a dalt",
|
||||
"Search": "Cercar",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Mga sakop sa pagtugot",
|
||||
"Scopes requested by {{APP_NAME}}": "Mga sakop sa pagtugot nga gipangayo sa {{APP_NAME}}",
|
||||
"Screen Share": "Ipaambit ang screen",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "I-scroll sa ubos",
|
||||
"Scroll to Top": "I-scroll sa ibabaw",
|
||||
"Search": "Pagpanukiduki",
|
||||
|
||||
@@ -3046,6 +3046,7 @@
|
||||
"Scopes": "Rozsahy oprávnění",
|
||||
"Scopes requested by {{APP_NAME}}": "Rozsahy oprávnění požadované aplikací {{APP_NAME}}",
|
||||
"Screen Share": "Sdílení obrazovky",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Posunout dolů",
|
||||
"Scroll to Top": "Posunout nahoru",
|
||||
"Search": "Hledat",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Adgangsområder",
|
||||
"Scopes requested by {{APP_NAME}}": "Adgangsområder, som {{APP_NAME}} anmoder om",
|
||||
"Screen Share": "Skærmdeling",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Rul til bunden",
|
||||
"Scroll to Top": "Rul til toppen",
|
||||
"Search": "Søg",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Scopes",
|
||||
"Scopes requested by {{APP_NAME}}": "Von {{APP_NAME}} angeforderte Scopes",
|
||||
"Screen Share": "Bildschirmfreigabe",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Nach unten scrollen",
|
||||
"Scroll to Top": "Zum Anfang scrollen",
|
||||
"Search": "Suchen",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "Such Screen Share",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Scroll to such bottom",
|
||||
"Scroll to Top": "Scroll to Such Top",
|
||||
"Search": "Such Search",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Scopes",
|
||||
"Scopes requested by {{APP_NAME}}": "Scope που ζητά η εφαρμογή {{APP_NAME}}",
|
||||
"Screen Share": "Κοινή χρήση οθόνης",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Κύλιση στο τέλος",
|
||||
"Scroll to Top": "Κύλιση στην αρχή",
|
||||
"Search": "Αναζήτηση",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "",
|
||||
"Scroll to Top": "",
|
||||
"Search": "",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "",
|
||||
"Scroll to Top": "",
|
||||
"Search": "",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Ámbitos",
|
||||
"Scopes requested by {{APP_NAME}}": "Ámbitos solicitados por {{APP_NAME}}",
|
||||
"Screen Share": "Compartir pantalla",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Desplazarse al final",
|
||||
"Scroll to Top": "Desplazar al principio",
|
||||
"Search": "Buscar",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Ulatused",
|
||||
"Scopes requested by {{APP_NAME}}": "Rakenduse {{APP_NAME}} taotletud ulatused",
|
||||
"Screen Share": "Ekraani jagamine",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Keri lõppu",
|
||||
"Scroll to Top": "Keri algusesse",
|
||||
"Search": "Otsing",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Baimen-esparruak",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} aplikazioak eskatutako baimen-esparruak",
|
||||
"Screen Share": "Pantaila partekatzea",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Korritu beheraino",
|
||||
"Scroll to Top": "Korritu goraino",
|
||||
"Search": "Bilatu",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "محدوده\u200cها",
|
||||
"Scopes requested by {{APP_NAME}}": "محدوده\u200cهای درخواست شده توسط {{APP_NAME}}",
|
||||
"Screen Share": "اشتراک\u200cگذاری صفحه",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "اسکرول به پایین",
|
||||
"Scroll to Top": "اسکرول به بالا",
|
||||
"Search": "جستجو",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Käyttöalueet",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}}:n pyytämät käyttöoikeudet",
|
||||
"Screen Share": "Näytön jakaminen",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Vieritä alas",
|
||||
"Scroll to Top": "Vieritä ylös",
|
||||
"Search": "Haku",
|
||||
|
||||
@@ -3000,6 +3000,7 @@
|
||||
"Scopes": "Mga Scope",
|
||||
"Scopes requested by {{APP_NAME}}": "Mga scope na hinihiling ng {{APP_NAME}}",
|
||||
"Screen Share": "Pagbabahagi ng Screen",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Mag-scroll sa ibaba",
|
||||
"Scroll to Top": "Mag-scroll sa Itaas",
|
||||
"Search": "Maghanap",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Scopes",
|
||||
"Scopes requested by {{APP_NAME}}": "Scopes, sum {{APP_NAME}} biður um",
|
||||
"Screen Share": "Skermdeiling",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Skrulla niðast",
|
||||
"Scroll to Top": "Skrulla ovast",
|
||||
"Search": "Leita",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "Partage d'écran",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Faire défiler vers le bas",
|
||||
"Scroll to Top": "Faire défiler vers le haut",
|
||||
"Search": "Recherche",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "Partage d'écran",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Faire défiler vers le bas",
|
||||
"Scroll to Top": "Retour en haut",
|
||||
"Search": "Recherche",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Ámbitos",
|
||||
"Scopes requested by {{APP_NAME}}": "Ámbitos solicitados por {{APP_NAME}}",
|
||||
"Screen Share": "Compartir pantalla",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Desprazar ata abaixo",
|
||||
"Scroll to Top": "Desprazar ata arriba",
|
||||
"Search": "Buscar",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "היקפים",
|
||||
"Scopes requested by {{APP_NAME}}": "היקפים שמבקשת האפליקציה {{APP_NAME}}",
|
||||
"Screen Share": "שיתוף מסך",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "גלול לתחתית",
|
||||
"Scroll to Top": "גלול למעלה",
|
||||
"Search": "חפש",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "स्कोप",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} द्वारा अनुरोधित स्कोप",
|
||||
"Screen Share": "स्क्रीन साझा करें",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "नीचे स्क्रॉल करें",
|
||||
"Scroll to Top": "ऊपर स्क्रॉल करें",
|
||||
"Search": "खोजें",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Opsezi dopuštenja",
|
||||
"Scopes requested by {{APP_NAME}}": "Opsezi dopuštenja koje traži {{APP_NAME}}",
|
||||
"Screen Share": "Dijeljenje zaslona",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Pomakni na dno",
|
||||
"Scroll to Top": "Pomakni na vrh",
|
||||
"Search": "Pretraga",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Hatókörök",
|
||||
"Scopes requested by {{APP_NAME}}": "A(z) {{APP_NAME}} által kért hatókörök",
|
||||
"Screen Share": "Képernyőmegosztás",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Görgetés az aljára",
|
||||
"Scroll to Top": "Görgetés a tetejére",
|
||||
"Search": "Keresés",
|
||||
|
||||
@@ -2989,6 +2989,7 @@
|
||||
"Scopes": "Cakupan",
|
||||
"Scopes requested by {{APP_NAME}}": "Cakupan yang diminta oleh {{APP_NAME}}",
|
||||
"Screen Share": "Bagikan Layar",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Gulir ke bawah",
|
||||
"Scroll to Top": "Gulir ke Atas",
|
||||
"Search": "Cari",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Raonta Feidhme",
|
||||
"Scopes requested by {{APP_NAME}}": "Raonta feidhme a d'iarr an aip {{APP_NAME}}",
|
||||
"Screen Share": "Comhroinnt Scáileáin",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Scrollaigh go bun",
|
||||
"Scroll to Top": "Scrollaigh go Barr",
|
||||
"Search": "Cuardaigh",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Ambiti",
|
||||
"Scopes requested by {{APP_NAME}}": "Ambiti richiesti da {{APP_NAME}}",
|
||||
"Screen Share": "Condivisione schermo",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Vai in fondo",
|
||||
"Scroll to Top": "Vai in cima",
|
||||
"Search": "Cerca",
|
||||
|
||||
@@ -2989,6 +2989,7 @@
|
||||
"Scopes": "スコープ",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} が要求するスコープ",
|
||||
"Screen Share": "画面共有",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "末尾へスクロール",
|
||||
"Scroll to Top": "先頭へスクロール",
|
||||
"Search": "検索",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Scope-ები",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}}-ის მიერ მოთხოვნილი scope-ები",
|
||||
"Screen Share": "ეკრანის გაზიარება",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "ბოლოში გადახვევა",
|
||||
"Scroll to Top": "დასაწყისში გადახვევა",
|
||||
"Search": "ძებნა",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Scopes",
|
||||
"Scopes requested by {{APP_NAME}}": "Scopes yettwasutren sɣur {{APP_NAME}}",
|
||||
"Screen Share": "Beṭṭu n ugdil",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Ddu ɣer wadda",
|
||||
"Scroll to Top": "Ddu ɣer usawen",
|
||||
"Search": "Anadi",
|
||||
|
||||
@@ -2976,6 +2976,7 @@
|
||||
"Scopes": "스코프",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} 앱에서 요청한 스코프",
|
||||
"Screen Share": "화면 공유",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "맨 아래로 스크롤",
|
||||
"Scroll to Top": "맨 위로 스크롤",
|
||||
"Search": "검색",
|
||||
|
||||
@@ -3046,6 +3046,7 @@
|
||||
"Scopes": "Aprėptys",
|
||||
"Scopes requested by {{APP_NAME}}": "Programos {{APP_NAME}} prašomos aprėptys",
|
||||
"Screen Share": "Ekrano bendrinimas",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Slinkti į apačią",
|
||||
"Scroll to Top": "Slinkti į viršų",
|
||||
"Search": "Ieškoti",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Tvērumi",
|
||||
"Scopes requested by {{APP_NAME}}": "Lietotnes {{APP_NAME}} pieprasītie tvērumi",
|
||||
"Screen Share": "Ekrāna kopīgošana",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Ritināt līdz apakšai",
|
||||
"Scroll to Top": "Ritināt līdz augšai",
|
||||
"Search": "Meklēt",
|
||||
|
||||
@@ -2989,6 +2989,7 @@
|
||||
"Scopes": "Skop",
|
||||
"Scopes requested by {{APP_NAME}}": "Skop yang diminta oleh {{APP_NAME}}",
|
||||
"Screen Share": "Perkongsian Skrin",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Tatal ke Bahagian Bawah",
|
||||
"Scroll to Top": "Tatal ke Atas",
|
||||
"Search": "Carian",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Omfang",
|
||||
"Scopes requested by {{APP_NAME}}": "Omfang forespurt av {{APP_NAME}}",
|
||||
"Screen Share": "Skjermdeling",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Rull til bunnen",
|
||||
"Scroll to Top": "Rull til toppen",
|
||||
"Search": "Søk",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Toegangsbereiken",
|
||||
"Scopes requested by {{APP_NAME}}": "Toegangsbereiken aangevraagd door {{APP_NAME}}",
|
||||
"Screen Share": "Scherm delen",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Naar beneden scrollen",
|
||||
"Scroll to Top": "Naar boven scrollen",
|
||||
"Search": "Zoeken",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "ਸਕੋਪ",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} ਵੱਲੋਂ ਬੇਨਤੀ ਕੀਤੇ ਸਕੋਪ",
|
||||
"Screen Share": "ਸਕ੍ਰੀਨ ਸਾਂਝ",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "ਹੇਠਾਂ ਤੱਕ ਸਕ੍ਰੋਲ ਕਰੋ",
|
||||
"Scroll to Top": "ਸਿਖਰ ਤੱਕ ਸਕ੍ਰੋਲ ਕਰੋ",
|
||||
"Search": "ਖੋਜ",
|
||||
|
||||
@@ -3046,6 +3046,7 @@
|
||||
"Scopes": "Zakresy",
|
||||
"Scopes requested by {{APP_NAME}}": "Zakresy żądane przez aplikację {{APP_NAME}}",
|
||||
"Screen Share": "Udostępnianie ekranu",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Przewiń do dołu",
|
||||
"Scroll to Top": "Przewiń na górę",
|
||||
"Search": "Szukaj",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Escopos",
|
||||
"Scopes requested by {{APP_NAME}}": "Escopos solicitados por {{APP_NAME}}",
|
||||
"Screen Share": "Compartilhamento de Tela",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Rolar para baixo",
|
||||
"Scroll to Top": "Rolar para o topo",
|
||||
"Search": "Pesquisar",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "Partilha de ecrã",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Deslocar até ao fim",
|
||||
"Scroll to Top": "Deslocar até ao Topo",
|
||||
"Search": "Pesquisar",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Scope-uri",
|
||||
"Scopes requested by {{APP_NAME}}": "Scope-uri solicitate de {{APP_NAME}}",
|
||||
"Screen Share": "Partajare ecran",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Derulează la final",
|
||||
"Scroll to Top": "Derulează la început",
|
||||
"Search": "Caută",
|
||||
|
||||
@@ -3046,6 +3046,7 @@
|
||||
"Scopes": "Области",
|
||||
"Scopes requested by {{APP_NAME}}": "Области, запрашиваемые приложением «{{APP_NAME}}»",
|
||||
"Screen Share": "Демонстрация экрана",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Прокрутить вниз",
|
||||
"Scroll to Top": "Прокрутить наверх",
|
||||
"Search": "Поиск",
|
||||
|
||||
@@ -3046,6 +3046,7 @@
|
||||
"Scopes": "Rozsahy",
|
||||
"Scopes requested by {{APP_NAME}}": "Rozsahy požadované aplikáciou {{APP_NAME}}",
|
||||
"Screen Share": "Zdieľanie obrazovky",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Posunúť na koniec",
|
||||
"Scroll to Top": "Posunúť na začiatok",
|
||||
"Search": "Vyhľadávanie",
|
||||
|
||||
@@ -3046,6 +3046,7 @@
|
||||
"Scopes": "Obsegi",
|
||||
"Scopes requested by {{APP_NAME}}": "Obsegi, ki jih zahteva {{APP_NAME}}",
|
||||
"Screen Share": "Deljenje zaslona",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Pomakni se na dno",
|
||||
"Scroll to Top": "Scroll to Top",
|
||||
"Search": "Iskanje",
|
||||
|
||||
@@ -3022,6 +3022,7 @@
|
||||
"Scopes": "Опсези",
|
||||
"Scopes requested by {{APP_NAME}}": "Опсези које тражи {{APP_NAME}}",
|
||||
"Screen Share": "Дељење екрана",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Помери на дно",
|
||||
"Scroll to Top": "Помери на врх",
|
||||
"Search": "Претражи",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Omfång",
|
||||
"Scopes requested by {{APP_NAME}}": "Omfång som begärs av {{APP_NAME}}",
|
||||
"Screen Share": "Skärmdelning",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Rulla längst ner",
|
||||
"Scroll to Top": "Rulla högst upp",
|
||||
"Search": "Sök",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "ஸ்கோப்கள்",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} கோரிய ஸ்கோப்கள்",
|
||||
"Screen Share": "திரைப் பகிர்வு",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "கீழே உருட்டவும்",
|
||||
"Scroll to Top": "மேலே உருட்டவும்",
|
||||
"Search": "தேடு",
|
||||
|
||||
@@ -2974,6 +2974,7 @@
|
||||
"Scopes": "Scope",
|
||||
"Scopes requested by {{APP_NAME}}": "Scope ที่ {{APP_NAME}} ร้องขอ",
|
||||
"Screen Share": "แชร์หน้าจอ",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "เลื่อนไปด้านล่างสุด",
|
||||
"Scroll to Top": "เลื่อนขึ้นไปด้านบนสุด",
|
||||
"Search": "ค้นหา",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Scope-lar",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} tarapyndan soralan scope-lar",
|
||||
"Screen Share": "Ekrany Paýlaşmak",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Iň aşaga aýla",
|
||||
"Scroll to Top": "Iň Ýokara Aýla",
|
||||
"Search": "Gözleg",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "Kapsamlar",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} tarafından istenen kapsamlar",
|
||||
"Screen Share": "Ekran Paylaşımı",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "En alta kaydır",
|
||||
"Scroll to Top": "Başa Kaydır",
|
||||
"Search": "Ara",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "scope",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} تەلەپ قىلغان scope",
|
||||
"Screen Share": "ئېكران ھەمبەھىرلەش",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "ئاستىغا سىيرىش",
|
||||
"Scroll to Top": "ئۈستىگە سىيرىش",
|
||||
"Search": "ئىزدەش",
|
||||
|
||||
@@ -3046,6 +3046,7 @@
|
||||
"Scopes": "Області дії",
|
||||
"Scopes requested by {{APP_NAME}}": "Області дії, запитані застосунком {{APP_NAME}}",
|
||||
"Screen Share": "Демонстрація екрана",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Прокрутити донизу",
|
||||
"Scroll to Top": "Прокрутити догори",
|
||||
"Search": "Пошук",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "اسکوپس",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} کے درخواست کردہ اسکوپس",
|
||||
"Screen Share": "اسکرین شیئرنگ",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "نیچے تک اسکرول کریں",
|
||||
"Scroll to Top": "اوپر تک اسکرول کریں",
|
||||
"Search": "تلاش کریں",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "",
|
||||
"Scroll to Top": "",
|
||||
"Search": "Қидирув",
|
||||
|
||||
@@ -2998,6 +2998,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "",
|
||||
"Scroll to Top": "",
|
||||
"Search": "Qidiruv",
|
||||
|
||||
@@ -2974,6 +2974,7 @@
|
||||
"Scopes": "Phạm vi",
|
||||
"Scopes requested by {{APP_NAME}}": "Phạm vi do {{APP_NAME}} yêu cầu",
|
||||
"Screen Share": "Chia sẻ màn hình",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "Cuộn xuống cuối",
|
||||
"Scroll to Top": "Cuộn lên đầu",
|
||||
"Search": "Tìm kiếm",
|
||||
|
||||
@@ -2986,6 +2986,7 @@
|
||||
"Scopes": "",
|
||||
"Scopes requested by {{APP_NAME}}": "",
|
||||
"Screen Share": "屏幕共享",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "滚动到底部",
|
||||
"Scroll to Top": "回到顶部",
|
||||
"Search": "搜索",
|
||||
|
||||
@@ -2974,6 +2974,7 @@
|
||||
"Scopes": "權限範圍",
|
||||
"Scopes requested by {{APP_NAME}}": "{{APP_NAME}} 要求的權限範圍",
|
||||
"Screen Share": "螢幕分享",
|
||||
"Screenshot": "",
|
||||
"Scroll to bottom": "捲動至底部",
|
||||
"Scroll to Top": "回到頂部",
|
||||
"Search": "搜尋",
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import type { Readable } from 'svelte/store';
|
||||
import type { i18n as I18n } from 'i18next';
|
||||
import { page } from '$app/stores';
|
||||
import { WEBUI_NAME } from '$lib/stores';
|
||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||
|
||||
const i18n = getContext<Readable<I18n>>('i18n');
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -18,23 +13,11 @@
|
||||
<main
|
||||
id="main-content"
|
||||
tabindex="-1"
|
||||
class="min-h-dvh w-full p-6 flex flex-col items-center justify-center text-center"
|
||||
class="min-h-dvh w-full p-6 flex items-center justify-center text-center"
|
||||
>
|
||||
<div class="my-auto w-full sm:max-w-xl py-20 sm:pb-10 sm:pt-0 dark:text-base-100">
|
||||
<h1 class="text-xl font-normal tabular-nums">{$page.status}</h1>
|
||||
{#if $page.error?.message}
|
||||
<p class="mt-3 text-xs leading-5 text-balance text-base-500 dark:text-base-400">
|
||||
{$page.error.message}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<a
|
||||
href="/"
|
||||
class="mt-6 mx-auto flex w-fit h-7 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-base-900 px-2.5 text-xs font-normal text-base-0 transition hover:bg-base-1000 dark:bg-base-100 dark:text-base-900 dark:hover:bg-base-0"
|
||||
>
|
||||
{$i18n?.t('Home') ?? 'Home'}
|
||||
</a>
|
||||
</div>
|
||||
<h1 class="text-xl font-normal text-balance dark:text-base-100">
|
||||
{$page.status}{#if $page.error?.message}: {$page.error.message}{/if}
|
||||
</h1>
|
||||
</main>
|
||||
|
||||
<div class="fixed top-0 left-0 m-10 z-50">
|
||||
|
||||
Reference in new issue
Block a user