Skip to content

Commit e227811

Browse files
Merge pull request #1390 from digma-ai/feature/incident-creation
Add incident manual creation chat
1 parent b2026ef commit e227811

File tree

28 files changed

+699
-239
lines changed

28 files changed

+699
-239
lines changed

package-lock.json

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "digma-ui",
3-
"version": "15.2.0-alpha.0",
3+
"version": "15.2.0-alpha.1",
44
"description": "Digma UI",
55
"scripts": {
66
"lint:eslint": "eslint --cache .",
@@ -120,6 +120,7 @@
120120
"dependencies": {
121121
"@floating-ui/react": "^0.25.1",
122122
"@formkit/auto-animate": "^0.8.2",
123+
"@microsoft/fetch-event-source": "^2.0.1",
123124
"@react-oauth/google": "^0.12.1",
124125
"@reduxjs/toolkit": "^2.5.0",
125126
"@tanstack/react-table": "^8.7.8",

src/components/Agentic/IncidentDetails/Chat/index.tsx

Lines changed: 0 additions & 158 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { useParams } from "react-router";
2+
import { useStableSearchParams } from "../../../../hooks/useStableSearchParams";
3+
import {
4+
useGetIncidentAgentChatEventsQuery,
5+
useSendMessageToIncidentAgentChatMutation
6+
} from "../../../../redux/services/digma";
7+
import { AgentChat } from "../../common/AgentChat";
8+
9+
const REFRESH_INTERVAL = 10 * 1000; // in milliseconds
10+
const REFRESH_INTERVAL_DURING_STREAMING = 3 * 1000; // in milliseconds
11+
12+
export const IncidentAgentChat = () => {
13+
const params = useParams();
14+
const incidentId = params.id;
15+
const [searchParams] = useStableSearchParams();
16+
const agentId = searchParams.get("agent");
17+
18+
const [sendMessage, { isLoading: isMessageSending }] =
19+
useSendMessageToIncidentAgentChatMutation();
20+
21+
const handleMessageSend = (text: string) => {
22+
void sendMessage({
23+
incidentId: incidentId ?? "",
24+
agentId: agentId ?? "",
25+
data: { text }
26+
});
27+
};
28+
29+
const { data, isLoading } = useGetIncidentAgentChatEventsQuery(
30+
{
31+
incidentId: incidentId ?? "",
32+
agentId: agentId ?? ""
33+
},
34+
{
35+
skip: !incidentId || !agentId,
36+
pollingInterval: isMessageSending
37+
? REFRESH_INTERVAL_DURING_STREAMING
38+
: REFRESH_INTERVAL
39+
}
40+
);
41+
42+
return (
43+
<AgentChat
44+
data={data}
45+
isDataLoading={isLoading}
46+
incidentId={incidentId}
47+
agentId={agentId ?? ""}
48+
onMessageSend={handleMessageSend}
49+
isMessageSending={isMessageSending}
50+
/>
51+
);
52+
};

src/components/Agentic/IncidentDetails/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { trackingEvents } from "../tracking";
1818
import { AdditionalInfo } from "./AdditionalInfo";
1919
import { AgentEvents } from "./AgentEvents";
2020
import { AgentFlowChart } from "./AgentFlowChart";
21-
import { Chat } from "./Chat";
21+
import { IncidentAgentChat } from "./IncidentAgentChat";
2222
import { IncidentMetaData } from "./IncidentMetaData";
2323
import * as s from "./styles";
2424
import type { AgentViewMode } from "./types";
@@ -185,7 +185,7 @@ export const IncidentDetails = () => {
185185
</s.SummaryContainerToolbar>
186186
{agentId ? (
187187
agentViewMode === "chat" ? (
188-
<Chat key={agentId} />
188+
<IncidentAgentChat key={agentId} />
189189
) : (
190190
<AgentEvents key={agentId} />
191191
)

src/components/Agentic/IncidentTemplate/AddMCPServerDialog/index.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { useState } from "react";
22
import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent";
3-
import { CrossIcon } from "../../../common/icons/12px/CrossIcon";
3+
import { Dialog } from "../../common/Dialog";
44
import { trackingEvents } from "../../tracking";
55
import { ServerStep } from "./ServerStep";
6-
import * as s from "./styles";
76
import { ToolsStep } from "./ToolsStep";
87
import type { AddMCPServerDialogProps } from "./types";
98

@@ -45,24 +44,16 @@ export const AddMCPServerDialog = ({
4544
/>
4645
];
4746

48-
const handleCloseButtonClick = () => {
47+
const handleDialogClose = () => {
4948
sendUserActionTrackingEvent(
50-
trackingEvents.INCIDENT_TEMPLATE_ADD_MCP_DIALOG_CLOSE_BUTTON_CLICKED
49+
trackingEvents.INCIDENT_TEMPLATE_ADD_MCP_DIALOG_CLOSED
5150
);
5251
onClose();
5352
};
5453

5554
return (
56-
<s.Container>
57-
<s.Header>
58-
<s.Header>
59-
Wizard
60-
<s.CloseButton onClick={handleCloseButtonClick}>
61-
<CrossIcon color={"currentColor"} />
62-
</s.CloseButton>
63-
</s.Header>
64-
</s.Header>
55+
<Dialog title={"Wizard"} onClose={handleDialogClose}>
6556
{steps[currentStep]}
66-
</s.Container>
57+
</Dialog>
6758
);
6859
};

0 commit comments

Comments
 (0)