feat(h5): show rotating loading tips during agent-run execution

Surface backend loading_tip SSE events in chat UI with shared tip pool
and styles for long-running TKMind 智趣 tasks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-27 09:33:50 +08:00
parent 8f91c52c67
commit 8bdb6e2442
9 changed files with 191 additions and 9 deletions
+26
View File
@@ -1573,10 +1573,22 @@ type SubscribeOptions = {
onBalance?: (update: BalanceUpdate) => void;
};
export type AgentRunStreamEvent = {
eventId?: string;
eventType: string;
data: unknown;
createdAt?: string;
};
type SubscribeAgentRunEventsOptions = {
onRunEvent?: (event: AgentRunStreamEvent) => void;
};
export function subscribeAgentRunEvents(
runId: string,
onRun: (run: AgentRun) => void,
onError: (error: Error) => void,
options: SubscribeAgentRunEventsOptions = {},
): () => void {
let closed = false;
let activeController: AbortController | null = null;
@@ -1634,6 +1646,20 @@ export function subscribeAgentRunEvents(
const payload = JSON.parse(data) as { message?: string };
throw new Error(payload.message || '后台任务失败');
}
if (eventName === 'run_event') {
const payload = JSON.parse(data) as {
eventId?: string;
eventType?: string;
data?: unknown;
createdAt?: string;
};
options.onRunEvent?.({
eventId: payload.eventId,
eventType: String(payload.eventType ?? ''),
data: payload.data,
createdAt: payload.createdAt,
});
}
}
}
} catch (err) {