Commit Graph

29 Commits

Author SHA1 Message Date
Haze
12d7c8ade0 fix(chat): refine tool phase detection and clean stale reply from graph cache
- hasCompletedToolPhase now checks that the last assistant message in the
  segment has no tool_use blocks, preventing false positives during
  intermediate tool rounds that would suppress the trailing thinking indicator
- Filter reply text from cached graph steps when a completed run falls
  back to the step cache, preventing the final response from appearing
  inside the graph when expanding after completion
- Remove debug logging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 17:09:20 +08:00
Haze
74f6dd0236 fix(chat): exclude tool-result user messages from run segmentation
Gateway history contains `role: 'user'` messages that are actually
tool-result wrappers (Anthropic API format). These were incorrectly
treated as run boundaries in nextUserMessageIndexes, causing:
- isLatestOpenRun=false during tool execution → graph collapses
- Run split into multiple segments → incorrect step attribution

Add isRealUserMessage() that detects tool-result wrappers by checking
if all content blocks are type 'tool_result', and use it in both
nextUserMessageIndexes computation and userRunCards filtering.

Also remove debug logging from previous iterations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 17:00:00 +08:00
Haze
f8c6643b38 fix(chat): prevent graph collapse during streaming and strip thinking from reply bubble
- Prevent execution graph from auto-collapsing while reply is still
  streaming by excluding from autoCollapsedRunKeys and keeping
  expanded=true via controlled prop
- Strip thinking blocks from the streaming ChatMessage when the reply
  renders as a separate bubble, so thinking content doesn't duplicate
  alongside the response text

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 15:52:26 +08:00
Haze
7fa4852c1d fix(chat): separate response and thinking messages (#878)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: paisley <8197966+su8su@users.noreply.github.com>
2026-04-20 15:22:09 +08:00
Haze
1b2dccee6e refactor(chat): execution graph optimize (#873)
Co-authored-by: Haze <hazeone@users.noreply.github.com>
2026-04-19 19:36:33 +08:00
Lingxuan Zuo
25b13ab912 Refine chat tool status dedupe (#786)
Co-authored-by: zuolingxuan <zuolingxuan@bytedance.com>
2026-04-08 15:05:27 +08:00
Lingxuan Zuo
c866205eac Add execution graph to chat history (#776) 2026-04-07 01:37:06 +08:00
DigHuang
c0a3903377 feat(scroll): implement instant scroll-to-bottom behavior for chat messages (#438) 2026-03-12 17:02:43 +08:00
Haze
945c3b39b4 feat(i18n): update chat localization strings to enhance user experience and clarity (#424) 2026-03-11 23:17:46 +08:00
Haze
95e090ecb5 feat(agents): support chat to agent (#403) 2026-03-11 12:03:30 +08:00
DigHuang
ce0e5fd8af fix(history): query chat session and history in sidebar (#400) 2026-03-11 10:27:54 +08:00
DigHuang
9502d9b1c5 style: refine chat UI consistency and enhance dark mode (#393) 2026-03-10 18:09:46 +08:00
DigHuang
905ce02b0b feat(ui): refactor style ui & add Models page with provider settings (#379) 2026-03-10 11:39:56 +08:00
DigHuang
76df84e68c fix: ghost session cleanup, new chat switching, and markdown overflow handling (#287) 2026-03-04 18:54:47 +08:00
Mao Mr
bf62639573 fix(chat): show loading when run from console and when sending in app (#228) 2026-02-28 17:09:00 +08:00
Haze
96bd37d1b1 fix(macos): chat history loading slow problem (#212)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Haze <hazeone@users.noreply.github.com>
2026-02-28 00:01:44 +08:00
Haze
6383e10d63 feat(chat): reformat streaming output (#173) 2026-02-25 23:59:55 +08:00
Felix
fcba8b86d5 fix(chat): improve message handling, fix type errors and migrate changes to enhance branch (#50) 2026-02-11 17:10:53 +08:00
paisley
6e09a69f4f feat(app): i18n (#48) 2026-02-11 15:34:53 +08:00
Felix
f9581d2516 fix(chat): improve handling of streaming messages and add pending state management (#46) 2026-02-11 13:55:34 +08:00
Felix
816a0e24a2 misc: chat stop button and tool typing indicator and prevent sending message during composition (#37) 2026-02-10 19:12:22 +08:00
DigHuang
05b5874832 feat(style): refactor layout, remove Header & Improve gateway readiness checks (#12) 2026-02-09 17:00:27 +08:00
Haze
de445ae3d5 Chore/build npm (#9)
Co-authored-by: DigHuang <114602213+DigHuang@users.noreply.github.com>
Co-authored-by: Felix <24791380+vcfgv@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 15:10:08 +08:00
Haze
94a6cecf2f fix(chat): move toolbar to Header and add New Session button
- Move ChatToolbar (session selector, refresh, thinking toggle) from
  the Chat page body into the Header component, so controls appear
  at the same level as the "Chat" title
- Add New Session button (+) to create a fresh conversation
- Add newSession action to chat store
- Header conditionally renders ChatToolbar only on /chat route
- Chat page fills full content area without duplicate toolbar
2026-02-06 04:57:25 +08:00
Haze
3468d1bdf4 feat(chat): native React chat page with session selector and streaming
Replace the iframe-based Control UI embed with a native React
implementation that communicates directly with the Gateway via
gateway:rpc IPC calls and chat event streaming.

New components:
- ChatToolbar: session selector dropdown, refresh button, thinking toggle
- ChatMessage: message bubbles with markdown (react-markdown + GFM),
  collapsible thinking blocks, tool use cards, image attachments
- ChatInput: textarea with Enter to send, Shift+Enter for new line
- message-utils: extractText/extractThinking/extractImages/extractToolUse
  ported from OpenClaw's message-extract.ts

Rewritten chat store with:
- Session management (sessions.list, switchSession)
- Proper chat.history loading with raw message preservation
- chat.send with idempotencyKey and run tracking
- Streaming via handleChatEvent (delta/final/error/aborted)
- Thinking toggle (show/hide reasoning blocks)
2026-02-06 04:49:01 +08:00
Haze
542178c1e7 fix(chat): switch from webview to iframe for Control UI embedding
The <webview> tag had issues with event listener attachment and React
ref handling, causing the loading overlay to stay forever (white screen).
Switched to a standard <iframe> which is simpler and works reliably:
- Uses iframe onLoad/onError instead of webview dom-ready events
- Added 5s fallback timeout to dismiss loading overlay
- The X-Frame-Options/CSP header overrides from session.webRequest
  allow the iframe to load the Control UI
2026-02-06 03:21:43 +08:00
Haze
284861a0f5 feat(chat): write API keys to OpenClaw and embed Control UI for chat
Part 1: API Key Integration
- Create electron/utils/openclaw-auth.ts to write keys to
  ~/.openclaw/agents/main/agent/auth-profiles.json
- Update provider:save and provider:setApiKey IPC handlers to
  persist keys to OpenClaw auth-profiles alongside ClawX storage
- Save API key to OpenClaw on successful validation in Setup wizard
- Pass provider API keys as environment variables when starting
  the Gateway process (ANTHROPIC_API_KEY, OPENROUTER_API_KEY, etc.)

Part 2: Embed OpenClaw Control UI for Chat
- Replace custom Chat UI with <webview> embedding the Gateway's
  built-in Control UI at http://127.0.0.1:{port}/?token={token}
- Add gateway:getControlUiUrl IPC handler to provide tokenized URL
- Enable webviewTag in Electron BrowserWindow preferences
- Override X-Frame-Options/CSP headers to allow webview embedding
- Suppress noisy control-ui token_mismatch stderr messages
- Add loading/error states for the embedded webview

This fixes the "No API key found for provider" error and replaces
the buggy custom chat implementation with OpenClaw's battle-tested
Control UI.
2026-02-06 03:12:17 +08:00
Haze
727869f2b8 feat(chat): enhance chat interface with markdown support
- Add markdown rendering with react-markdown and remark-gfm
- Create ChatMessage component with code copy functionality
- Add typing indicator animation during AI response
- Create welcome screen for new users
- Add Textarea component for multi-line input
- Improve message styling with avatars and hover actions
- Add Gateway connection status awareness
- Add prose styling for markdown content
2026-02-05 23:43:02 +08:00
Haze
b8ab0208d0 feat(core): initialize project skeleton with Electron + React + TypeScript
Set up the complete project foundation for ClawX, a graphical AI assistant:

- Electron main process with IPC handlers, menu, tray, and gateway management
- React renderer with routing, layout components, and page scaffolding
- Zustand state management for gateway, settings, channels, skills, chat, and cron
- shadcn/ui components with Tailwind CSS and CSS variable theming
- Build tooling with Vite, electron-builder, and TypeScript configuration
- Testing setup with Vitest and Playwright
- Development configurations (ESLint, Prettier, gitignore, env example)
2026-02-05 23:09:17 +08:00