@truedat/ai 7.2.5 → 7.2.7
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 +4 -4
- package/src/components/constants.js +6 -1
- package/src/components/providers/ProviderEditor.js +7 -1
- package/src/components/providers/__tests__/__snapshots__/ProviderEditor.spec.js.snap +52 -0
- package/src/components/providers/providerProperties/Gemini.js +114 -0
- package/src/components/providers/providerProperties/index.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/ai",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.7",
|
|
4
4
|
"description": "Truedat Web Artificial Intelligence package",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/react-hooks": "^8.0.1",
|
|
37
37
|
"@testing-library/user-event": "^13.2.1",
|
|
38
|
-
"@truedat/test": "7.2.
|
|
38
|
+
"@truedat/test": "7.2.7",
|
|
39
39
|
"babel-jest": "^28.1.0",
|
|
40
40
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
41
41
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
]
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@truedat/core": "7.2.
|
|
88
|
+
"@truedat/core": "7.2.7",
|
|
89
89
|
"prop-types": "^15.8.1",
|
|
90
90
|
"react-hook-form": "^7.45.4",
|
|
91
91
|
"react-intl": "^5.20.10",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"react-dom": ">= 16.8.6 < 17",
|
|
98
98
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "8bafa5d50e387f169d87b9a1d3b373d35114288e"
|
|
101
101
|
}
|
|
@@ -3,7 +3,12 @@ import { useIntl } from "react-intl";
|
|
|
3
3
|
|
|
4
4
|
export const resourceTypes = ["data_structure", "business_concept"];
|
|
5
5
|
|
|
6
|
-
export const providerTypes = [
|
|
6
|
+
export const providerTypes = [
|
|
7
|
+
"openai",
|
|
8
|
+
"azure_openai",
|
|
9
|
+
"bedrock_claude",
|
|
10
|
+
"gemini",
|
|
11
|
+
];
|
|
7
12
|
|
|
8
13
|
export const useResourceTypeOptions = () =>
|
|
9
14
|
useOptions(resourceTypes, "resourceMappings.resourceType");
|
|
@@ -13,12 +13,18 @@ import {
|
|
|
13
13
|
import { FormProvider, useForm, Controller } from "react-hook-form";
|
|
14
14
|
import { ConfirmModal } from "@truedat/core/components";
|
|
15
15
|
import { useProviderTypeOptions } from "../constants";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
Openai,
|
|
18
|
+
AzureOpenai,
|
|
19
|
+
BedrockClaude,
|
|
20
|
+
Gemini,
|
|
21
|
+
} from "./providerProperties";
|
|
17
22
|
|
|
18
23
|
const providerPropertiesComponents = {
|
|
19
24
|
openai: <Openai />,
|
|
20
25
|
azure_openai: <AzureOpenai />,
|
|
21
26
|
bedrock_claude: <BedrockClaude />,
|
|
27
|
+
gemini: <Gemini />,
|
|
22
28
|
};
|
|
23
29
|
|
|
24
30
|
export default function ProviderEditor({
|
|
@@ -94,6 +94,19 @@ exports[`<ProviderEditor /> matches snapshot without onDelete 1`] = `
|
|
|
94
94
|
providers.type.bedrock_claude
|
|
95
95
|
</span>
|
|
96
96
|
</div>
|
|
97
|
+
<div
|
|
98
|
+
aria-checked="false"
|
|
99
|
+
aria-selected="false"
|
|
100
|
+
class="item"
|
|
101
|
+
role="option"
|
|
102
|
+
style="pointer-events: all;"
|
|
103
|
+
>
|
|
104
|
+
<span
|
|
105
|
+
class="text"
|
|
106
|
+
>
|
|
107
|
+
providers.type.gemini
|
|
108
|
+
</span>
|
|
109
|
+
</div>
|
|
97
110
|
</div>
|
|
98
111
|
</div>
|
|
99
112
|
</div>
|
|
@@ -269,6 +282,19 @@ exports[`<ProviderEditor /> matches the latest snapshot 1`] = `
|
|
|
269
282
|
providers.type.bedrock_claude
|
|
270
283
|
</span>
|
|
271
284
|
</div>
|
|
285
|
+
<div
|
|
286
|
+
aria-checked="false"
|
|
287
|
+
aria-selected="false"
|
|
288
|
+
class="item"
|
|
289
|
+
role="option"
|
|
290
|
+
style="pointer-events: all;"
|
|
291
|
+
>
|
|
292
|
+
<span
|
|
293
|
+
class="text"
|
|
294
|
+
>
|
|
295
|
+
providers.type.gemini
|
|
296
|
+
</span>
|
|
297
|
+
</div>
|
|
272
298
|
</div>
|
|
273
299
|
</div>
|
|
274
300
|
</div>
|
|
@@ -447,6 +473,19 @@ exports[`<ProviderEditor /> test cancel button with confirm 1`] = `
|
|
|
447
473
|
providers.type.bedrock_claude
|
|
448
474
|
</span>
|
|
449
475
|
</div>
|
|
476
|
+
<div
|
|
477
|
+
aria-checked="false"
|
|
478
|
+
aria-selected="false"
|
|
479
|
+
class="item"
|
|
480
|
+
role="option"
|
|
481
|
+
style="pointer-events: all;"
|
|
482
|
+
>
|
|
483
|
+
<span
|
|
484
|
+
class="text"
|
|
485
|
+
>
|
|
486
|
+
providers.type.gemini
|
|
487
|
+
</span>
|
|
488
|
+
</div>
|
|
450
489
|
</div>
|
|
451
490
|
</div>
|
|
452
491
|
</div>
|
|
@@ -623,6 +662,19 @@ exports[`<ProviderEditor /> test delete button 1`] = `
|
|
|
623
662
|
providers.type.bedrock_claude
|
|
624
663
|
</span>
|
|
625
664
|
</div>
|
|
665
|
+
<div
|
|
666
|
+
aria-checked="false"
|
|
667
|
+
aria-selected="false"
|
|
668
|
+
class="item"
|
|
669
|
+
role="option"
|
|
670
|
+
style="pointer-events: all;"
|
|
671
|
+
>
|
|
672
|
+
<span
|
|
673
|
+
class="text"
|
|
674
|
+
>
|
|
675
|
+
providers.type.gemini
|
|
676
|
+
</span>
|
|
677
|
+
</div>
|
|
626
678
|
</div>
|
|
627
679
|
</div>
|
|
628
680
|
</div>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
4
|
+
import { Form } from "semantic-ui-react";
|
|
5
|
+
|
|
6
|
+
export default function Gemini() {
|
|
7
|
+
const { formatMessage } = useIntl();
|
|
8
|
+
const { control } = useFormContext();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<Controller
|
|
13
|
+
control={control}
|
|
14
|
+
name="properties.model"
|
|
15
|
+
rules={{
|
|
16
|
+
required: formatMessage(
|
|
17
|
+
{ id: "form.validation.required" },
|
|
18
|
+
{
|
|
19
|
+
prop: formatMessage({
|
|
20
|
+
id: "providerProperties.form.model",
|
|
21
|
+
}),
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
}}
|
|
25
|
+
render={({
|
|
26
|
+
field: { onBlur, onChange, value },
|
|
27
|
+
fieldState: { error },
|
|
28
|
+
}) => (
|
|
29
|
+
<Form.Input
|
|
30
|
+
autoComplete="off"
|
|
31
|
+
placeholder={formatMessage({
|
|
32
|
+
id: "providerProperties.form.model",
|
|
33
|
+
})}
|
|
34
|
+
error={error?.message}
|
|
35
|
+
label={formatMessage({
|
|
36
|
+
id: "providerProperties.form.model",
|
|
37
|
+
})}
|
|
38
|
+
onBlur={onBlur}
|
|
39
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
40
|
+
value={value}
|
|
41
|
+
required
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
45
|
+
<Controller
|
|
46
|
+
control={control}
|
|
47
|
+
name="properties.temperature"
|
|
48
|
+
render={({
|
|
49
|
+
field: { onBlur, onChange, value },
|
|
50
|
+
fieldState: { error },
|
|
51
|
+
}) => (
|
|
52
|
+
<Form.Input
|
|
53
|
+
autoComplete="off"
|
|
54
|
+
placeholder={formatMessage({
|
|
55
|
+
id: "providerProperties.form.temperature",
|
|
56
|
+
})}
|
|
57
|
+
error={error?.message}
|
|
58
|
+
label={formatMessage({
|
|
59
|
+
id: "providerProperties.form.temperature",
|
|
60
|
+
})}
|
|
61
|
+
onBlur={onBlur}
|
|
62
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
63
|
+
value={value}
|
|
64
|
+
/>
|
|
65
|
+
)}
|
|
66
|
+
/>
|
|
67
|
+
<Controller
|
|
68
|
+
control={control}
|
|
69
|
+
name="properties.top_p"
|
|
70
|
+
render={({
|
|
71
|
+
field: { onBlur, onChange, value },
|
|
72
|
+
fieldState: { error },
|
|
73
|
+
}) => (
|
|
74
|
+
<Form.Input
|
|
75
|
+
autoComplete="off"
|
|
76
|
+
placeholder={formatMessage({
|
|
77
|
+
id: "providerProperties.form.topP",
|
|
78
|
+
})}
|
|
79
|
+
error={error?.message}
|
|
80
|
+
label={formatMessage({
|
|
81
|
+
id: "providerProperties.form.topP",
|
|
82
|
+
})}
|
|
83
|
+
onBlur={onBlur}
|
|
84
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
85
|
+
value={value}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
/>
|
|
89
|
+
<Controller
|
|
90
|
+
control={control}
|
|
91
|
+
name="properties.api_key"
|
|
92
|
+
render={({
|
|
93
|
+
field: { onBlur, onChange, value },
|
|
94
|
+
fieldState: { error },
|
|
95
|
+
}) => (
|
|
96
|
+
<Form.Input
|
|
97
|
+
type="password"
|
|
98
|
+
autoComplete="off"
|
|
99
|
+
placeholder={formatMessage({
|
|
100
|
+
id: "providerProperties.form.apiKey",
|
|
101
|
+
})}
|
|
102
|
+
error={error?.message}
|
|
103
|
+
label={formatMessage({
|
|
104
|
+
id: "providerProperties.form.apiKey",
|
|
105
|
+
})}
|
|
106
|
+
onBlur={onBlur}
|
|
107
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
108
|
+
value={value}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
/>
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
}
|