@truedat/ai 8.7.0 → 8.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/components/ConceptSuggestions.js +10 -4
- package/src/components/StructureSuggestions.js +8 -9
- package/src/components/ThinkingOutLoud.js +5 -0
- package/src/components/TranslationModal.js +15 -15
- package/src/components/__tests__/ConceptSuggestions.spec.js +32 -20
- package/src/components/__tests__/StructureSuggestions.spec.js +25 -19
- package/src/components/__tests__/SuggestLinkButton.spec.js +3 -1
- package/src/components/__tests__/TranslationModal.spec.js +3 -3
- package/src/components/actions/ActionActions.js +2 -2
- package/src/components/actions/ActionDetail.js +1 -1
- package/src/components/actions/ActionEdit.js +2 -1
- package/src/components/actions/ActionForm.js +1 -1
- package/src/components/actions/ActionsContext.js +1 -1
- package/src/components/actions/ActionsTable.js +1 -1
- package/src/components/actions/__tests__/ActionsTable.spec.js +1 -1
- package/src/components/aiSandbox/AiSandbox.js +2 -2
- package/src/components/aiSandbox/RequestForm.js +1 -1
- package/src/components/assistant/Assistant.js +8 -6
- package/src/components/assistant/AssistantChat.js +4 -0
- package/src/components/assistant/AssistantConversations.js +1 -1
- package/src/components/assistant/AssistantPage.js +5 -5
- package/src/components/assistant/AssistantPageChat.js +31 -14
- package/src/components/assistant/__tests__/Assistant.spec.js +3 -3
- package/src/components/assistant/__tests__/AssistantChat.spec.js +15 -11
- package/src/components/assistant/__tests__/AssistantConversations.spec.js +12 -12
- package/src/components/assistant/hooks/useAgentConversation.js +2 -2
- package/src/components/assistant/hooks/useAssistantSocket.js +2 -0
- package/src/components/index.js +8 -1
- package/src/components/prompts/PromptEditor.js +7 -7
- package/src/components/prompts/Prompts.js +1 -1
- package/src/components/prompts/__tests__/PromptEditor.spec.js +8 -8
- package/src/components/providers/ProviderEditor.js +6 -10
- package/src/components/providers/Providers.js +5 -1
- package/src/components/providers/__tests__/ProviderEditor.spec.js +7 -7
- package/src/components/providers/providerProperties/Anthropic.js +1 -1
- package/src/components/providers/providerProperties/AzureOpenai.js +2 -2
- package/src/components/providers/providerProperties/BedrockClaude.js +2 -2
- package/src/components/providers/providerProperties/Gemini.js +1 -1
- package/src/components/providers/providerProperties/Openai.js +2 -2
- package/src/components/resourceMappings/ResourceMappingEditor.js +2 -2
- package/src/components/resourceMappings/ResourceMappingFields.js +1 -1
- package/src/components/resourceMappings/__tests__/ResourceMappingEditor.spec.js +7 -7
- package/src/components/resourceMappings/__tests__/ResourceMappings.spec.js +1 -1
- package/src/components/resourceMappings/selectors/DataStructureSelector.js +2 -2
- package/src/components/suggestions/__tests__/SuggestionsWidget.spec.js +9 -9
- package/src/hooks/__tests__/useAgentConversations.spec.js +10 -2
- package/src/hooks/useActions.js +1 -1
- package/src/hooks/useAgentConversations.js +4 -1
- package/src/hooks/useAgentLayerRun.js +1 -1
- package/src/hooks/useProviders.js +1 -1
- package/src/hooks/useResourceMappings.js +1 -1
- package/src/hooks/useSuggestions.js +1 -1
- package/src/hooks/useTranslations.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/ai",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.1",
|
|
4
4
|
"description": "Truedat Web Artificial Intelligence package",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@testing-library/jest-dom": "^6.6.3",
|
|
51
51
|
"@testing-library/react": "^16.3.0",
|
|
52
52
|
"@testing-library/user-event": "^14.6.1",
|
|
53
|
-
"@truedat/test": "8.7.
|
|
53
|
+
"@truedat/test": "8.7.1",
|
|
54
54
|
"identity-obj-proxy": "^3.0.0",
|
|
55
55
|
"jest": "^29.7.0",
|
|
56
56
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
81
81
|
"swr": "^2.3.3"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "f7605a6ea3f78839b42bb7d8339eec125ba49acb"
|
|
84
84
|
}
|
|
@@ -4,9 +4,9 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
import { Icon, Loader, Message } from "semantic-ui-react";
|
|
6
6
|
import { ConceptSelectorTable } from "@truedat/bg/concepts/relations/components/ConceptSelector";
|
|
7
|
+
import { useAgentLayerRun } from "../hooks/useAgentLayerRun";
|
|
7
8
|
import useAssistantSocket from "./assistant/hooks/useAssistantSocket";
|
|
8
9
|
import ThinkingOutLoud from "./ThinkingOutLoud";
|
|
9
|
-
import { useAgentLayerRun } from "../hooks/useAgentLayerRun";
|
|
10
10
|
import {
|
|
11
11
|
reasonColumnDefinition,
|
|
12
12
|
similarityColumnDefinition,
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
|
|
15
15
|
const extraColumns = [similarityColumnDefinition, reasonColumnDefinition];
|
|
16
16
|
|
|
17
|
-
export const ConceptSuggestions = ({
|
|
17
|
+
export const ConceptSuggestions = ({
|
|
18
|
+
selectedConcept,
|
|
19
|
+
handleConceptSelected,
|
|
20
|
+
}) => {
|
|
18
21
|
const { id } = useParams();
|
|
19
22
|
const { state } = useLocation();
|
|
20
23
|
const prompt = state?.prompt;
|
|
@@ -44,11 +47,14 @@ export const ConceptSuggestions = ({ selectedConcept, handleConceptSelected }) =
|
|
|
44
47
|
|
|
45
48
|
if (event === "stream" && Number(priority) === 0) {
|
|
46
49
|
const content = payload?.content;
|
|
50
|
+
// eslint-disable-next-line fp/no-let
|
|
47
51
|
let parsed;
|
|
48
52
|
try {
|
|
49
53
|
const raw = typeof content === "string" ? JSON.parse(content) : content;
|
|
54
|
+
// eslint-disable-next-line fp/no-mutation
|
|
50
55
|
parsed = Array.isArray(raw) ? raw : (raw?.result ?? []);
|
|
51
56
|
} catch {
|
|
57
|
+
// eslint-disable-next-line fp/no-mutation
|
|
52
58
|
parsed = [];
|
|
53
59
|
}
|
|
54
60
|
setConcepts(parsed);
|
|
@@ -66,13 +72,13 @@ export const ConceptSuggestions = ({ selectedConcept, handleConceptSelected }) =
|
|
|
66
72
|
? (() => {
|
|
67
73
|
const log = payload?.content;
|
|
68
74
|
return log && typeof log === "object"
|
|
69
|
-
? log.message ?? log.level ?? JSON.stringify(log)
|
|
75
|
+
? (log.message ?? log.level ?? JSON.stringify(log))
|
|
70
76
|
: String(log ?? "");
|
|
71
77
|
})()
|
|
72
78
|
: (() => {
|
|
73
79
|
const err = payload?.error;
|
|
74
80
|
return err && typeof err === "object"
|
|
75
|
-
? err.message ?? err.reason ?? JSON.stringify(err)
|
|
81
|
+
? (err.message ?? err.reason ?? JSON.stringify(err))
|
|
76
82
|
: String(err ?? "");
|
|
77
83
|
})();
|
|
78
84
|
|
|
@@ -6,9 +6,9 @@ import { FormattedMessage } from "react-intl";
|
|
|
6
6
|
import { Icon, Loader, Message } from "semantic-ui-react";
|
|
7
7
|
import { defaultColumnsForStructureSelector } from "@truedat/dd/selectors";
|
|
8
8
|
import StructuresSearchResults from "@truedat/dd/components/StructuresSearchResults";
|
|
9
|
+
import { useAgentLayerRun } from "../hooks/useAgentLayerRun";
|
|
9
10
|
import useAssistantSocket from "./assistant/hooks/useAssistantSocket";
|
|
10
11
|
import ThinkingOutLoud from "./ThinkingOutLoud";
|
|
11
|
-
import { useAgentLayerRun } from "../hooks/useAgentLayerRun";
|
|
12
12
|
import {
|
|
13
13
|
reasonColumnDefinition,
|
|
14
14
|
similarityColumnDefinition,
|
|
@@ -25,12 +25,8 @@ export const StructureSuggestions = ({
|
|
|
25
25
|
|
|
26
26
|
const baseColumns = useSelector(defaultColumnsForStructureSelector);
|
|
27
27
|
const columns = useMemo(
|
|
28
|
-
() => [
|
|
29
|
-
|
|
30
|
-
similarityColumnDefinition,
|
|
31
|
-
reasonColumnDefinition,
|
|
32
|
-
],
|
|
33
|
-
[baseColumns]
|
|
28
|
+
() => [...baseColumns, similarityColumnDefinition, reasonColumnDefinition],
|
|
29
|
+
[baseColumns],
|
|
34
30
|
);
|
|
35
31
|
|
|
36
32
|
const { trigger: fetchSuggestions, data: runData } = useAgentLayerRun();
|
|
@@ -58,11 +54,14 @@ export const StructureSuggestions = ({
|
|
|
58
54
|
|
|
59
55
|
if (event === "stream" && Number(priority) === 0) {
|
|
60
56
|
const content = payload?.content;
|
|
57
|
+
// eslint-disable-next-line fp/no-let
|
|
61
58
|
let parsed;
|
|
62
59
|
try {
|
|
63
60
|
const raw = typeof content === "string" ? JSON.parse(content) : content;
|
|
61
|
+
// eslint-disable-next-line fp/no-mutation
|
|
64
62
|
parsed = Array.isArray(raw) ? raw : (raw?.result ?? []);
|
|
65
63
|
} catch {
|
|
64
|
+
// eslint-disable-next-line fp/no-mutation
|
|
66
65
|
parsed = [];
|
|
67
66
|
}
|
|
68
67
|
setStructures(parsed);
|
|
@@ -80,13 +79,13 @@ export const StructureSuggestions = ({
|
|
|
80
79
|
? (() => {
|
|
81
80
|
const log = payload?.content;
|
|
82
81
|
return log && typeof log === "object"
|
|
83
|
-
? log.message ?? log.level ?? JSON.stringify(log)
|
|
82
|
+
? (log.message ?? log.level ?? JSON.stringify(log))
|
|
84
83
|
: String(log ?? "");
|
|
85
84
|
})()
|
|
86
85
|
: (() => {
|
|
87
86
|
const err = payload?.error;
|
|
88
87
|
return err && typeof err === "object"
|
|
89
|
-
? err.message ?? err.reason ?? JSON.stringify(err)
|
|
88
|
+
? (err.message ?? err.reason ?? JSON.stringify(err))
|
|
90
89
|
: String(err ?? "");
|
|
91
90
|
})();
|
|
92
91
|
|
|
@@ -21,12 +21,14 @@ export function getSourceLabel(source) {
|
|
|
21
21
|
*/
|
|
22
22
|
function buildSections(logItems) {
|
|
23
23
|
const sections = [];
|
|
24
|
+
// eslint-disable-next-line fp/no-let
|
|
24
25
|
let current = null;
|
|
25
26
|
logItems.forEach((item) => {
|
|
26
27
|
const p = item.priority ?? 1;
|
|
27
28
|
const isThinkingInlineError = item.eventType === "error" && Number(p) === 2;
|
|
28
29
|
if (isThinkingInlineError) {
|
|
29
30
|
if (!current) {
|
|
31
|
+
// eslint-disable-next-line fp/no-mutation
|
|
30
32
|
current = { source: null, label: "Processing", items: [] };
|
|
31
33
|
}
|
|
32
34
|
current.items.push({ ...item, level: 3 });
|
|
@@ -36,6 +38,7 @@ function buildSections(logItems) {
|
|
|
36
38
|
if (level === 1) {
|
|
37
39
|
if (!current || current.source !== item.source) {
|
|
38
40
|
if (current) sections.push(current);
|
|
41
|
+
// eslint-disable-next-line fp/no-mutation
|
|
39
42
|
current = {
|
|
40
43
|
source: item.source,
|
|
41
44
|
label: getSourceLabel(item.source),
|
|
@@ -45,6 +48,7 @@ function buildSections(logItems) {
|
|
|
45
48
|
current.items.push({ ...item, level: 1 });
|
|
46
49
|
} else {
|
|
47
50
|
if (!current) {
|
|
51
|
+
// eslint-disable-next-line fp/no-mutation
|
|
48
52
|
current = { source: null, label: "Processing", items: [] };
|
|
49
53
|
}
|
|
50
54
|
current.items.push({ ...item, level: 2 });
|
|
@@ -67,6 +71,7 @@ function ThinkingSection({ section, isLast, active, collapsed }) {
|
|
|
67
71
|
if (!open) return;
|
|
68
72
|
const el = bodyRef.current;
|
|
69
73
|
if (!el) return;
|
|
74
|
+
// eslint-disable-next-line fp/no-mutation
|
|
70
75
|
el.scrollTop = el.scrollHeight;
|
|
71
76
|
}, [open, section.items]);
|
|
72
77
|
|
|
@@ -57,9 +57,9 @@ const TranslationModal = ({
|
|
|
57
57
|
...field,
|
|
58
58
|
checked: true,
|
|
59
59
|
}
|
|
60
|
-
: null
|
|
60
|
+
: null,
|
|
61
61
|
),
|
|
62
|
-
_.filter(_.isObject)
|
|
62
|
+
_.filter(_.isObject),
|
|
63
63
|
)(group.fields);
|
|
64
64
|
|
|
65
65
|
return {
|
|
@@ -68,7 +68,7 @@ const TranslationModal = ({
|
|
|
68
68
|
checked: true,
|
|
69
69
|
};
|
|
70
70
|
}),
|
|
71
|
-
_.filter((group) => !_.isEmpty(group.fields))
|
|
71
|
+
_.filter((group) => !_.isEmpty(group.fields)),
|
|
72
72
|
)(template?.content);
|
|
73
73
|
settranslateTemplate(templateContent);
|
|
74
74
|
};
|
|
@@ -79,7 +79,7 @@ const TranslationModal = ({
|
|
|
79
79
|
...locale,
|
|
80
80
|
checked: !locale.is_default,
|
|
81
81
|
})),
|
|
82
|
-
_.keyBy("lang")
|
|
82
|
+
_.keyBy("lang"),
|
|
83
83
|
)(i18nContent);
|
|
84
84
|
setTranslateContent(locales);
|
|
85
85
|
};
|
|
@@ -164,7 +164,7 @@ const TranslationModal = ({
|
|
|
164
164
|
_.keyBy("name"),
|
|
165
165
|
_.mapValues(
|
|
166
166
|
({ name, default: defaultValue }) =>
|
|
167
|
-
defaultContent?.content[name]?.value || defaultValue?.value
|
|
167
|
+
defaultContent?.content[name]?.value || defaultValue?.value,
|
|
168
168
|
),
|
|
169
169
|
(values) =>
|
|
170
170
|
translateName
|
|
@@ -172,7 +172,7 @@ const TranslationModal = ({
|
|
|
172
172
|
...values,
|
|
173
173
|
name: defaultContent?.name,
|
|
174
174
|
}
|
|
175
|
-
: values
|
|
175
|
+
: values,
|
|
176
176
|
)(translateTemplate);
|
|
177
177
|
|
|
178
178
|
const payload = {
|
|
@@ -196,7 +196,7 @@ const TranslationModal = ({
|
|
|
196
196
|
return translateContent[lang];
|
|
197
197
|
}
|
|
198
198
|
}),
|
|
199
|
-
_.keyBy("lang")
|
|
199
|
+
_.keyBy("lang"),
|
|
200
200
|
)(translateContent);
|
|
201
201
|
setTranslateContent(translatedContent);
|
|
202
202
|
setTranslateResult("success");
|
|
@@ -211,7 +211,7 @@ const TranslationModal = ({
|
|
|
211
211
|
return translateContent[locale.lang].content
|
|
212
212
|
? _.flow(
|
|
213
213
|
_.mapValues((value) =>
|
|
214
|
-
value.value && value.origin ? value : { value, origin: "ai" }
|
|
214
|
+
value.value && value.origin ? value : { value, origin: "ai" },
|
|
215
215
|
),
|
|
216
216
|
(content) => ({
|
|
217
217
|
...i18nContent[locale.lang],
|
|
@@ -222,7 +222,7 @@ const TranslationModal = ({
|
|
|
222
222
|
...i18nContent[locale.lang].content,
|
|
223
223
|
...content,
|
|
224
224
|
},
|
|
225
|
-
})
|
|
225
|
+
}),
|
|
226
226
|
)(translateContent[locale.lang].content)
|
|
227
227
|
: locale;
|
|
228
228
|
})(i18nContent);
|
|
@@ -350,7 +350,7 @@ const TranslationModal = ({
|
|
|
350
350
|
/>
|
|
351
351
|
</dd>
|
|
352
352
|
</Fragment>
|
|
353
|
-
)
|
|
353
|
+
),
|
|
354
354
|
)(fields)}
|
|
355
355
|
</dl>
|
|
356
356
|
</Fragment>
|
|
@@ -446,7 +446,7 @@ const TranslationModal = ({
|
|
|
446
446
|
"*"
|
|
447
447
|
) : null}
|
|
448
448
|
</TableHeaderCell>
|
|
449
|
-
) : null
|
|
449
|
+
) : null,
|
|
450
450
|
)(translateContent)}
|
|
451
451
|
</TableRow>
|
|
452
452
|
</TableHeader>
|
|
@@ -462,7 +462,7 @@ const TranslationModal = ({
|
|
|
462
462
|
{_.map(({ lang, name, is_default, checked }) =>
|
|
463
463
|
is_default || checked ? (
|
|
464
464
|
<TableCell key={lang}>{name}</TableCell>
|
|
465
|
-
) : null
|
|
465
|
+
) : null,
|
|
466
466
|
)(translateContent)}
|
|
467
467
|
</TableRow>
|
|
468
468
|
) : null}
|
|
@@ -492,11 +492,11 @@ const TranslationModal = ({
|
|
|
492
492
|
widget={widget}
|
|
493
493
|
/>
|
|
494
494
|
</TableCell>
|
|
495
|
-
) : null
|
|
495
|
+
) : null,
|
|
496
496
|
)(translateContent)}
|
|
497
497
|
</TableRow>
|
|
498
|
-
) : null
|
|
499
|
-
)(fields)
|
|
498
|
+
) : null,
|
|
499
|
+
)(fields),
|
|
500
500
|
)(translateTemplate)}
|
|
501
501
|
</TableBody>
|
|
502
502
|
</Table>
|
|
@@ -50,14 +50,14 @@ describe("ConceptSuggestions", () => {
|
|
|
50
50
|
<ConceptSuggestions
|
|
51
51
|
selectedConcept={null}
|
|
52
52
|
handleConceptSelected={jest.fn()}
|
|
53
|
-
|
|
53
|
+
/>,
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
await waitFor(() =>
|
|
57
57
|
expect(mockFetchSuggestions).toHaveBeenCalledWith({
|
|
58
58
|
workflow: "suggest_structure_concept_links",
|
|
59
59
|
params: { structure_id: "42", prompt: "find concepts" },
|
|
60
|
-
})
|
|
60
|
+
}),
|
|
61
61
|
);
|
|
62
62
|
});
|
|
63
63
|
|
|
@@ -68,14 +68,14 @@ describe("ConceptSuggestions", () => {
|
|
|
68
68
|
<ConceptSuggestions
|
|
69
69
|
selectedConcept={null}
|
|
70
70
|
handleConceptSelected={jest.fn()}
|
|
71
|
-
|
|
71
|
+
/>,
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
await waitFor(() =>
|
|
75
75
|
expect(mockFetchSuggestions).toHaveBeenCalledWith({
|
|
76
76
|
workflow: "suggest_structure_concept_links",
|
|
77
77
|
params: { structure_id: "42", prompt: undefined },
|
|
78
|
-
})
|
|
78
|
+
}),
|
|
79
79
|
);
|
|
80
80
|
});
|
|
81
81
|
|
|
@@ -89,11 +89,15 @@ describe("ConceptSuggestions", () => {
|
|
|
89
89
|
<ConceptSuggestions
|
|
90
90
|
selectedConcept={null}
|
|
91
91
|
handleConceptSelected={jest.fn()}
|
|
92
|
-
|
|
92
|
+
/>,
|
|
93
93
|
);
|
|
94
94
|
|
|
95
|
-
expect(
|
|
96
|
-
|
|
95
|
+
expect(
|
|
96
|
+
rendered.queryByText(/mockthinkingoutloud/i),
|
|
97
|
+
).not.toBeInTheDocument();
|
|
98
|
+
expect(
|
|
99
|
+
rendered.queryByText(/mockconceptselectortable/i),
|
|
100
|
+
).not.toBeInTheDocument();
|
|
97
101
|
});
|
|
98
102
|
|
|
99
103
|
it("shows ThinkingOutLoud once log items arrive", async () => {
|
|
@@ -112,7 +116,7 @@ describe("ConceptSuggestions", () => {
|
|
|
112
116
|
<ConceptSuggestions
|
|
113
117
|
selectedConcept={null}
|
|
114
118
|
handleConceptSelected={jest.fn()}
|
|
115
|
-
|
|
119
|
+
/>,
|
|
116
120
|
);
|
|
117
121
|
|
|
118
122
|
act(() => {
|
|
@@ -124,7 +128,7 @@ describe("ConceptSuggestions", () => {
|
|
|
124
128
|
});
|
|
125
129
|
|
|
126
130
|
await waitFor(() =>
|
|
127
|
-
expect(rendered.queryByText(/mockthinkingoutloud/i)).toBeInTheDocument()
|
|
131
|
+
expect(rendered.queryByText(/mockthinkingoutloud/i)).toBeInTheDocument(),
|
|
128
132
|
);
|
|
129
133
|
});
|
|
130
134
|
|
|
@@ -133,12 +137,12 @@ describe("ConceptSuggestions", () => {
|
|
|
133
137
|
<ConceptSuggestions
|
|
134
138
|
selectedConcept={null}
|
|
135
139
|
handleConceptSelected={jest.fn()}
|
|
136
|
-
|
|
140
|
+
/>,
|
|
137
141
|
);
|
|
138
142
|
|
|
139
143
|
expect(useAssistantSocket).toHaveBeenCalledWith(
|
|
140
144
|
true,
|
|
141
|
-
expect.objectContaining({ conversationId: null })
|
|
145
|
+
expect.objectContaining({ conversationId: null }),
|
|
142
146
|
);
|
|
143
147
|
});
|
|
144
148
|
|
|
@@ -152,12 +156,12 @@ describe("ConceptSuggestions", () => {
|
|
|
152
156
|
<ConceptSuggestions
|
|
153
157
|
selectedConcept={null}
|
|
154
158
|
handleConceptSelected={jest.fn()}
|
|
155
|
-
|
|
159
|
+
/>,
|
|
156
160
|
);
|
|
157
161
|
|
|
158
162
|
expect(useAssistantSocket).toHaveBeenCalledWith(
|
|
159
163
|
false,
|
|
160
|
-
expect.objectContaining({ conversationId: "state-1" })
|
|
164
|
+
expect.objectContaining({ conversationId: "state-1" }),
|
|
161
165
|
);
|
|
162
166
|
});
|
|
163
167
|
|
|
@@ -178,7 +182,7 @@ describe("ConceptSuggestions", () => {
|
|
|
178
182
|
<ConceptSuggestions
|
|
179
183
|
selectedConcept={null}
|
|
180
184
|
handleConceptSelected={jest.fn()}
|
|
181
|
-
|
|
185
|
+
/>,
|
|
182
186
|
);
|
|
183
187
|
|
|
184
188
|
act(() => {
|
|
@@ -189,10 +193,14 @@ describe("ConceptSuggestions", () => {
|
|
|
189
193
|
});
|
|
190
194
|
|
|
191
195
|
await waitFor(() =>
|
|
192
|
-
expect(
|
|
196
|
+
expect(
|
|
197
|
+
rendered.queryByText(/mockconceptselectortable/i),
|
|
198
|
+
).toBeInTheDocument(),
|
|
193
199
|
);
|
|
194
200
|
|
|
195
|
-
expect(
|
|
201
|
+
expect(
|
|
202
|
+
rendered.queryByText(/mockthinkingoutloud/i),
|
|
203
|
+
).not.toBeInTheDocument();
|
|
196
204
|
|
|
197
205
|
const props = ConceptSelectorTable.mock.calls.at(-1)[0];
|
|
198
206
|
expect(props.concepts).toEqual(concepts);
|
|
@@ -214,7 +222,7 @@ describe("ConceptSuggestions", () => {
|
|
|
214
222
|
<ConceptSuggestions
|
|
215
223
|
selectedConcept={null}
|
|
216
224
|
handleConceptSelected={jest.fn()}
|
|
217
|
-
|
|
225
|
+
/>,
|
|
218
226
|
);
|
|
219
227
|
|
|
220
228
|
act(() => {
|
|
@@ -225,10 +233,14 @@ describe("ConceptSuggestions", () => {
|
|
|
225
233
|
});
|
|
226
234
|
|
|
227
235
|
await waitFor(() =>
|
|
228
|
-
expect(
|
|
236
|
+
expect(
|
|
237
|
+
rendered.queryByText(/mockthinkingoutloud/i),
|
|
238
|
+
).not.toBeInTheDocument(),
|
|
229
239
|
);
|
|
230
240
|
|
|
231
|
-
expect(
|
|
241
|
+
expect(
|
|
242
|
+
rendered.queryByText(/mockconceptselectortable/i),
|
|
243
|
+
).not.toBeInTheDocument();
|
|
232
244
|
});
|
|
233
245
|
|
|
234
246
|
it("adds log events to ThinkingOutLoud items", async () => {
|
|
@@ -247,7 +259,7 @@ describe("ConceptSuggestions", () => {
|
|
|
247
259
|
<ConceptSuggestions
|
|
248
260
|
selectedConcept={null}
|
|
249
261
|
handleConceptSelected={jest.fn()}
|
|
250
|
-
|
|
262
|
+
/>,
|
|
251
263
|
);
|
|
252
264
|
|
|
253
265
|
act(() => {
|
|
@@ -24,7 +24,7 @@ jest.mock("@truedat/dd/selectors", () => ({
|
|
|
24
24
|
}));
|
|
25
25
|
|
|
26
26
|
jest.mock("@truedat/dd/components/StructuresSearchResults", () =>
|
|
27
|
-
jest.fn(() => <div>MockSearchResults</div>)
|
|
27
|
+
jest.fn(() => <div>MockSearchResults</div>),
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
jest.mock("../ThinkingOutLoud", () => ({
|
|
@@ -63,14 +63,14 @@ describe("StructureSuggestions", () => {
|
|
|
63
63
|
selectedStructure={null}
|
|
64
64
|
handleSelectedStructure={jest.fn()}
|
|
65
65
|
selectable={true}
|
|
66
|
-
|
|
66
|
+
/>,
|
|
67
67
|
);
|
|
68
68
|
|
|
69
69
|
await waitFor(() =>
|
|
70
70
|
expect(mockFetchSuggestions).toHaveBeenCalledWith({
|
|
71
71
|
workflow: "suggest_business_concept_structures_links",
|
|
72
72
|
params: { business_concept_id: "123", prompt: "find structures" },
|
|
73
|
-
})
|
|
73
|
+
}),
|
|
74
74
|
);
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -82,14 +82,14 @@ describe("StructureSuggestions", () => {
|
|
|
82
82
|
selectedStructure={null}
|
|
83
83
|
handleSelectedStructure={jest.fn()}
|
|
84
84
|
selectable={true}
|
|
85
|
-
|
|
85
|
+
/>,
|
|
86
86
|
);
|
|
87
87
|
|
|
88
88
|
await waitFor(() =>
|
|
89
89
|
expect(mockFetchSuggestions).toHaveBeenCalledWith({
|
|
90
90
|
workflow: "suggest_business_concept_structures_links",
|
|
91
91
|
params: { business_concept_id: "123", prompt: undefined },
|
|
92
|
-
})
|
|
92
|
+
}),
|
|
93
93
|
);
|
|
94
94
|
});
|
|
95
95
|
|
|
@@ -104,10 +104,12 @@ describe("StructureSuggestions", () => {
|
|
|
104
104
|
selectedStructure={null}
|
|
105
105
|
handleSelectedStructure={jest.fn()}
|
|
106
106
|
selectable={true}
|
|
107
|
-
|
|
107
|
+
/>,
|
|
108
108
|
);
|
|
109
109
|
|
|
110
|
-
expect(
|
|
110
|
+
expect(
|
|
111
|
+
rendered.queryByText(/mockthinkingoutloud/i),
|
|
112
|
+
).not.toBeInTheDocument();
|
|
111
113
|
expect(rendered.queryByText(/mocksearchresults/i)).not.toBeInTheDocument();
|
|
112
114
|
});
|
|
113
115
|
|
|
@@ -128,7 +130,7 @@ describe("StructureSuggestions", () => {
|
|
|
128
130
|
selectedStructure={null}
|
|
129
131
|
handleSelectedStructure={jest.fn()}
|
|
130
132
|
selectable={true}
|
|
131
|
-
|
|
133
|
+
/>,
|
|
132
134
|
);
|
|
133
135
|
|
|
134
136
|
act(() => {
|
|
@@ -140,7 +142,7 @@ describe("StructureSuggestions", () => {
|
|
|
140
142
|
});
|
|
141
143
|
|
|
142
144
|
await waitFor(() =>
|
|
143
|
-
expect(rendered.queryByText(/mockthinkingoutloud/i)).toBeInTheDocument()
|
|
145
|
+
expect(rendered.queryByText(/mockthinkingoutloud/i)).toBeInTheDocument(),
|
|
144
146
|
);
|
|
145
147
|
});
|
|
146
148
|
|
|
@@ -150,12 +152,12 @@ describe("StructureSuggestions", () => {
|
|
|
150
152
|
selectedStructure={null}
|
|
151
153
|
handleSelectedStructure={jest.fn()}
|
|
152
154
|
selectable={true}
|
|
153
|
-
|
|
155
|
+
/>,
|
|
154
156
|
);
|
|
155
157
|
|
|
156
158
|
expect(useAssistantSocket).toHaveBeenCalledWith(
|
|
157
159
|
true,
|
|
158
|
-
expect.objectContaining({ conversationId: null })
|
|
160
|
+
expect.objectContaining({ conversationId: null }),
|
|
159
161
|
);
|
|
160
162
|
});
|
|
161
163
|
|
|
@@ -170,12 +172,12 @@ describe("StructureSuggestions", () => {
|
|
|
170
172
|
selectedStructure={null}
|
|
171
173
|
handleSelectedStructure={jest.fn()}
|
|
172
174
|
selectable={true}
|
|
173
|
-
|
|
175
|
+
/>,
|
|
174
176
|
);
|
|
175
177
|
|
|
176
178
|
expect(useAssistantSocket).toHaveBeenCalledWith(
|
|
177
179
|
false,
|
|
178
|
-
expect.objectContaining({ conversationId: "state-1" })
|
|
180
|
+
expect.objectContaining({ conversationId: "state-1" }),
|
|
179
181
|
);
|
|
180
182
|
});
|
|
181
183
|
|
|
@@ -197,7 +199,7 @@ describe("StructureSuggestions", () => {
|
|
|
197
199
|
selectedStructure={null}
|
|
198
200
|
handleSelectedStructure={jest.fn()}
|
|
199
201
|
selectable={false}
|
|
200
|
-
|
|
202
|
+
/>,
|
|
201
203
|
);
|
|
202
204
|
|
|
203
205
|
act(() => {
|
|
@@ -208,10 +210,12 @@ describe("StructureSuggestions", () => {
|
|
|
208
210
|
});
|
|
209
211
|
|
|
210
212
|
await waitFor(() =>
|
|
211
|
-
expect(rendered.queryByText(/mocksearchresults/i)).toBeInTheDocument()
|
|
213
|
+
expect(rendered.queryByText(/mocksearchresults/i)).toBeInTheDocument(),
|
|
212
214
|
);
|
|
213
215
|
|
|
214
|
-
expect(
|
|
216
|
+
expect(
|
|
217
|
+
rendered.queryByText(/mockthinkingoutloud/i),
|
|
218
|
+
).not.toBeInTheDocument();
|
|
215
219
|
|
|
216
220
|
const props = StructuresSearchResults.mock.calls.at(-1)[0];
|
|
217
221
|
expect(props.structures).toEqual(structures);
|
|
@@ -235,7 +239,7 @@ describe("StructureSuggestions", () => {
|
|
|
235
239
|
selectedStructure={null}
|
|
236
240
|
handleSelectedStructure={jest.fn()}
|
|
237
241
|
selectable={true}
|
|
238
|
-
|
|
242
|
+
/>,
|
|
239
243
|
);
|
|
240
244
|
|
|
241
245
|
act(() => {
|
|
@@ -246,7 +250,9 @@ describe("StructureSuggestions", () => {
|
|
|
246
250
|
});
|
|
247
251
|
|
|
248
252
|
await waitFor(() =>
|
|
249
|
-
expect(
|
|
253
|
+
expect(
|
|
254
|
+
rendered.queryByText(/mockthinkingoutloud/i),
|
|
255
|
+
).not.toBeInTheDocument(),
|
|
250
256
|
);
|
|
251
257
|
|
|
252
258
|
expect(rendered.queryByText(/mocksearchresults/i)).not.toBeInTheDocument();
|
|
@@ -269,7 +275,7 @@ describe("StructureSuggestions", () => {
|
|
|
269
275
|
selectedStructure={null}
|
|
270
276
|
handleSelectedStructure={jest.fn()}
|
|
271
277
|
selectable={true}
|
|
272
|
-
|
|
278
|
+
/>,
|
|
273
279
|
);
|
|
274
280
|
|
|
275
281
|
act(() => {
|
|
@@ -20,7 +20,9 @@ describe("SuggestLinkButton", () => {
|
|
|
20
20
|
|
|
21
21
|
fireEvent.click(screen.getByText("links.actions.suggest"));
|
|
22
22
|
|
|
23
|
-
const input = screen.getByPlaceholderText(
|
|
23
|
+
const input = screen.getByPlaceholderText(
|
|
24
|
+
"links.suggest.prompt.placeholder",
|
|
25
|
+
);
|
|
24
26
|
fireEvent.change(input, { target: { value: "my prompt" } });
|
|
25
27
|
|
|
26
28
|
fireEvent.click(screen.getByText("links.suggest.submit"));
|
|
@@ -34,7 +34,7 @@ jest.mock("@truedat/ai/hooks/useTranslations", () => ({
|
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
})
|
|
37
|
+
}),
|
|
38
38
|
),
|
|
39
39
|
})),
|
|
40
40
|
}));
|
|
@@ -284,7 +284,7 @@ describe("TranslationModal", () => {
|
|
|
284
284
|
it("requests translation and displays results", async () => {
|
|
285
285
|
const { getByText, getAllByText, getByRole } = render(
|
|
286
286
|
<TranslationModal {...props} />,
|
|
287
|
-
renderOpts
|
|
287
|
+
renderOpts,
|
|
288
288
|
);
|
|
289
289
|
|
|
290
290
|
await act(async () => {
|
|
@@ -295,7 +295,7 @@ describe("TranslationModal", () => {
|
|
|
295
295
|
expect(getByText("Translation preview")).toBeInTheDocument();
|
|
296
296
|
expect(getByText("Ein Messer in der Dunkelheit")).toBeInTheDocument();
|
|
297
297
|
expect(
|
|
298
|
-
getAllByText("Un cuchillo en la oscuridad").length
|
|
298
|
+
getAllByText("Un cuchillo en la oscuridad").length,
|
|
299
299
|
).toBeGreaterThan(0);
|
|
300
300
|
expect(getByText("Un couteau dans le noir")).toBeInTheDocument();
|
|
301
301
|
});
|
|
@@ -27,7 +27,7 @@ export const ConfirmToggleModal = ({ onConfirm, action: actionData }) => {
|
|
|
27
27
|
size="small"
|
|
28
28
|
content={formatMessage(
|
|
29
29
|
{ id: `ai.actions.actions.${action}.confirmation.content` },
|
|
30
|
-
{ name: <i>{name}</i> }
|
|
30
|
+
{ name: <i>{name}</i> },
|
|
31
31
|
)}
|
|
32
32
|
onConfirm={() => onConfirm()}
|
|
33
33
|
/>
|
|
@@ -56,7 +56,7 @@ export const ConfirmDeleteModal = ({ handleDelete, name, id }) => {
|
|
|
56
56
|
size="small"
|
|
57
57
|
content={formatMessage(
|
|
58
58
|
{ id: "ai.actions.actions.delete.confirmation.content" },
|
|
59
|
-
{ name: <i>{name}</i> }
|
|
59
|
+
{ name: <i>{name}</i> },
|
|
60
60
|
)}
|
|
61
61
|
onConfirm={() => handleDelete({ id })}
|
|
62
62
|
/>
|
|
@@ -5,7 +5,7 @@ import { FormattedMessage } from "react-intl";
|
|
|
5
5
|
import { Segment, List, Divider } from "semantic-ui-react";
|
|
6
6
|
|
|
7
7
|
const DynamicFormViewer = lazy(
|
|
8
|
-
() => import("@truedat/df/components/DynamicFormViewer")
|
|
8
|
+
() => import("@truedat/df/components/DynamicFormViewer"),
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
export const ActionDetail = ({ action }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { useParams } from "react-router";
|
|
2
|
+
import { useNavigate, useParams } from "react-router";
|
|
3
3
|
import {
|
|
4
4
|
Checkbox,
|
|
5
5
|
Container,
|
|
@@ -17,6 +17,7 @@ import ActionForm from "./ActionForm";
|
|
|
17
17
|
|
|
18
18
|
const ActionEdit = () => {
|
|
19
19
|
const { formatMessage } = useIntl();
|
|
20
|
+
const navigate = useNavigate();
|
|
20
21
|
const { id } = useParams();
|
|
21
22
|
const { action } = useAction(id);
|
|
22
23
|
const { data: template } = useTemplate({
|