From bc24b580264107afbf5844e29a80de8e2f7ab131 Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Tue, 10 Feb 2026 22:34:59 +0800 Subject: [PATCH] feat(desktop): wire Try It step to real agent chat Replace fake sample prompts with real agent interaction. Clicking a prompt sends it via localChat and shows the live ChatView on the right panel with streaming responses. Co-Authored-By: Claude Opus 4.6 --- .../renderer/src/pages/onboarding/try-it.tsx | 90 ++++++++++++++----- 1 file changed, 69 insertions(+), 21 deletions(-) diff --git a/apps/desktop/src/renderer/src/pages/onboarding/try-it.tsx b/apps/desktop/src/renderer/src/pages/onboarding/try-it.tsx index da01ddf8..90e3108d 100644 --- a/apps/desktop/src/renderer/src/pages/onboarding/try-it.tsx +++ b/apps/desktop/src/renderer/src/pages/onboarding/try-it.tsx @@ -1,28 +1,46 @@ import { useNavigate } from 'react-router-dom' import { Button } from '@multica/ui/components/ui/button' +import { Loading } from '@multica/ui/components/ui/loading' +import { ChatView } from '@multica/ui/components/chat-view' import { HugeiconsIcon } from '@hugeicons/react' import { ArrowLeft02Icon } from '@hugeicons/core-free-icons' import { SamplePrompt } from '../../components/onboarding/sample-prompt' import { useOnboardingStore } from '../../stores/onboarding' +import { useLocalChat } from '../../hooks/use-local-chat' const samplePrompts = [ { - title: 'Summarize a webpage', - prompt: 'Summarize the key points from this article for me', + title: 'Say hello', + prompt: 'Say hello and briefly introduce yourself in 2-3 sentences.', }, { - title: 'Write a script', - prompt: 'Write a Python script that converts CSV files to JSON', + title: 'Write a haiku', + prompt: 'Write a haiku about coding.', }, { - title: 'Explain code', - prompt: 'Explain how React hooks work with a simple example', + title: 'Quick math', + prompt: "What's 123 × 456? Show your reasoning.", }, ] export default function TryItStep() { const navigate = useNavigate() const { completeOnboarding } = useOnboardingStore() + const { + agentId, + initError, + messages, + streamingIds, + isLoading, + isLoadingHistory, + isLoadingMore, + hasMore, + error, + pendingApprovals, + sendMessage, + loadMore, + resolveApproval, + } = useLocalChat() const handleComplete = () => { completeOnboarding() @@ -33,9 +51,11 @@ export default function TryItStep() { navigate('/onboarding/connect') } + const hasMessages = messages.length > 0 + return (
- {/* Left column — main content, centered both axes */} + {/* Left column — prompts */}
@@ -62,7 +82,7 @@ export default function TryItStep() { key={sp.title} title={sp.title} prompt={sp.prompt} - onClick={handleComplete} + onClick={() => sendMessage(sp.prompt)} /> ))}
@@ -75,16 +95,44 @@ export default function TryItStep() {
- {/* Right column — visual */} -
-
-

-

Now, experience the magic

-

- Chat with your agent, automate tasks, run shell commands - with approval, and connect to Telegram or Discord channels. -

-
+ {/* Right column — live chat */} +
+ {initError ? ( +
+ {initError} +
+ ) : !agentId ? ( +
+ + Initializing agent... +
+ ) : !hasMessages && !isLoading ? ( +
+
+

Agent ready

+

+ Click a prompt on the left to start a conversation, or type + your own message below. +

+
+
+ ) : null} + + {agentId && (hasMessages || isLoading) && ( + + )}
)