fix(chat): recover active requests and preserve finish order
This commit is contained in:
@@ -1618,7 +1618,7 @@ export function useTKMindChat(
|
||||
if (
|
||||
activeSessionId &&
|
||||
err instanceof ApiError &&
|
||||
shouldKeepStreamingAfterRunError(err.status)
|
||||
shouldKeepStreamingAfterRunError(err.status, err.message, err.code)
|
||||
) {
|
||||
subscribeToSession(activeSessionId);
|
||||
setChatState('streaming');
|
||||
@@ -1626,6 +1626,23 @@ export function useTKMindChat(
|
||||
scheduleReplyRecoverySync(activeSessionId, submitToken);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
activeSessionId &&
|
||||
shouldKeepStreamingAfterRunError(
|
||||
undefined,
|
||||
err instanceof Error ? err.message : String(err),
|
||||
err instanceof ApiError ? err.code : '',
|
||||
)
|
||||
) {
|
||||
// Goose may report its session concurrency guard as a failed run
|
||||
// message instead of an HTTP 409. Reattach to the session stream
|
||||
// and reconcile the snapshot; do not strand the composer in error.
|
||||
subscribeToSession(activeSessionId);
|
||||
setChatState('streaming');
|
||||
setError(null);
|
||||
scheduleReplyRecoverySync(activeSessionId, submitToken);
|
||||
return;
|
||||
}
|
||||
if (session && activeSessionId) setSessions((prev) => touchSession(prev, activeSessionId!, -1));
|
||||
if (err instanceof ApiError && err.status === 402) {
|
||||
notifyInsufficientBalance();
|
||||
|
||||
Reference in New Issue
Block a user