diff options
| author | Adam Malczewski <[email protected]> | 2026-05-19 19:40:21 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-05-19 19:40:21 +0900 |
| commit | f78a91c20f658dd404277919a0b872b352c99bb6 (patch) | |
| tree | 58cfffb655da4443f4b7a39543b86f988f15239f /packages/frontend/src/lib/components/ChatPanel.svelte | |
| download | dispatch-f78a91c20f658dd404277919a0b872b352c99bb6.tar.gz dispatch-f78a91c20f658dd404277919a0b872b352c99bb6.zip | |
- Bun monorepo with @dispatch/core, @dispatch/api, @dispatch/frontend
- Agent runtime with Vercel AI SDK, streaming via WebSocket
- Tools: read_file, write_file, list_files (scoped to working directory)
- Hono API server with POST /chat, GET /status, GET /health, WS /ws
- Svelte 5 + DaisyUI frontend with chat UI, theme switcher, copy button
- OpenCode Go (Zen) as LLM provider, deepseek-v4-flash-free model
- Docker setup (dev + prod) with bin/ scripts and gopass secrets
- Biome v2 linting/formatting, Vitest tests (44 passing)
- Debug info attached to error messages for diagnostics
Diffstat (limited to 'packages/frontend/src/lib/components/ChatPanel.svelte')
| -rw-r--r-- | packages/frontend/src/lib/components/ChatPanel.svelte | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/packages/frontend/src/lib/components/ChatPanel.svelte b/packages/frontend/src/lib/components/ChatPanel.svelte new file mode 100644 index 0000000..44efb0b --- /dev/null +++ b/packages/frontend/src/lib/components/ChatPanel.svelte @@ -0,0 +1,58 @@ +<script lang="ts"> +import { chatStore } from "../chat.svelte.js"; +import { wsClient } from "../ws.svelte.js"; +import ChatMessageComponent from "./ChatMessage.svelte"; + +let messagesEl: HTMLDivElement | undefined; + +const statusColor = $derived( + wsClient.connectionStatus === "connected" + ? "bg-success" + : wsClient.connectionStatus === "connecting" + ? "bg-warning" + : "bg-error", +); + +$effect(() => { + // Trigger on messages change to scroll + void chatStore.messages; + if (messagesEl) { + messagesEl.scrollTop = messagesEl.scrollHeight; + } +}); +</script> + +<div class="flex flex-col h-full"> + <!-- Status bar --> + <div class="flex items-center gap-3 px-4 py-2 bg-base-200 border-b border-base-300 text-xs"> + <span class="flex items-center gap-1.5"> + <span class="w-2 h-2 rounded-full {statusColor}"></span> + <span class="capitalize text-base-content/70">{wsClient.connectionStatus}</span> + </span> + <span class="text-base-content/50">|</span> + <span class="text-base-content/70"> + Agent: + <span + class="font-semibold {chatStore.agentStatus === 'running' + ? 'text-warning' + : chatStore.agentStatus === 'error' + ? 'text-error' + : 'text-success'}" + > + {chatStore.agentStatus === "running" ? "running..." : chatStore.agentStatus} + </span> + </span> + </div> + + <!-- Messages --> + <div bind:this={messagesEl} class="flex-1 overflow-y-auto p-4"> + {#if chatStore.messages.length === 0} + <div class="flex items-center justify-center h-full text-base-content/40 text-sm"> + Send a message to start a conversation + </div> + {/if} + {#each chatStore.messages as message (message.id)} + <ChatMessageComponent {message} /> + {/each} + </div> +</div> |
