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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user