feat: add message input with send button and keyboard shortcuts

- MessageInput component with textarea, send button, Enter-to-send
- Shift+Enter for newline, auto-resize textarea
- Disabled state while streaming, auto-focus after send
- Integrated into /chat page with user message handling

Closes #6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shahondin1624
2026-03-12 11:27:34 +01:00
parent a8d28095b3
commit 306d0a7f2d
4 changed files with 94 additions and 0 deletions

View File

@@ -1,8 +1,20 @@
<script lang="ts">
import type { ChatMessage } from '$lib/types';
import MessageList from '$lib/components/MessageList.svelte';
import MessageInput from '$lib/components/MessageInput.svelte';
let messages: ChatMessage[] = $state([]);
let isStreaming = $state(false);
function handleSend(content: string) {
const userMessage: ChatMessage = {
id: crypto.randomUUID(),
role: 'user',
content,
timestamp: new Date()
};
messages.push(userMessage);
}
</script>
<div class="flex h-screen flex-col">
@@ -11,4 +23,5 @@
</header>
<MessageList {messages} />
<MessageInput onSend={handleSend} disabled={isStreaming} />
</div>