diff --git a/frontend/src/lib/components/chat/ChatWindow.svelte b/frontend/src/lib/components/chat/ChatWindow.svelte index f68a28a..d92f814 100644 --- a/frontend/src/lib/components/chat/ChatWindow.svelte +++ b/frontend/src/lib/components/chat/ChatWindow.svelte @@ -43,6 +43,7 @@ * - mode: 'new' for new chat page, 'conversation' for existing conversations * - onFirstMessage: callback for when first message is sent in 'new' mode * - conversation: conversation metadata when in 'conversation' mode + * - initialMessage: auto-send this message when conversation loads (for new project chats) */ interface Props { mode?: 'new' | 'conversation'; @@ -50,13 +51,16 @@ conversation?: Conversation | null; /** Bindable prop for thinking mode - synced with parent in 'new' mode */ thinkingEnabled?: boolean; + /** Initial message to auto-send when conversation loads */ + initialMessage?: string | null; } let { mode = 'new', onFirstMessage, conversation, - thinkingEnabled = $bindable(true) + thinkingEnabled = $bindable(true), + initialMessage = null }: Props = $props(); // Local state for abort controller @@ -127,6 +131,26 @@ } }); + // Track if initial message has been sent to prevent re-sending + let initialMessageSent = $state(false); + + // Auto-send initial message when conversation is ready + $effect(() => { + if ( + mode === 'conversation' && + initialMessage && + !initialMessageSent && + chatState.conversationId === conversation?.id && + !chatState.isStreaming + ) { + initialMessageSent = true; + // Small delay to ensure UI is ready + setTimeout(() => { + handleSendMessage(initialMessage); + }, 100); + } + }); + /** * Check if knowledge base has any documents */ diff --git a/frontend/src/lib/components/layout/ProjectFolder.svelte b/frontend/src/lib/components/layout/ProjectFolder.svelte index 343f6cb..f2eac89 100644 --- a/frontend/src/lib/components/layout/ProjectFolder.svelte +++ b/frontend/src/lib/components/layout/ProjectFolder.svelte @@ -7,6 +7,7 @@ import type { Conversation } from '$lib/types/conversation.js'; import { projectsState, chatState } from '$lib/stores'; import ConversationItem from './ConversationItem.svelte'; + import { goto } from '$app/navigation'; interface Props { project: Project; @@ -26,6 +27,13 @@ await projectsState.toggleCollapse(project.id); } + /** Navigate to project page */ + function handleOpenProject(e: MouseEvent) { + e.preventDefault(); + e.stopPropagation(); + goto(`/projects/${project.id}`); + } + /** Handle project settings click */ function handleSettings(e: MouseEvent) { e.preventDefault(); @@ -35,42 +43,53 @@
{project.description}
+ {/if} +No chats match your search
+ {:else} +No chats in this project yet
+Start a new chat above to get started
+ {/if} ++ {conversation.summary} +
+ {/if} ++ {#if isUploading} + Uploading files... + {:else} + Drag & drop files here, or + + {/if} +
++ Text files, code, markdown, JSON, etc. +
+No files in this project
+{doc.name}
++ {formatSize(doc.size)} +
+No reference links
+Add links in project settings
+ +{link.title}
+ {#if link.description} +{link.description}
+ {/if} +{link.url}
+Loading project...
+