fix: only keep aborted messages if they have sufficient parts (#2651)
This commit is contained in:
parent
733b21e22b
commit
ff6a93f355
1 changed files with 13 additions and 3 deletions
|
|
@ -281,9 +281,19 @@ export namespace SessionPrompt {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
...MessageV2.toModelMessage(
|
...MessageV2.toModelMessage(
|
||||||
msgs.filter(
|
msgs.filter((m) => {
|
||||||
(m) => !(m.info.role === "assistant" && m.info.error && !MessageV2.AbortedError.isInstance(m.info.error)),
|
if (m.info.role !== "assistant" || m.info.error === undefined) {
|
||||||
),
|
return true
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
MessageV2.AbortedError.isInstance(m.info.error) &&
|
||||||
|
m.parts.some((part) => part.type !== "step-start" && part.type !== "reasoning")
|
||||||
|
) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
tools: model.info.tool_call === false ? undefined : tools,
|
tools: model.info.tool_call === false ? undefined : tools,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue