refactor(ui): rename message time.completed to time.end
Update all references from info.time.completed to info.time.end to align with SDK schema changes. Affects message status tracking and rendering.
This commit is contained in:
@@ -151,7 +151,8 @@ export default function MessageItem(props: MessageItemProps) {
|
||||
}
|
||||
|
||||
const info = props.messageInfo
|
||||
return Boolean(info && info.role === "assistant" && info.time.completed !== undefined && info.time.completed === 0)
|
||||
const timeInfo = info?.time as { created: number; end?: number } | undefined
|
||||
return Boolean(info && info.role === "assistant" && (timeInfo?.end === undefined || timeInfo?.end === 0))
|
||||
}
|
||||
|
||||
const handleRevert = () => {
|
||||
|
||||
@@ -77,9 +77,9 @@ export function upsertMessageInfoV2(instanceId: string, info: MessageInfo | null
|
||||
return
|
||||
}
|
||||
const store = messageStoreBus.getOrCreate(instanceId)
|
||||
const timeInfo = (info.time ?? {}) as { created?: number; completed?: number }
|
||||
const timeInfo = (info.time ?? {}) as { created?: number; end?: number }
|
||||
const createdAt = typeof timeInfo.created === "number" ? timeInfo.created : Date.now()
|
||||
const completedAt = typeof timeInfo.completed === "number" ? timeInfo.completed : undefined
|
||||
const endAt = typeof timeInfo.end === "number" ? timeInfo.end : undefined
|
||||
|
||||
store.upsertMessage({
|
||||
id: info.id,
|
||||
@@ -87,7 +87,7 @@ export function upsertMessageInfoV2(instanceId: string, info: MessageInfo | null
|
||||
role: info.role === "user" ? "user" : "assistant",
|
||||
status: options?.status ?? "complete",
|
||||
createdAt,
|
||||
updatedAt: completedAt ?? createdAt,
|
||||
updatedAt: endAt ?? createdAt,
|
||||
bumpRevision: Boolean(options?.bumpRevision),
|
||||
})
|
||||
store.setMessageInfo(info.id, info)
|
||||
|
||||
@@ -300,10 +300,10 @@ function handleMessageUpdate(instanceId: string, event: MessageUpdateEvent | Mes
|
||||
const messageId = typeof info.id === "string" ? info.id : undefined
|
||||
if (!sessionId || !messageId) return
|
||||
|
||||
const timeInfo = (info.time ?? {}) as { created?: number; updated?: number; completed?: number }
|
||||
const timeInfo = (info.time ?? {}) as { created?: number; updated?: number; end?: number }
|
||||
const nextUpdated =
|
||||
typeof timeInfo.completed === "number" && timeInfo.completed > 0
|
||||
? timeInfo.completed
|
||||
typeof timeInfo.end === "number" && timeInfo.end > 0
|
||||
? timeInfo.end
|
||||
: typeof timeInfo.updated === "number" && timeInfo.updated > 0
|
||||
? timeInfo.updated
|
||||
: typeof timeInfo.created === "number" && timeInfo.created > 0
|
||||
@@ -333,14 +333,14 @@ function handleMessageUpdate(instanceId: string, event: MessageUpdateEvent | Mes
|
||||
|
||||
if (!record) {
|
||||
const createdAt = info.time?.created ?? Date.now()
|
||||
const completedAt = (info.time as { completed?: number } | undefined)?.completed
|
||||
const endAt = (info.time as { end?: number } | undefined)?.end
|
||||
store.upsertMessage({
|
||||
id: messageId,
|
||||
sessionId,
|
||||
role,
|
||||
status,
|
||||
createdAt,
|
||||
updatedAt: completedAt ?? createdAt,
|
||||
updatedAt: endAt ?? createdAt,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user