diff --git a/ui/apps/chat/src/app.css b/ui/apps/chat/src/app.css
index 03e0e7d27424..67c707c312eb 100644
--- a/ui/apps/chat/src/app.css
+++ b/ui/apps/chat/src/app.css
@@ -23,6 +23,11 @@
--safe-area-bottom: env(safe-area-inset-bottom, 0px);
/* where the phone's corner controls (menu toggle, context gauge, sidebar logo) sit */
--corner-control-top: calc(1rem + var(--safe-area-top));
+ /* where the phone's bottom corner actions (a page's floating key) sit: as far in from
+ the side as up from the bottom, which keeps a 56px key about concentric with an
+ iPhone's rounded screen corner */
+ --corner-control-side: 1.75rem;
+ --corner-control-bottom: calc(var(--corner-control-side) + var(--safe-area-bottom));
/* where a phone page's title starts: a row below the corner controls */
--page-top: calc(var(--corner-control-top) + 3.75rem);
/* expanded desktop sidebar width, overridden once the user drags its edge */
@@ -75,6 +80,9 @@
/* the installed app's status bar already sets them apart from the screen's edge */
:root {
--corner-control-top: calc(0.25rem + var(--safe-area-top));
+ /* the home indicator is a short bar in the middle, so the corners beside it are
+ free: a corner action ignores its inset and keeps the same gap as from the side */
+ --corner-control-bottom: var(--corner-control-side);
}
html {
@@ -296,11 +304,15 @@
}
/* While something is dragged, what it passes over takes no hover: only the
- sections themselves stay targets, for the drop */
+ sections themselves, and the projects in them, stay targets, for the drop */
body[data-sidebar-dragging] [data-sidebar-section] * {
pointer-events: none;
}
+ body[data-sidebar-dragging] [data-sidebar-section] [data-sidebar-section] {
+ pointer-events: auto;
+ }
+
.sidebar-drag-overlay {
position: fixed;
z-index: 1000;
diff --git a/ui/apps/chat/src/lib/components/app/actions/FloatingActionButton.svelte b/ui/apps/chat/src/lib/components/app/actions/FloatingActionButton.svelte
new file mode 100644
index 000000000000..0689c01a6dbe
--- /dev/null
+++ b/ui/apps/chat/src/lib/components/app/actions/FloatingActionButton.svelte
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
diff --git a/ui/apps/chat/src/lib/components/app/actions/index.ts b/ui/apps/chat/src/lib/components/app/actions/index.ts
index 8b0279d06216..7a1db73a293a 100644
--- a/ui/apps/chat/src/lib/components/app/actions/index.ts
+++ b/ui/apps/chat/src/lib/components/app/actions/index.ts
@@ -14,3 +14,6 @@ export { default as ActionIconCopyToClipboard } from './ActionIconCopyToClipboar
/** A round matte glass key: a phone's corner keys and the key back to a chat's bottom. */
export { default as GlassKey } from './GlassKey.svelte';
+
+/** A page's main action on a phone: a round key pinned to the bottom-right corner. */
+export { default as FloatingActionButton } from './FloatingActionButton.svelte';
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte
index 3c404086b635..0358140ee282 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte
@@ -11,7 +11,8 @@
ChatFormCurrentWorkingDirectory,
ChatFormInput,
ChatFormInputFileInputInvisible,
- ChatFormPickers
+ ChatFormPickers,
+ ChatFormProjectChip
} from '#lib/components/app/index.ts';
import {
CHAT_FORM_SINGLE_ROW_MAX_TEXT_PX,
@@ -38,6 +39,7 @@
conversationsStore,
deviceStore,
modelsStore,
+ projectsStore,
serverStore,
settingsStore,
toolsStore,
@@ -137,6 +139,14 @@
conversationsStore.activeConversation?.cwd ?? conversationsStore.preferences.pendingCwd
);
+ // the project the chat is in, or the one picked for the chat about to start
+ let project = $derived.by(() => {
+ const active = conversationsStore.activeConversation;
+ const projectId = active ? active.projectId : conversationsStore.preferences.pendingProjectId;
+
+ return projectId ? projectsStore.get(projectId) : undefined;
+ });
+
let showWorkingDirectory = $derived(conversationsStore.preferences.hasEnabledCwdTools());
// On a desktop the chip under the form shows a directory once one is set, and the + menu
// sets one until then. A phone has no chip: a chat shows it in its header (see
@@ -823,7 +833,37 @@
>
{/if}
- {#if showWorkingDirectory}
+ {#if project}
+
+
+
+
+ {#if showWorkingDirectoryChip}
+ ·
+ {/if}
+
+ {#if showWorkingDirectory}
+
+ {/if}
+
+ {:else if showWorkingDirectory}
+ {
+ drawerOpen = false;
+ uiStore.openProjectPicker({
+ currentProjectId:
+ conversationsStore.activeConversation?.projectId ??
+ conversationsStore.preferences.pendingProjectId,
+ onSelect: (projectId) =>
+ void conversationsStore.assignActiveConversationProject(
+ projectsStore.get(projectId) ?? null
+ )
+ });
+ }}
+ type="button"
+ >
+
+
+ {ATTACHMENT_MENU_TEXT.ADD_TO_PROJECT}
+
+
attachmentMenu.callbacks[AttachmentAction.SYSTEM_PROMPT_CLICK]()}
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte
index d86d663f3808..8836a8225d50 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte
@@ -4,7 +4,7 @@
import * as Tooltip from '@ggml-org/llama-ui/ui/tooltip';
import { cn } from '@ggml-org/llama-ui/utils';
import { File, Folder, MessageSquare, Plus } from '@lucide/svelte';
- import { ChatFormActionAddToolsSubmenu } from '#lib/components/app/index.ts';
+ import { ChatFormActionAddToolsSubmenu, ProjectSubmenu } from '#lib/components/app/index.ts';
import {
ATTACHMENT_FILE_ITEMS,
ATTACHMENT_MENU_TEXT,
@@ -17,6 +17,7 @@
import { AttachmentAction, AttachmentItemEnabledWhen, ModelModality } from '#lib/enums/index.ts';
import { useAttachmentMenu } from '#lib/hooks/use-attachment-menu.svelte.ts';
import { agenticMode } from '#lib/stores/agentic-mode.svelte.ts';
+ import { conversationsStore, projectsStore } from '#lib/stores/index.ts';
import type { Component } from 'svelte';
interface Props {
@@ -134,6 +135,17 @@
+ (dropdownOpen = false)}
+ onSelect={(projectId) =>
+ void conversationsStore.assignActiveConversationProject(
+ projectsStore.get(projectId) ?? null
+ )}
+ />
+
{
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormPickerMention.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormPickerMention.svelte
index ed3c764529c3..2f3d59b94d74 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormPickerMention.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormPickerMention.svelte
@@ -22,12 +22,16 @@
* Floating file/folder mention picker. The chat input is the search
* surface: `query` (typed after `@`) drives a `file_glob_search` tool
* call scoped to `scopePath`. The parent owns the "dismissed token,
- * don't re-open until it changes" snapshot.
+ * don't re-open until it changes" snapshot. A host without an `@` token,
+ * like a project's context, shows the list's own search field and binds
+ * `query` instead.
*/
interface Props {
class?: string;
isOpen: boolean;
query: string;
+ /** Renders the list's own search field, for hosts without an `@` token. */
+ showSearchInput?: boolean;
customAnchor?: HTMLElement | null;
scopePath?: string | null;
onClose: () => void;
@@ -43,8 +47,9 @@
onClose,
onOpened,
onSelect,
- query,
- scopePath = null
+ query = $bindable(''),
+ scopePath = null,
+ showSearchInput = false
}: Props = $props();
const nav = usePickerNavigation({
@@ -226,14 +231,16 @@
sideOffset={12}
>
entry.type + ':' + entry.path}
items={displayedItems}
+ onSearchClose={onClose}
scrollTrigger={nav.scrollTrigger}
- searchQuery={query ?? ''}
+ searchPlaceholder="Search files"
selectedIndex={nav.hoveredIndex}
- showSearchInput={false}
+ {showSearchInput}
>
{#snippet item(entry, index, isSelected)}
+ import * as Tooltip from '@ggml-org/llama-ui/ui/tooltip';
+ import { X } from '@lucide/svelte';
+ import { ActionIcon } from '#lib/components/app/actions/index.ts';
+ import { conversationsStore, projectsStore, uiStore } from '#lib/stores/index.ts';
+ import type { Project } from '#lib/types/index.ts';
+
+ interface Props {
+ disabled?: boolean;
+ project: Project;
+ }
+
+ let { disabled = false, project }: Props = $props();
+
+ function pickProject() {
+ uiStore.openProjectPicker({
+ currentProjectId: project.id,
+ onSelect: (projectId) =>
+ void conversationsStore.assignActiveConversationProject(
+ projectsStore.get(projectId) ?? null
+ )
+ });
+ }
+
+
+
+
+
+
+ {#snippet child({ props })}
+
+ {project.name}
+
+ {/snippet}
+
+
+
+ Change project
+
+
+
+
+
void conversationsStore.assignActiveConversationProject(null)}
+ tooltip="Remove from project"
+ />
+
+
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageAssistant/ChatMessageAssistant.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageAssistant/ChatMessageAssistant.svelte
index 5a5b3cd92a5f..4cfa5f0766fb 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageAssistant/ChatMessageAssistant.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageAssistant/ChatMessageAssistant.svelte
@@ -256,7 +256,7 @@
var(--last-user-message-height, 19rem) + var(--chat-form-height, 6rem) +
var(--chat-form-bottom-position, 0.5rem) + var(--chat-form-padding-top, 6rem) +
var(--assistant-margin-top, 1rem) + var(--chat-tabs-offset, 0px) +
- var(--sent-message-top-offset)
+ var(--sent-message-top-offset) + var(--chat-header-height, 0px)
);
min-height: calc(100dvh - var(--assistant-min-height-offset));
@@ -266,7 +266,7 @@
var(--last-user-message-height, 18rem) + var(--chat-form-height, 6rem) +
var(--chat-form-bottom-position, 1rem) + var(--chat-form-padding-top, 6rem) +
var(--assistant-margin-top, 1rem) + var(--chat-tabs-offset, 0px) +
- var(--sent-message-top-offset)
+ var(--sent-message-top-offset) + var(--chat-header-height, 0px)
);
}
}
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte
index b70fe2244cd5..dc5747b36775 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte
@@ -1,5 +1,6 @@
{#if info}
-
- {#if info.path === null}
+ {#if info.path === null}
+
Working directory cleared
- {:else}
-
-
- Set working directory to
-
-
- {info.display}
-
- {/if}
-
+
+ {:else}
+
+ {/if}
{/if}
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte
new file mode 100644
index 000000000000..999f000279e4
--- /dev/null
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte
@@ -0,0 +1,21 @@
+
+
+
+
+
+ Set working directory to
+
+ {display}
+
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte
index fbe885de69c0..171ecfd6a83a 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte
@@ -25,8 +25,7 @@
CHAT_FORM_MOVE_SHIFT_PX,
CHAT_FORM_MOVE_TO_BOTTOM_IN_MS,
CHAT_FORM_MOVE_TO_BOTTOM_OUT_MS,
- CHAT_SIDE_CARDS_COLUMN_MIN_PX,
- ROUTES
+ CHAT_SIDE_CARDS_COLUMN_MIN_PX
} from '#lib/constants/index.ts';
import { useBackendAvailability } from '#lib/hooks/use-backend-availability.svelte.ts';
import { useChatScreenActiveModel } from '#lib/hooks/use-chat-screen-active-model.svelte.ts';
@@ -46,16 +45,29 @@
import { parseFilesToMessageExtras } from '#lib/utils/browser-only.ts';
import { disableScrollHandling, onNavigate } from '$app/navigation';
import { page } from '$app/state';
- import { tick, untrack } from 'svelte';
+ import { type Snippet, tick, untrack } from 'svelte';
import { MediaQuery } from 'svelte/reactivity';
import { fade } from 'svelte/transition';
- let { showCenteredEmpty = false } = $props();
+ interface Props {
+ /** Sits above the messages. */
+ header?: Snippet;
+ /** Scrolls away under the header, e.g. a title. */
+ intro?: Snippet;
+ /** Takes the place of the messages, with the form at the bottom. */
+ overview?: Snippet;
+ /** Sit between the intro and the overview, e.g. a project's instructions and context. */
+ panels?: Snippet;
+ showCenteredEmpty?: boolean;
+ }
+
+ let { header, intro, overview, panels, showCenteredEmpty = false }: Props = $props();
// wide enough for the side cards to take a column beside the messages
const sideCardsColumn = new MediaQuery(`min-width: ${CHAT_SIDE_CARDS_COLUMN_MIN_PX}px`);
let emptyFileNames = $state([]);
+ let headerHeight = $state(0);
let showDeleteDialog = $state(false);
let showEmptyFileDialog = $state(false);
let isEmpty = $derived(
@@ -302,6 +314,7 @@
0 ? `${headerHeight}px` : undefined}
class="chat-screen flex min-w-0 grow flex-col min-h-[calc(100dvh-1rem)] md:min-h-[calc(100dvh-var(--chat-tabs-offset,0px))] px-4 md:py-0 pt-(--page-top) pb-48 md:pb-4"
ondragenter={dragAndDrop.dragHandlers.dragenter}
ondragleave={dragAndDrop.dragHandlers.dragleave}
@@ -331,11 +344,35 @@
{/if}
+ {#if header}
+
+
+
+ {@render header()}
+
+
+ {/if}
+
{#if !sideCardsColumn.current}
{/if}
- {#if !isEmpty}
+ {#if panels}
+
+
+ {@render intro?.()}
+
+ {@render panels()}
+
+ {@render overview?.()}
+
+ {:else if overview}
+
+ {@render overview()}
+
+ {:else if !isEmpty}
- {#if stick.farFromBottom && page.route.id === ROUTES.CHAT && page.params.id}
+ {#if stick.farFromBottom && page.params.id}
stick.scrollToBottom('smooth')} />
{/if}
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte
index 60f185e1b62f..893bc368723e 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte
@@ -14,31 +14,45 @@
import { useScrollCarousel } from '#lib/hooks/use-scroll-carousel.svelte.ts';
import { chatStore, conversationsStore, tabsStore, uiStore } from '#lib/stores/index.ts';
import type { MenuAction } from '#lib/types/index.ts';
- import { resolveTabView } from '#lib/utils/index.ts';
+ import { projectNewChatTabId, projectOfNewChatTab, resolveTabView } from '#lib/utils/index.ts';
+ import { goto } from '$app/navigation';
import { page } from '$app/state';
- import { tick } from 'svelte';
+ import { type Snippet, tick } from 'svelte';
+
+ interface Props {
+ /** Sits before the tabs, e.g. the breadcrumb of a project view. */
+ leading?: Snippet;
+ }
+
+ let { leading }: Props = $props();
const carousel = useScrollCarousel();
- let view = $derived(resolveTabView(page, tabsStore.openTabs));
+ let view = $derived(resolveTabView(page, tabsStore.openTabs, conversationsStore.conversations));
let activeId = $derived(view.activeId);
let tabs = $derived(
- view.ids.map((id) =>
- id === NEW_CHAT_TAB_ID
- ? { href: view.hrefFor(id), icon: SquarePen, id, name: NEW_CHAT_LABEL }
- : {
- href: view.hrefFor(id),
- id,
- name:
- conversationsStore.conversations.find((c) => c.id === id)?.name ?? UNNAMED_CHAT_LABEL
- }
- )
+ view.ids.map((id) => {
+ if (id === NEW_CHAT_TAB_ID || projectOfNewChatTab(id)) {
+ return { href: view.hrefFor(id), icon: SquarePen, id, name: NEW_CHAT_LABEL };
+ }
+
+ return {
+ href: view.hrefFor(id),
+ id,
+ name: conversationsStore.conversations.find((c) => c.id === id)?.name ?? UNNAMED_CHAT_LABEL
+ };
+ })
);
- // hide the New chat button while a new-chat tab is already open
- let showNewChatButton = $derived(!view.ids.includes(NEW_CHAT_TAB_ID));
+ // the new-chat tab of the view: the regular one, or the project's own
+ let newChatTabId = $derived(
+ view.projectId ? projectNewChatTabId(view.projectId) : NEW_CHAT_TAB_ID
+ );
+
+ // hide the New chat button while that tab is already open
+ let showNewChatButton = $derived(!view.ids.includes(newChatTabId));
let loadingIds = $derived(new Set(chatStore.getAllLoadingChats()));
@@ -46,6 +60,11 @@
void tabsStore.close(id, id === activeId, view);
}
+ function openNewChat() {
+ void tabsStore.openInNewTab(newChatTabId);
+ void goto(view.hrefFor(newChatTabId));
+ }
+
function handleStop(id: string, event: MouseEvent) {
event.stopPropagation();
void chatStore.stopGenerationForChat(id);
@@ -135,44 +154,48 @@
: CHAT_TABS_MAX_WIDTH.COLLAPSED_SIDEBAR
]}
>
-
-
- {#each tabs as tab (tab.id)}
-
- tabsStore.activate(id)}
- onAuxClick={handleAuxClick}
- onClose={handleClose}
- onStop={handleStop}
- {tab}
- />
-
- {/each}
-
- {#if showNewChatButton}
- void tabsStore.openInNewTab(NEW_CHAT_TAB_ID, { activate: true })}
- />
- {/if}
-
-
-
-
-
+
+ {#if leading}
+
{@render leading()}
+ {/if}
+
+
+
+ {#each tabs as tab (tab.id)}
+
+ void goto(view.hrefFor(id))}
+ onAuxClick={handleAuxClick}
+ onClose={handleClose}
+ onStop={handleStop}
+ {tab}
+ />
+
+ {/each}
+
+ {#if showNewChatButton}
+
+ {/if}
+
+
+
+
+
+
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsNewChatButton.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsNewChatButton.svelte
index a3a8f1439bbb..35affb808ba1 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsNewChatButton.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsNewChatButton.svelte
@@ -4,10 +4,11 @@
import { ICON_CLASS_DEFAULT } from '#lib/constants/index.ts';
interface Props {
+ label?: string;
onclick?: () => void;
}
- let { onclick }: Props = $props();
+ let { label = 'New chat', onclick }: Props = $props();
@@ -15,8 +16,8 @@
{#snippet child({ props })}
@@ -25,6 +26,6 @@
- New chat
+ {label}
diff --git a/ui/apps/chat/src/lib/components/app/chat/index.ts b/ui/apps/chat/src/lib/components/app/chat/index.ts
index 728af4d183e4..4a861a78a16f 100644
--- a/ui/apps/chat/src/lib/components/app/chat/index.ts
+++ b/ui/apps/chat/src/lib/components/app/chat/index.ts
@@ -249,6 +249,14 @@ export { default as ChatFormInput } from './ChatForm/ChatFormInput/ChatFormInput
*/
export { default as ChatFormCurrentWorkingDirectory } from './ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte';
+/**
+ * **ChatFormProjectChip** - The chat's project under the chat form
+ *
+ * Shown beside the working directory. A click changes the project and the
+ * hover × takes the chat out of it.
+ */
+export { default as ChatFormProjectChip } from './ChatForm/ChatFormProjectChip/ChatFormProjectChip.svelte';
+
/**
* Shared popover wrapper for inline picker popovers (prompts, resources).
* Provides consistent positioning, styling, and open/close behavior.
@@ -453,6 +461,12 @@ export { default as ChatMessageStatisticsBadge } from './ChatMessages/ChatMessag
*/
export { default as ChatMessageCwdChange } from './ChatMessages/ChatMessage/ChatMessageCwdChange.svelte';
+/**
+ * The `Set working directory to
` row itself, shared by the synthetic
+ * cwd message and by the project folder row.
+ */
+export { default as ChatMessageCwdChangeRow } from './ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte';
+
/**
* Generic wrapper for UI-generated (synthetic) messages. Routes the
* working-directory change to ChatMessageCwdChange and renders a muted
@@ -578,11 +592,13 @@ export { default as ChatScreen } from './ChatScreen/ChatScreen.svelte';
* **ChatTabs** - Browser-style tab bar for open conversations
*
* Horizontal strip of tabs rendered above ChatScreen in the chat layout,
- * one per conversation tracked by tabsStore. The active tab follows the
- * route's conversation id; clicking a tab navigates to it, middle-click or
- * the close button closes it (switching to the left neighbor when closing
- * the active tab), and a trailing "+" button starts a new chat. Shows a
- * spinner on tabs with a running generation. Desktop-only.
+ * showing the tabs of the route's view (see `resolveTabView`): every open
+ * tab in the regular view, or the chats of the open project in a project
+ * view, led by the project breadcrumb. The active tab follows the route;
+ * clicking a tab navigates to it, middle-click or the close button closes
+ * it (switching to the left neighbor when closing the active tab), and a
+ * trailing "+" button starts a new chat, inside the project in a project
+ * view. Shows a spinner on tabs with a running generation. Desktop-only.
*/
export { default as ChatTabs } from './ChatTabs/ChatTabs.svelte';
diff --git a/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte b/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte
index 035c3d4ca554..7fb11e8d35a8 100644
--- a/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte
+++ b/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte
@@ -21,6 +21,7 @@
ICON_CLASS_DEFAULT,
ICON_CLASS_SM,
ICON_CLASS_XS,
+ PROJECT_ICON,
SIDEBAR_ACTIONS_ITEMS
} from '#lib/constants/index.ts';
import { KeyboardKey, SidebarAction } from '#lib/enums/index.ts';
@@ -36,6 +37,7 @@
conversationsStore,
deviceStore,
modelsDiscoverStore,
+ projectsStore,
uiStore
} from '#lib/stores/index.ts';
import type { DatabaseConversation } from '#lib/types/database.js';
@@ -98,17 +100,33 @@
conversation: DatabaseConversation,
snippet?: ConversationSearchSnippet
): SearchEntry {
+ const project = conversation.projectId ? projectsStore.get(conversation.projectId) : undefined;
+ const time = formatRelativeTime(conversation.lastModified);
+
return {
icon: MessageSquare,
id: `chat-${conversation.id}`,
label: conversation.name,
- meta: formatRelativeTime(conversation.lastModified),
+ meta: project ? `${project.name} · ${time}` : time,
pinned: conversation.pinned,
- run: () => close(() => goto(RouterService.chat(conversation.id))),
+ run: () => close(() => goto(RouterService.conversation(conversation))),
snippet
};
}
+ const projectEntries = $derived.by((): SearchEntry[] =>
+ projectsStore.projects
+ .filter((project) => matches(project.name))
+ .slice(0, limit)
+ .map((project) => ({
+ icon: PROJECT_ICON,
+ id: `project-${project.id}`,
+ label: project.name,
+ meta: project.archived ? 'Archived' : undefined,
+ run: () => close(() => uiStore.openProjectDialog({ projectId: project.id }))
+ }))
+ );
+
const recentConversations = $derived(
[...conversationsStore.conversations].sort((a, b) => b.lastModified - a.lastModified)
);
@@ -286,6 +304,7 @@
loading: contentSearch.isSearching && !!needle,
title: 'In messages'
},
+ { entries: projectEntries, title: 'Projects' },
{ entries: suggestedEntries, title: 'Suggested models' },
{ entries: actionEntries, title: 'Actions' },
{
diff --git a/ui/apps/chat/src/lib/components/app/index.ts b/ui/apps/chat/src/lib/components/app/index.ts
index 1ffd96ad6882..caad6ca89755 100644
--- a/ui/apps/chat/src/lib/components/app/index.ts
+++ b/ui/apps/chat/src/lib/components/app/index.ts
@@ -10,3 +10,4 @@ export * from './settings';
export * from './models';
export * from './navigation';
export * from './servers';
+export * from './projects';
diff --git a/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuActions.svelte b/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuActions.svelte
index 878aa540a81f..ee3cf165377e 100644
--- a/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuActions.svelte
+++ b/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuActions.svelte
@@ -19,6 +19,7 @@
/** Anchors the menu to this element instead of its trigger, and keeps it a menu on a phone too, for one opened by a press-and-hold. */
anchor?: HTMLElement | null;
open?: boolean;
+ triggerIconClass?: string;
}
let {
@@ -28,6 +29,7 @@
open = $bindable(false),
triggerClass = '',
triggerIcon,
+ triggerIconClass = 'size-icon-xs',
triggerTooltip
}: Props = $props();
@@ -45,7 +47,7 @@
{#if isMobile}
{
@@ -54,7 +56,7 @@
}}
type="button"
>
- {@render iconComponent(triggerIcon, 'h-3 w-3')}
+ {@render iconComponent(triggerIcon, triggerIconClass)}
{#if triggerTooltip}
{triggerTooltip}
@@ -109,10 +111,10 @@
{#snippet child({ props })}
e.stopPropagation()}
>
- {@render iconComponent(triggerIcon, 'h-3 w-3')}
+ {@render iconComponent(triggerIcon, triggerIconClass)}
{#if triggerTooltip}
{triggerTooltip}
diff --git a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte
index f36d5a2dbf79..fc3ea7ae4808 100644
--- a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte
+++ b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte
@@ -8,6 +8,8 @@
DialogDiscoverModels,
DialogGroup,
DialogGroupPicker,
+ DialogProject,
+ DialogProjectPicker,
DialogSearch,
DialogServers,
DialogSettingsChat,
@@ -310,7 +312,11 @@
}
function selectConversation(id: string) {
- navigateBehind(() => goto(RouterService.chat(id)));
+ const conversation = conversationsStore.conversations.find((conv) => conv.id === id);
+
+ navigateBehind(() =>
+ goto(conversation ? RouterService.conversation(conversation) : RouterService.chat(id))
+ );
}
async function handleEditConversation(id: string) {
@@ -538,6 +544,10 @@
case SidebarAction.SEARCH:
openSearch();
+ break;
+ case SidebarAction.PROJECTS:
+ navigateBehind(() => goto(resolve(ROUTES.PROJECTS)));
+
break;
case SidebarAction.MANAGE_MODELS:
openDialog(() => uiStore.openModelsManager());
@@ -801,6 +811,10 @@
+
+
+
+
diff --git a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelte b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelte
index a59aaddb827f..87426e532097 100644
--- a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelte
+++ b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelte
@@ -17,11 +17,17 @@
Trash2,
Unlink
} from '@lucide/svelte';
- import { ContextMenuActions, DropdownMenuActions } from '#lib/components/app/index.ts';
+ import {
+ ContextMenuActions,
+ DropdownMenuActions,
+ ProjectPrefix,
+ ProjectSubmenu
+ } from '#lib/components/app/index.ts';
import { TruncatedText } from '#lib/components/app/index.ts';
import {
FORK_TREE_DEPTH_PADDING,
ICON_CLASS_DEFAULT,
+ PROJECT_ICON,
ROW_LONG_PRESS_MS,
SHORTCUT_DELETE_CONVERSATION,
SHORTCUT_EDIT_CONVERSATION,
@@ -41,13 +47,15 @@
tabsStore,
uiStore
} from '#lib/stores/index.ts';
- import type { MenuAction } from '#lib/types/index.ts';
+ import type { MenuAction, Project } from '#lib/types/index.ts';
import { hapticTap } from '#lib/utils/index.ts';
import { onMount, tick } from 'svelte';
interface Props {
isActive?: boolean;
depth?: number;
+ /** Optional trailing text, e.g. when the chat was last touched. */
+ meta?: string;
conversation: DatabaseConversation;
isSelectionMode?: boolean;
isSelected?: boolean;
@@ -59,6 +67,10 @@
onEnterSelectionMode?: (id: string) => void;
onSelectionClick?: (id: string, options: { shiftKey: boolean }) => void;
onRowMouseDown?: (id: string, event: MouseEvent) => void;
+ /** Project shown before the title, where the list does not group the chat under it. */
+ project?: Project;
+ /** Row density: `lg` is the roomier list outside the sidebar. */
+ size?: 'default' | 'lg';
}
let {
@@ -67,6 +79,7 @@
isActive = false,
isSelected = false,
isSelectionMode = false,
+ meta,
onDelete,
onEdit,
onEnterSelectionMode,
@@ -74,9 +87,13 @@
onSelect,
onSelectionClick,
onStop,
- onToggleSelect
+ onToggleSelect,
+ project,
+ size = 'default'
}: Props = $props();
+ const isLarge = $derived(size === 'lg');
+
let renderActionsDropdown = $state(false);
let dropdownOpen = $state(false);
let contextMenuOpen = $state(false);
@@ -142,6 +159,9 @@
function setGroup(groupId: string | null) {
void conversationsStore.setConversationGroup(conversation.id, groupId);
+
+ // a chat shows under its project: moved to a group, it leaves the project
+ if (groupId && conversation.projectId) setProject(null);
}
// a group the chat points at may be gone; then it is in none
@@ -175,6 +195,38 @@
: [])
]);
+ function setProject(projectId: string | null) {
+ void conversationsStore.setConversationProject(conversation.id, projectId);
+ }
+
+ // a phone has no flyouts: the same entry opens the project picker there
+ function handlePickProject(event: Event) {
+ event.stopPropagation();
+ uiStore.openProjectPicker({ currentProjectId: conversation.projectId, onSelect: setProject });
+ }
+
+ // a chat in a project can move to another one or leave it, a loose chat can join one
+ let projectActions = $derived([
+ {
+ icon: PROJECT_ICON,
+ label: conversation.projectId ? 'Change project' : 'Add to project',
+ onclick: handlePickProject,
+ submenu: projectSubmenu
+ },
+ ...(conversation.projectId
+ ? [
+ {
+ icon: Unlink,
+ label: 'Remove from project',
+ onclick: (event: Event) => {
+ event.stopPropagation();
+ setProject(null);
+ }
+ }
+ ]
+ : [])
+ ]);
+
// the "more actions" dropdown and the right-click menu offer the same actions; the
// shortcuts act on the active conversation, so only its row shows them
let actions = $derived([
@@ -206,6 +258,7 @@
shortcut: isActive ? SHORTCUT_EDIT_CONVERSATION : undefined
},
...groupActions,
+ ...projectActions,
{
icon: Download,
label: 'Export',
@@ -215,11 +268,15 @@
},
shortcut: isActive ? SHORTCUT_EXPORT_CONVERSATION : undefined
},
- {
- icon: ListChecks,
- label: 'Select',
- onclick: handleEnterSelectionMode
- },
+ ...(onEnterSelectionMode
+ ? [
+ {
+ icon: ListChecks,
+ label: 'Select',
+ onclick: handleEnterSelectionMode
+ }
+ ]
+ : []),
{
icon: Trash2,
label: 'Delete',
@@ -321,7 +378,10 @@
bind:this={rowElement}
style:--row-hold-ms="{ROW_LONG_PRESS_MS}ms"
class={[
- 'group flex min-h-9 w-full cursor-pointer items-center justify-between space-x-3 rounded-lg px-2 py-1.5 text-left select-none [-webkit-touch-callout:none] transition-[background-color,color,scale] hover:bg-foreground/10 hover:text-foreground max-md:min-h-12 max-md:rounded-2xl max-md:px-3.5 max-md:py-3 md:min-h-8 md:py-1',
+ 'group flex w-full cursor-pointer items-center justify-between space-x-3 rounded-lg text-left select-none [-webkit-touch-callout:none] transition-[background-color,color,scale] hover:bg-foreground/10 hover:text-foreground',
+ isLarge
+ ? 'min-h-11 px-3 py-2'
+ : 'min-h-9 px-2 py-1.5 max-md:min-h-12 max-md:rounded-2xl max-md:px-3.5 max-md:py-3 md:min-h-8 md:py-1',
isLanding && 'invisible',
isActive ? 'selected-row-surface text-accent-foreground' : 'text-foreground/75',
contextMenuOpen && 'bg-foreground/10',
@@ -388,7 +448,7 @@
class="flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground"
href={RouterService.chat(conversation.forkedFromConversationId)}
>
-
+
{/snippet}
@@ -410,9 +470,15 @@
role="button"
tabindex="0"
>
-
-
-
+
+
+
@@ -422,11 +488,24 @@
{/if}
-
+
+
+ {#if project}
+
+ {/if}
+
+
+
+
+ {#if meta}
+
+ {meta}
+
+ {/if}
{#if !isSelectionMode && renderActionsDropdown}
@@ -454,6 +533,16 @@
/>
{/snippet}
+{#snippet projectSubmenu({ close, kind }: { close: () => void; kind: MenuKind })}
+
+{/snippet}
+