feat: update message handling to use 'finish' property for step completion logic
This commit is contained in:
@@ -590,7 +590,7 @@ export const debugUtils = {
|
||||
|
||||
const lastMessage = assistantMessages[assistantMessages.length - 1];
|
||||
const stepFinishParts = lastMessage.parts.filter((p: any) => p.type === 'step-finish');
|
||||
const hasStopReason = lastMessage.parts.some((p: any) => p.type === 'step-finish' && p.reason === 'stop');
|
||||
const hasStopReason = (lastMessage.info as { finish?: string }).finish === 'stop';
|
||||
|
||||
const timeInfo = lastMessage.info.time as any;
|
||||
const completedAt = timeInfo?.completed;
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface MessageInfo {
|
||||
};
|
||||
status?: string;
|
||||
streaming?: boolean;
|
||||
finish?: string;
|
||||
}
|
||||
|
||||
export interface MessageRecord {
|
||||
@@ -27,9 +28,7 @@ export function isMessageComplete(messageInfo: MessageInfo, parts: Part[] = []):
|
||||
const completedAt = typeof timeInfo?.completed === 'number' ? timeInfo.completed : undefined;
|
||||
const messageStatus = messageInfo?.status;
|
||||
|
||||
const hasStopFinish = parts.some(part =>
|
||||
part.type === 'step-finish' && (part as any).reason === 'stop'
|
||||
);
|
||||
const hasStopFinish = messageInfo.finish === 'stop';
|
||||
|
||||
const hasCompletedFlag = (typeof completedAt === 'number' && completedAt > 0) || messageStatus === 'completed';
|
||||
if (!hasCompletedFlag || !hasStopFinish) {
|
||||
|
||||
Reference in New Issue
Block a user