mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(copilot): persist transient error markers and case-insensitive detection
- Append COPILOT_ERROR_PREFIX marker to session before yielding StreamError so the error card survives page refresh. - Make frontend transient error detection case-insensitive.
This commit is contained in:
@@ -1055,13 +1055,19 @@ async def stream_chat_completion_sdk(
|
||||
exc_info=True,
|
||||
)
|
||||
ended_with_stream_error = True
|
||||
|
||||
display = (
|
||||
FRIENDLY_TRANSIENT_MSG
|
||||
if is_transient
|
||||
else f"SDK stream error: {stream_err}"
|
||||
)
|
||||
session.messages.append(
|
||||
ChatMessage(
|
||||
role="assistant",
|
||||
content=f"{COPILOT_ERROR_PREFIX} {display}",
|
||||
)
|
||||
)
|
||||
yield StreamError(
|
||||
errorText=(
|
||||
FRIENDLY_TRANSIENT_MSG
|
||||
if is_transient
|
||||
else f"SDK stream error: {stream_err}"
|
||||
),
|
||||
errorText=display,
|
||||
code=(
|
||||
"transient_api_error"
|
||||
if is_transient
|
||||
@@ -1112,6 +1118,12 @@ async def stream_chat_completion_sdk(
|
||||
log_prefix,
|
||||
)
|
||||
ended_with_stream_error = True
|
||||
session.messages.append(
|
||||
ChatMessage(
|
||||
role="assistant",
|
||||
content=f"{COPILOT_ERROR_PREFIX} {FRIENDLY_TRANSIENT_MSG}",
|
||||
)
|
||||
)
|
||||
yield StreamError(
|
||||
errorText=FRIENDLY_TRANSIENT_MSG,
|
||||
code="transient_api_error",
|
||||
|
||||
@@ -104,7 +104,9 @@ export function MessagePartRenderer({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const isTransient = markerText.includes(TRANSIENT_ERROR_TEXT);
|
||||
const isTransient = markerText
|
||||
.toLowerCase()
|
||||
.includes(TRANSIENT_ERROR_TEXT.toLowerCase());
|
||||
return (
|
||||
<ErrorCard
|
||||
key={key}
|
||||
|
||||
Reference in New Issue
Block a user