test: cover task detail live timeline updates
This commit is contained in:
@ -117,6 +117,11 @@ function appendEvent(collection: ProcessEvent[], event: ProcessEvent): ProcessEv
|
||||
return [...collection, event];
|
||||
}
|
||||
|
||||
function hasTaskMetadata(item: { metadata?: Record<string, unknown> }): boolean {
|
||||
const taskId = item.metadata?.task_id;
|
||||
return typeof taskId === 'string' && taskId.trim().length > 0;
|
||||
}
|
||||
|
||||
function createEventId(event: ProcessWsEvent): string {
|
||||
if (event.type === 'process_cancel_ack') {
|
||||
return `${event.type}:${event.run_id}`;
|
||||
@ -393,7 +398,11 @@ export const useChatStore = create<ChatStore>((set, get) => ({
|
||||
const incomingArtifacts = projection.artifacts || [];
|
||||
const incomingRunIds = new Set(incomingRuns.map((run) => run.run_id));
|
||||
const nextRuns = [
|
||||
...state.processRuns.filter((run) => run.session_id !== sessionId && !incomingRunIds.has(run.run_id)),
|
||||
...state.processRuns.filter((run) => {
|
||||
if (incomingRunIds.has(run.run_id)) return false;
|
||||
if (run.session_id !== sessionId) return true;
|
||||
return hasTaskMetadata(run);
|
||||
}),
|
||||
...incomingRuns,
|
||||
];
|
||||
const liveRunIds = new Set(nextRuns.map((run) => run.run_id));
|
||||
|
||||
Reference in New Issue
Block a user