Skip to content

Commit 6b60590

Browse files
Merge pull request #1411 from digma-ai/fix/sse-keep-alive
Keep SSE connection alive in background and do not retry on error
1 parent 9592112 commit 6b60590

File tree

2 files changed

+16
-10
lines changed
  • src/components/Agentic

2 files changed

+16
-10
lines changed

src/components/Agentic/IncidentDirectives/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export const IncidentDirectives = () => {
157157
text,
158158
ids: selectedConditions
159159
}),
160+
openWhenHidden: true,
160161
onopen: (response: Response) => {
161162
if (response.ok) {
162163
setConversationId(
@@ -186,13 +187,15 @@ export const IncidentDirectives = () => {
186187
onerror: (err: unknown) => {
187188
abortControllerRef.current = null;
188189
setIsStartMessageSending(false);
190+
let errorMessage = "Unknown error starting directives chat";
189191
if (err instanceof Error) {
190-
// eslint-disable-next-line no-console
191-
console.error("Error starting directives chat:", err);
192-
} else {
193-
// eslint-disable-next-line no-console
194-
console.error("Unknown error starting directives chat");
192+
errorMessage = err.message;
195193
}
194+
195+
// eslint-disable-next-line no-console
196+
console.error(errorMessage);
197+
198+
throw new Error(errorMessage); // Rethrow the error to avoid retrying
196199
},
197200
onclose: () => {
198201
abortControllerRef.current = null;

src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const CreateIncidentChatOverlay = () => {
9191
body: JSON.stringify({
9292
text
9393
}),
94+
openWhenHidden: true,
9495
onopen: (response: Response) => {
9596
if (response.ok) {
9697
setIncidentId(
@@ -138,13 +139,15 @@ export const CreateIncidentChatOverlay = () => {
138139
onerror: (err: unknown) => {
139140
abortControllerRef.current = null;
140141
setIsStartMessageSending(false);
142+
let errorMessage = "Unknown error starting incident creation chat";
141143
if (err instanceof Error) {
142-
// eslint-disable-next-line no-console
143-
console.error("Error starting incident creation chat:", err);
144-
} else {
145-
// eslint-disable-next-line no-console
146-
console.error("Unknown error starting incident creation chat");
144+
errorMessage = err.message;
147145
}
146+
147+
// eslint-disable-next-line no-console
148+
console.error(errorMessage);
149+
150+
throw new Error(errorMessage); // Rethrow the error to avoid retrying
148151
},
149152
onclose: () => {
150153
abortControllerRef.current = null;

0 commit comments

Comments
 (0)