diff --git a/ui/apps/chat/src/app.css b/ui/apps/chat/src/app.css
index 4c7fd90160a3..b5393ec5cfcc 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 {
@@ -295,11 +303,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 2d368fd80bac..503c09875447 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
@@ -9,7 +9,8 @@
ChatFormCurrentWorkingDirectory,
ChatFormInput,
ChatFormInputFileInputInvisible,
- ChatFormPickers
+ ChatFormPickers,
+ ChatFormProjectChip
} from '#lib/components/app/index.ts';
import {
CHAT_FORM_SINGLE_ROW_MAX_TEXT_PX,
@@ -35,6 +36,7 @@
conversationsStore,
deviceStore,
modelsStore,
+ projectsStore,
serverStore,
settingsStore,
toolsStore,
@@ -139,6 +141,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
@@ -806,7 +816,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 77d10bd9e0ae..8bf18a6646af 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, Image, MessageSquare, Mic, Plus, Video } 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,
@@ -15,6 +15,7 @@
import { getChatFormActionsContext } from '#lib/contexts/index.ts';
import { AttachmentAction, AttachmentItemEnabledWhen } from '#lib/enums/index.ts';
import { useAttachmentMenu } from '#lib/hooks/use-attachment-menu.svelte.ts';
+ import { conversationsStore, projectsStore } from '#lib/stores/index.ts';
interface Props {
class?: string;
@@ -131,6 +132,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 cb6e8264de2d..923fc0024fa9 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 c37b0447fd29..7e0e0e4c036d 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
@@ -235,7 +235,8 @@
--assistant-min-height-offset: calc(
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, 3rem) + var(--chat-tabs-offset, 0px)
+ var(--assistant-margin-top, 3rem) + var(--chat-tabs-offset, 0px) +
+ var(--chat-header-height, 0px)
);
min-height: calc(100dvh - var(--assistant-min-height-offset));
@@ -243,7 +244,8 @@
--assistant-min-height-offset: calc(
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, 3rem) + var(--chat-tabs-offset, 0px)
+ var(--assistant-margin-top, 3rem) + var(--chat-tabs-offset, 0px) +
+ 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 959016a26538..515dca042fa9 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 128d20a0a845..97c74861c62e 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
@@ -24,8 +24,7 @@
CHAT_FORM_MOVE_OUT_MS,
CHAT_FORM_MOVE_SHIFT_PX,
CHAT_FORM_MOVE_TO_BOTTOM_IN_MS,
- CHAT_FORM_MOVE_TO_BOTTOM_OUT_MS,
- ROUTES
+ CHAT_FORM_MOVE_TO_BOTTOM_OUT_MS
} from '#lib/constants/index.ts';
import { useChatScreenActiveModel } from '#lib/hooks/use-chat-screen-active-model.svelte.ts';
import { useChatScreenDragAndDrop } from '#lib/hooks/use-chat-screen-drag-and-drop.svelte.ts';
@@ -44,12 +43,25 @@
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 { 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();
let emptyFileNames = $state([]);
+ let headerHeight = $state(0);
let showDeleteDialog = $state(false);
let showEmptyFileDialog = $state(false);
let isEmpty = $derived(
@@ -291,6 +303,7 @@
0 ? `${headerHeight}px` : undefined}
class="chat-screen flex 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}
@@ -320,7 +333,31 @@
{/if}
- {#if !isEmpty}
+ {#if header}
+
+
+
+ {@render header()}
+
+
+ {/if}
+
+ {#if panels}
+
+
+ {@render intro?.()}
+
+ {@render panels()}
+
+ {@render overview?.()}
+
+ {:else if overview}
+
+ {@render overview()}
+
+ {:else if !isEmpty}
- {#if stick.farFromBottom && page.url.hash.includes(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 c4a68a2dbfc8..bf9a4d586a06 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 10a0e63ca17d..63f1491ffdd1 100644
--- a/ui/apps/chat/src/lib/components/app/chat/index.ts
+++ b/ui/apps/chat/src/lib/components/app/chat/index.ts
@@ -259,6 +259,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.
@@ -476,6 +484,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
@@ -595,11 +609,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 bf502fc36784..b2c382ef0ac9 100644
--- a/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte
+++ b/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte
@@ -6,12 +6,13 @@
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';
import { extensions, type NavigationItem } from '#lib/extensions/index.ts';
import { RouterService } from '#lib/services/router.service.ts';
- import { conversationsStore, deviceStore } from '#lib/stores/index.ts';
+ import { conversationsStore, deviceStore, projectsStore, uiStore } from '#lib/stores/index.ts';
import { formatRelativeTime, isIMEComposing, sidebarFooterItems } from '#lib/utils/index.ts';
import { goto } from '$app/navigation';
import type { Component } from 'svelte';
@@ -62,13 +63,33 @@
.filter((conversation) => matches(conversation.name))
.sort((a, b) => b.lastModified - a.lastModified)
.slice(0, limit)
- .map((conversation) => ({
- icon: MessageSquare,
- id: `chat-${conversation.id}`,
- label: conversation.name,
- meta: formatRelativeTime(conversation.lastModified),
- pinned: conversation.pinned,
- run: () => close(() => goto(RouterService.chat(conversation.id)))
+ .map((conversation) => {
+ 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: project ? `${project.name} · ${time}` : time,
+ pinned: conversation.pinned,
+ run: () => close(() => goto(RouterService.conversation(conversation)))
+ };
+ })
+ );
+
+ 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 }))
}))
);
@@ -99,6 +120,7 @@
const sections = $derived(
[
{ entries: chatEntries, title: needle ? 'Chats' : 'Recents' },
+ { entries: projectEntries, title: 'Projects' },
{ entries: actionEntries, title: 'Actions' }
].filter((section) => section.entries.length > 0)
);
diff --git a/ui/apps/chat/src/lib/components/app/index.ts b/ui/apps/chat/src/lib/components/app/index.ts
index a1ea03a74b8d..302f0a2f06ad 100644
--- a/ui/apps/chat/src/lib/components/app/index.ts
+++ b/ui/apps/chat/src/lib/components/app/index.ts
@@ -9,3 +9,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 4ec52452d96c..2630c15d709f 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 d920274352c3..0f7ba7e964bc 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
@@ -7,6 +7,8 @@
DialogDiscoverModels,
DialogGroup,
DialogGroupPicker,
+ DialogProject,
+ DialogProjectPicker,
DialogSearch,
DialogSettingsChat,
Logo,
@@ -307,7 +309,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) {
@@ -535,6 +541,10 @@
case SidebarAction.SEARCH:
openSearch();
+ break;
+ case SidebarAction.PROJECTS:
+ navigateBehind(() => goto(ROUTES.PROJECTS));
+
break;
case SidebarAction.MANAGE_MODELS:
openDialog(() => uiStore.openModelsManager());
@@ -793,6 +803,10 @@
+
+
+
+