fix(ui): stabilize workplace chat scrolling
This commit is contained in:
@@ -7,30 +7,39 @@ function compact(value: unknown): string {
|
||||
.slice(0, 96)
|
||||
}
|
||||
|
||||
export function progressEntryKey(entry: ProgressEntry, fallbackIndex = 0): string {
|
||||
export function progressEntryKey(entry: ProgressEntry): string {
|
||||
const stableId = entry.itemId || entry.streamId || entry.toolCallId || entry.permissionGroupKey
|
||||
if (stableId) {
|
||||
return `${entry.type}:${compact(entry.turnId)}:${compact(stableId)}`
|
||||
}
|
||||
|
||||
if (entry.type === 'thinking') {
|
||||
return `thinking:${compact(entry.turnId) || compact(entry.executionMode) || compact(entry.summary) || 'stream'}:${fallbackIndex}`
|
||||
if (entry.type === 'thinking' || entry.type === 'assistant') {
|
||||
return `${entry.type}:${compact(entry.turnId) || compact(entry.executionMode) || 'stream'}:${
|
||||
Number.isFinite(entry.timestamp) ? entry.timestamp : ''
|
||||
}`
|
||||
}
|
||||
|
||||
if (entry.type === 'tool_call' && entry.turnId) {
|
||||
return `tool:${compact(entry.turnId)}:${compact(entry.summary) || 'tool'}:${fallbackIndex}`
|
||||
if (entry.type === 'tool_call') {
|
||||
return `tool:${compact(entry.turnId) || 'turnless'}:${compact(entry.summary) || 'tool'}:${
|
||||
Number.isFinite(entry.timestamp) ? entry.timestamp : ''
|
||||
}`
|
||||
}
|
||||
|
||||
if (entry.turnId && typeof entry.seq === 'number') {
|
||||
return `${entry.type}:${compact(entry.turnId)}:seq:${entry.seq}`
|
||||
}
|
||||
|
||||
return [
|
||||
const fallbackParts: Array<string | number> = [
|
||||
entry.type,
|
||||
compact(entry.turnId),
|
||||
]
|
||||
if (typeof entry.seq === 'number' && Number.isFinite(entry.seq)) {
|
||||
fallbackParts.push(`seq-${entry.seq}`)
|
||||
}
|
||||
fallbackParts.push(
|
||||
Number.isFinite(entry.timestamp) ? entry.timestamp : '',
|
||||
compact(entry.summary),
|
||||
compact(entry.detail),
|
||||
fallbackIndex,
|
||||
].join(':')
|
||||
)
|
||||
return fallbackParts.join(':')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user