mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 22:53:48 +00:00
Hardened background work against disconnected circuits (#937)
This commit is contained in:
1 parent
99089f853e
commit
f03c2d1c88
44 files changed
+500
-126
No files matched your search
@@ -245,7 +245,13 @@ public partial class ContentBlockComponent : MSGComponentBase
|
||||
if (string.Equals(this.lastMathRenderSignature, mathRenderSignature, StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
await this.JsRuntime.InvokeVoidAsync(CHAT_MATH_SYNC_FUNCTION, this.mathContentContainer, mathRenderSignature);
|
||||
//
|
||||
// Remember what the browser shows only when it really got the call: otherwise, a call which was
|
||||
// lost while the connection was down would make us skip the math rendering after the reconnect.
|
||||
//
|
||||
if (!await this.JsRuntime.TryInvokeVoidAsync(this.CircuitState, CHAT_MATH_SYNC_FUNCTION, this.mathContentContainer, mathRenderSignature))
|
||||
return;
|
||||
|
||||
this.lastMathRenderSignature = mathRenderSignature;
|
||||
this.hasActiveMathContainer = true;
|
||||
}
|
||||
@@ -258,16 +264,7 @@ public partial class ContentBlockComponent : MSGComponentBase
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await this.JsRuntime.InvokeVoidAsync(CHAT_MATH_DISPOSE_FUNCTION, this.mathContentContainer);
|
||||
}
|
||||
catch (JSDisconnectedException)
|
||||
{
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
}
|
||||
await this.JsRuntime.TryInvokeVoidAsync(this.CircuitState, CHAT_MATH_DISPOSE_FUNCTION, this.mathContentContainer);
|
||||
|
||||
this.hasActiveMathContainer = false;
|
||||
this.lastMathRenderSignature = string.Empty;
|
||||
|
||||
Reference in new issue
Block a user