fix(stores): align RPC methods with OpenClaw protocol and fix chat flow

- Fix channels store: use channels.status instead of channels.list
- Fix skills store: use skills.status instead of skills.list
- Fix chat store: correct chat.history response parsing (messages in payload)
- Fix chat store: handle chat.send async flow (ack + event streaming)
- Add chat event handling for streaming AI responses (delta/final/error)
- Wire gateway:chat-message IPC events to chat store
- Fix health check: use WebSocket status instead of nonexistent /health endpoint
- Fix waitForReady: probe via WebSocket instead of HTTP
- Gracefully degrade when methods are unsupported (no white screen)
This commit is contained in:
Haze
2026-02-06 02:38:18 +08:00
Unverified
parent 0f8e6f3f9e
commit b01952fba7
5 changed files with 186 additions and 48 deletions

View File

@@ -58,7 +58,17 @@ export const useGatewayStore = create<GatewayState>((set, get) => ({
// Listen for notifications
window.electron.ipcRenderer.on('gateway:notification', (notification) => {
console.log('Gateway notification:', notification);
// Could dispatch to other stores based on notification type
});
// Listen for chat events from the gateway and forward to chat store
window.electron.ipcRenderer.on('gateway:chat-message', (data) => {
const { useChatStore } = require('./chat');
const chatData = data as { message?: Record<string, unknown> } | Record<string, unknown>;
// The event payload may be nested under 'message' or directly on data
const event = ('message' in chatData && typeof chatData.message === 'object')
? chatData.message as Record<string, unknown>
: chatData as Record<string, unknown>;
useChatStore.getState().handleChatEvent(event);
});
} catch (error) {