@mvriu5/payload-ai 0.5.0 → 0.5.8
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/README.md +52 -5
- package/dist/ai/providerOptions.d.ts +1 -14
- package/dist/ai/providerOptions.js +0 -23
- package/dist/ai/providerRuntime.d.ts +3 -2
- package/dist/ai/providerRuntime.js +6 -15
- package/dist/components/AIActionProposalList.d.ts +1 -1
- package/dist/components/AIApiKeyField.js +0 -8
- package/dist/components/AIInput.d.ts +1 -1
- package/dist/components/AIInput.js +32 -14
- package/dist/components/AIInput.module.css +165 -148
- package/dist/components/CollectionMentionPopover.d.ts +1 -1
- package/dist/components/Icons.d.ts +5 -0
- package/dist/components/Icons.js +179 -0
- package/dist/components/hooks/useAISettings.d.ts +1 -1
- package/dist/endpoints/aiApplyActionEndpointHandler.d.ts +2 -1
- package/dist/endpoints/aiApplyActionEndpointHandler.js +9 -4
- package/dist/endpoints/aiChatEndpointHandler.d.ts +5 -1
- package/dist/endpoints/aiChatEndpointHandler.js +26 -2
- package/dist/endpoints/aiMentionSuggestionsEndpointHandler.d.ts +2 -1
- package/dist/endpoints/aiMentionSuggestionsEndpointHandler.js +7 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.js +29 -18
- package/dist/payload/collectionPermissions.d.ts +22 -0
- package/dist/payload/collectionPermissions.js +68 -0
- package/dist/payload/schemaContext.d.ts +2 -1
- package/dist/payload/schemaContext.js +6 -3
- package/package.json +113 -122
|
@@ -1,237 +1,254 @@
|
|
|
1
1
|
.chat {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
border: 1px solid var(--theme-elevation-150);
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
margin-bottom: 24px;
|
|
5
|
+
max-width: 920px;
|
|
6
|
+
padding: 20px;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.chatHeader {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
align-items: flex-start;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
margin-bottom: 16px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.chatTitle {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
font-size: 18px;
|
|
18
|
+
line-height: 1.3;
|
|
19
|
+
margin: 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.chatDescription {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
color: var(--theme-elevation-600);
|
|
24
|
+
font-size: 13px;
|
|
25
|
+
line-height: 1.4;
|
|
26
|
+
margin: 4px 0 0;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.settings {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
align-items: flex-end;
|
|
31
|
+
display: flex;
|
|
32
|
+
gap: 10px;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.setting {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 4px;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.settingLabel {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
color: var(--theme-elevation-600);
|
|
43
|
+
font-size: 11px;
|
|
44
|
+
line-height: 1.2;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.selectWrapper {
|
|
48
|
+
align-items: center;
|
|
49
|
+
display: flex;
|
|
50
|
+
position: relative;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.selectProviderIcon {
|
|
54
|
+
color: var(--theme-text);
|
|
55
|
+
height: 16px;
|
|
56
|
+
left: 10px;
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 50%;
|
|
60
|
+
transform: translateY(-50%);
|
|
61
|
+
width: 16px;
|
|
45
62
|
}
|
|
46
63
|
|
|
47
64
|
.select {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
background: var(--theme-input-bg);
|
|
66
|
+
border: 1px solid var(--theme-elevation-150);
|
|
67
|
+
border-radius: 4px;
|
|
68
|
+
color: var(--theme-text);
|
|
69
|
+
font: inherit;
|
|
70
|
+
min-height: 34px;
|
|
71
|
+
min-width: 160px;
|
|
72
|
+
padding: 0 28px 0 34px;
|
|
56
73
|
}
|
|
57
74
|
|
|
58
75
|
.select:focus {
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
border-color: var(--theme-success-500);
|
|
77
|
+
outline: none;
|
|
61
78
|
}
|
|
62
79
|
|
|
63
80
|
.chatInputRow {
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
position: relative;
|
|
82
|
+
width: 100%;
|
|
66
83
|
}
|
|
67
84
|
|
|
68
85
|
.chatActionsRow {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
align-items: flex-end;
|
|
87
|
+
display: flex;
|
|
88
|
+
gap: 12px;
|
|
89
|
+
justify-content: space-between;
|
|
90
|
+
margin-top: 12px;
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
.chatInput {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
background: transparent;
|
|
95
|
+
border: 0;
|
|
96
|
+
color: var(--theme-text);
|
|
97
|
+
font: inherit;
|
|
98
|
+
min-height: 84px;
|
|
99
|
+
padding: 0;
|
|
100
|
+
white-space: pre-wrap;
|
|
101
|
+
width: 100%;
|
|
85
102
|
}
|
|
86
103
|
|
|
87
104
|
.chatInput:focus {
|
|
88
|
-
|
|
105
|
+
outline: none;
|
|
89
106
|
}
|
|
90
107
|
|
|
91
108
|
.chatInput:empty::before {
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
color: var(--theme-elevation-400);
|
|
110
|
+
content: attr(data-placeholder);
|
|
94
111
|
}
|
|
95
112
|
|
|
96
113
|
.chatInputSurface {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
background: var(--theme-input-bg);
|
|
115
|
+
border: 1px solid var(--theme-elevation-150);
|
|
116
|
+
border-radius: 4px;
|
|
117
|
+
padding: 12px;
|
|
118
|
+
width: 100%;
|
|
102
119
|
}
|
|
103
120
|
|
|
104
121
|
.chatInputSurface:focus-within {
|
|
105
|
-
|
|
122
|
+
border-color: var(--theme-success-500);
|
|
106
123
|
}
|
|
107
124
|
|
|
108
125
|
.inlineBadge {
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
margin: 0 2px;
|
|
127
|
+
vertical-align: middle;
|
|
111
128
|
}
|
|
112
129
|
|
|
113
130
|
.badge {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
align-items: center;
|
|
132
|
+
background: var(--theme-elevation-100);
|
|
133
|
+
border: 1px solid var(--theme-elevation-150);
|
|
134
|
+
border-radius: 999px;
|
|
135
|
+
color: var(--theme-text);
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
font-size: 11px;
|
|
138
|
+
gap: 3px;
|
|
139
|
+
line-height: 1;
|
|
140
|
+
min-height: 20px;
|
|
141
|
+
padding: 0 8px;
|
|
142
|
+
position: relative;
|
|
143
|
+
top: -2px;
|
|
144
|
+
white-space: nowrap;
|
|
128
145
|
}
|
|
129
146
|
|
|
130
147
|
.prefix {
|
|
131
|
-
|
|
148
|
+
color: var(--theme-elevation-500);
|
|
132
149
|
}
|
|
133
150
|
|
|
134
151
|
.name {
|
|
135
|
-
|
|
152
|
+
color: var(--theme-text);
|
|
136
153
|
}
|
|
137
154
|
|
|
138
155
|
.collection {
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
background: color-mix(in srgb, #2f7d68 12%, var(--theme-bg));
|
|
157
|
+
border-color: color-mix(in srgb, #2f7d68 28%, var(--theme-elevation-150));
|
|
141
158
|
}
|
|
142
159
|
|
|
143
160
|
.global {
|
|
144
|
-
|
|
145
|
-
|
|
161
|
+
background: color-mix(in srgb, #8b6f24 12%, var(--theme-bg));
|
|
162
|
+
border-color: color-mix(in srgb, #8b6f24 28%, var(--theme-elevation-150));
|
|
146
163
|
}
|
|
147
164
|
|
|
148
165
|
.block {
|
|
149
|
-
|
|
150
|
-
|
|
166
|
+
background: color-mix(in srgb, #5a6fa8 12%, var(--theme-bg));
|
|
167
|
+
border-color: color-mix(in srgb, #5a6fa8 28%, var(--theme-elevation-150));
|
|
151
168
|
}
|
|
152
169
|
|
|
153
170
|
.doc {
|
|
154
|
-
|
|
155
|
-
|
|
171
|
+
background: color-mix(in srgb, #7a5c9e 12%, var(--theme-bg));
|
|
172
|
+
border-color: color-mix(in srgb, #7a5c9e 28%, var(--theme-elevation-150));
|
|
156
173
|
}
|
|
157
174
|
|
|
158
175
|
.chatButton {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
background: var(--theme-text);
|
|
177
|
+
border: 0;
|
|
178
|
+
border-radius: 4px;
|
|
179
|
+
color: var(--theme-bg);
|
|
180
|
+
cursor: pointer;
|
|
181
|
+
font: inherit;
|
|
182
|
+
min-height: 40px;
|
|
183
|
+
padding: 0 18px;
|
|
167
184
|
}
|
|
168
185
|
|
|
169
186
|
.chatButton:disabled {
|
|
170
|
-
|
|
171
|
-
|
|
187
|
+
cursor: not-allowed;
|
|
188
|
+
opacity: 0.45;
|
|
172
189
|
}
|
|
173
190
|
|
|
174
191
|
.chatError {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
192
|
+
color: var(--theme-error-500);
|
|
193
|
+
font-size: 13px;
|
|
194
|
+
line-height: 1.4;
|
|
195
|
+
margin-top: 12px;
|
|
179
196
|
}
|
|
180
197
|
|
|
181
198
|
.debugInfo {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
199
|
+
background: var(--theme-elevation-50);
|
|
200
|
+
border: 1px solid var(--theme-elevation-150);
|
|
201
|
+
border-radius: 4px;
|
|
202
|
+
color: var(--theme-elevation-800);
|
|
203
|
+
font-size: 12px;
|
|
204
|
+
line-height: 1.5;
|
|
205
|
+
margin: 12px 0 0;
|
|
206
|
+
max-height: 260px;
|
|
207
|
+
overflow: auto;
|
|
208
|
+
padding: 12px;
|
|
209
|
+
white-space: pre-wrap;
|
|
193
210
|
}
|
|
194
211
|
|
|
195
212
|
.chatResponse {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
213
|
+
background: var(--theme-elevation-50);
|
|
214
|
+
border: 1px solid var(--theme-elevation-100);
|
|
215
|
+
border-radius: 4px;
|
|
216
|
+
line-height: 1.5;
|
|
217
|
+
margin-top: 16px;
|
|
218
|
+
padding: 12px;
|
|
219
|
+
white-space: pre-wrap;
|
|
203
220
|
}
|
|
204
221
|
|
|
205
222
|
@media (max-width: 768px) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
223
|
+
.chatHeader {
|
|
224
|
+
flex-direction: column;
|
|
225
|
+
gap: 12px;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.chatInputRow {
|
|
229
|
+
width: 100%;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.chatActionsRow {
|
|
233
|
+
align-items: stretch;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.settings {
|
|
238
|
+
align-items: stretch;
|
|
239
|
+
width: 100%;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.setting {
|
|
243
|
+
flex: 1;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.select {
|
|
247
|
+
min-width: 0;
|
|
248
|
+
width: 100%;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.chatButton {
|
|
252
|
+
align-self: stretch;
|
|
253
|
+
}
|
|
237
254
|
}
|
|
@@ -12,5 +12,5 @@ type CollectionMentionPopoverProps = {
|
|
|
12
12
|
suggestions: CollectionMentionOption[];
|
|
13
13
|
onSelect: (suggestion: CollectionMentionOption) => void;
|
|
14
14
|
};
|
|
15
|
-
export declare const CollectionMentionPopover: ({ containerRef, onSelect, suggestions }: CollectionMentionPopoverProps) => import("react
|
|
15
|
+
export declare const CollectionMentionPopover: ({ containerRef, onSelect, suggestions }: CollectionMentionPopoverProps) => import("react").JSX.Element | null;
|
|
16
16
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SVGProps } from "react";
|
|
2
|
+
export declare function MistralAiIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
3
|
+
export declare function OpenaiIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
4
|
+
export declare function ClaudeIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
5
|
+
export declare function GoogleGeminiIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
export function MistralAiIcon(props) {
|
|
2
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
3
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4
|
+
viewBox: "0 0 256 233",
|
|
5
|
+
...props
|
|
6
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
7
|
+
d: "M186.182 0h46.545v46.545h-46.545z"
|
|
8
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
9
|
+
fill: "#f7d046",
|
|
10
|
+
d: "M209.455 0H256v46.545h-46.545z"
|
|
11
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
12
|
+
d: "M0 0h46.545v46.545H0zm0 46.545h46.545V93.09H0zm0 46.546h46.545v46.545H0zm0 46.545h46.545v46.545H0zm0 46.546h46.545v46.545H0z"
|
|
13
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
14
|
+
fill: "#f7d046",
|
|
15
|
+
d: "M23.273 0h46.545v46.545H23.273z"
|
|
16
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
17
|
+
fill: "#f2a73b",
|
|
18
|
+
d: "M209.455 46.545H256V93.09h-46.545zm-186.182 0h46.545V93.09H23.273z"
|
|
19
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
20
|
+
d: "M139.636 46.545h46.545V93.09h-46.545z"
|
|
21
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
22
|
+
fill: "#f2a73b",
|
|
23
|
+
d: "M162.909 46.545h46.545V93.09h-46.545zm-93.091 0h46.545V93.09H69.818z"
|
|
24
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
25
|
+
fill: "#ee792f",
|
|
26
|
+
d: "M116.364 93.091h46.545v46.545h-46.545zm46.545 0h46.545v46.545h-46.545zm-93.091 0h46.545v46.545H69.818z"
|
|
27
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
28
|
+
d: "M93.091 139.636h46.545v46.545H93.091z"
|
|
29
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
30
|
+
fill: "#eb5829",
|
|
31
|
+
d: "M116.364 139.636h46.545v46.545h-46.545z"
|
|
32
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
33
|
+
fill: "#ee792f",
|
|
34
|
+
d: "M209.455 93.091H256v46.545h-46.545zm-186.182 0h46.545v46.545H23.273z"
|
|
35
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
36
|
+
d: "M186.182 139.636h46.545v46.545h-46.545z"
|
|
37
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
38
|
+
fill: "#eb5829",
|
|
39
|
+
d: "M209.455 139.636H256v46.545h-46.545z"
|
|
40
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
41
|
+
d: "M186.182 186.182h46.545v46.545h-46.545z"
|
|
42
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
43
|
+
fill: "#eb5829",
|
|
44
|
+
d: "M23.273 139.636h46.545v46.545H23.273z"
|
|
45
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
46
|
+
fill: "#ea3326",
|
|
47
|
+
d: "M209.455 186.182H256v46.545h-46.545zm-186.182 0h46.545v46.545H23.273z"
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
export function OpenaiIcon(props) {
|
|
51
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
52
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
53
|
+
viewBox: "0 0 256 260",
|
|
54
|
+
...props
|
|
55
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
56
|
+
d: "M239.184 106.203a64.72 64.72 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.72 64.72 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.67 64.67 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.77 64.77 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483m-97.56 136.338a48.4 48.4 0 0 1-31.105-11.255l1.535-.87l51.67-29.825a8.6 8.6 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601M37.158 197.93a48.35 48.35 0 0 1-5.781-32.589l1.534.921l51.722 29.826a8.34 8.34 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803M23.549 85.38a48.5 48.5 0 0 1 25.58-21.333v61.39a8.29 8.29 0 0 0 4.195 7.316l62.874 36.272l-21.845 12.636a.82.82 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405zm179.466 41.695l-63.08-36.63L161.73 77.86a.82.82 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.54 8.54 0 0 0-4.4-7.213m21.742-32.69l-1.535-.922l-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.72.72 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391zM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87l-51.67 29.825a8.6 8.6 0 0 0-4.246 7.367zm11.868-25.58L128.067 97.3l28.188 16.218v32.434l-28.086 16.218l-28.188-16.218z"
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
export function ClaudeIcon(props) {
|
|
60
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
61
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
62
|
+
viewBox: "0 0 256 257",
|
|
63
|
+
...props
|
|
64
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
65
|
+
fill: "#d97757",
|
|
66
|
+
d: "m50.228 170.321l50.357-28.257l.843-2.463l-.843-1.361h-2.462l-8.426-.518l-28.775-.778l-24.952-1.037l-24.175-1.296l-6.092-1.297L0 125.796l.583-3.759l5.12-3.434l7.324.648l16.202 1.101l24.304 1.685l17.629 1.037l26.118 2.722h4.148l.583-1.685l-1.426-1.037l-1.101-1.037l-25.147-17.045l-27.22-18.017l-14.258-10.37l-7.713-5.25l-3.888-4.925l-1.685-10.758l7-7.713l9.397.649l2.398.648l9.527 7.323l20.35 15.75L94.817 91.9l3.889 3.24l1.555-1.102l.195-.777l-1.75-2.917l-14.453-26.118l-15.425-26.572l-6.87-11.018l-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0l10.63 1.426l4.472 3.888l6.61 15.101l10.694 23.786l16.591 32.34l4.861 9.592l2.592 8.879l.973 2.722h1.685v-1.556l1.36-18.211l2.528-22.36l2.463-28.776l.843-8.1l4.018-9.722l7.971-5.25l6.222 2.981l5.12 7.324l-.713 4.73l-3.046 19.768l-5.962 30.98l-3.889 20.739h2.268l2.593-2.593l10.499-13.934l17.628-22.036l7.778-8.749l9.073-9.657l5.833-4.601h11.018l8.1 12.055l-3.628 12.443l-11.342 14.388l-9.398 12.184l-13.48 18.147l-8.426 14.518l.778 1.166l2.01-.194l30.46-6.481l16.462-2.982l19.637-3.37l8.88 4.148l.971 4.213l-3.5 8.62l-20.998 5.184l-24.628 4.926l-36.682 8.685l-.454.324l.519.648l16.526 1.555l7.065.389h17.304l32.21 2.398l8.426 5.574l5.055 6.805l-.843 5.184l-12.962 6.611l-17.498-4.148l-40.83-9.721l-14-3.5h-1.944v1.167l11.666 11.406l21.387 19.314l26.767 24.887l1.36 6.157l-3.434 4.86l-3.63-.518l-23.526-17.693l-9.073-7.972l-20.545-17.304h-1.36v1.814l4.73 6.935l25.017 37.59l1.296 11.536l-1.814 3.76l-6.481 2.268l-7.13-1.297l-14.647-20.544l-15.1-23.138l-12.185-20.739l-1.49.843l-7.194 77.448l-3.37 3.953l-7.778 2.981l-6.48-4.925l-3.436-7.972l3.435-15.749l4.148-20.544l3.37-16.333l3.046-20.285l1.815-6.74l-.13-.454l-1.49.194l-15.295 20.999l-23.267 31.433l-18.406 19.702l-4.407 1.75l-7.648-3.954l.713-7.064l4.277-6.286l25.47-32.405l15.36-20.092l9.917-11.6l-.065-1.686h-.583L44.07 198.125l-12.055 1.555l-5.185-4.86l.648-7.972l2.463-2.593l20.35-13.999z"
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
export function GoogleGeminiIcon(props) {
|
|
70
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
71
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
72
|
+
viewBox: "0 0 512 188",
|
|
73
|
+
...props
|
|
74
|
+
}, /*#__PURE__*/ React.createElement("defs", null, /*#__PURE__*/ React.createElement("radialGradient", {
|
|
75
|
+
id: "SVGPMo0zqwk",
|
|
76
|
+
cx: "85.738%",
|
|
77
|
+
cy: "25.354%",
|
|
78
|
+
r: "103.154%",
|
|
79
|
+
fx: "85.738%",
|
|
80
|
+
fy: "25.354%",
|
|
81
|
+
gradientTransform: "matrix(-.86887 .47915 -.39276 -.66723 1.702 .012)"
|
|
82
|
+
}, /*#__PURE__*/ React.createElement("stop", {
|
|
83
|
+
offset: "0%",
|
|
84
|
+
stopColor: "#5baeff"
|
|
85
|
+
}), /*#__PURE__*/ React.createElement("stop", {
|
|
86
|
+
offset: "100%",
|
|
87
|
+
stopColor: "#9cbfff"
|
|
88
|
+
})), /*#__PURE__*/ React.createElement("radialGradient", {
|
|
89
|
+
id: "SVG6LOdsc2X",
|
|
90
|
+
cx: "61.879%",
|
|
91
|
+
cy: "26.683%",
|
|
92
|
+
r: "80.612%",
|
|
93
|
+
fx: "61.879%",
|
|
94
|
+
fy: "26.683%",
|
|
95
|
+
gradientTransform: "matrix(-.14736 .90946 -.98908 -.1355 .974 -.26)"
|
|
96
|
+
}, /*#__PURE__*/ React.createElement("stop", {
|
|
97
|
+
offset: "0%",
|
|
98
|
+
stopColor: "#409dff"
|
|
99
|
+
}), /*#__PURE__*/ React.createElement("stop", {
|
|
100
|
+
offset: "100%",
|
|
101
|
+
stopColor: "#64b0ff"
|
|
102
|
+
})), /*#__PURE__*/ React.createElement("radialGradient", {
|
|
103
|
+
id: "SVGRoCRHePI",
|
|
104
|
+
cx: "53.184%",
|
|
105
|
+
cy: "19.021%",
|
|
106
|
+
r: "110.789%",
|
|
107
|
+
fx: "53.184%",
|
|
108
|
+
fy: "19.021%",
|
|
109
|
+
gradientTransform: "matrix(-.16226 .97112 -.66046 -.23858 .744 -.28)"
|
|
110
|
+
}, /*#__PURE__*/ React.createElement("stop", {
|
|
111
|
+
offset: "0%",
|
|
112
|
+
stopColor: "#177cff"
|
|
113
|
+
}), /*#__PURE__*/ React.createElement("stop", {
|
|
114
|
+
offset: "100%",
|
|
115
|
+
stopColor: "#4da4ff"
|
|
116
|
+
})), /*#__PURE__*/ React.createElement("radialGradient", {
|
|
117
|
+
id: "SVG8W8bkc7G",
|
|
118
|
+
cx: "-182.665%",
|
|
119
|
+
cy: "10.869%",
|
|
120
|
+
r: "521.404%",
|
|
121
|
+
fx: "-182.665%",
|
|
122
|
+
fy: "10.869%",
|
|
123
|
+
gradientTransform: "matrix(.41608 .16332 -.90933 .07473 -.968 .399)"
|
|
124
|
+
}, /*#__PURE__*/ React.createElement("stop", {
|
|
125
|
+
offset: "0%",
|
|
126
|
+
stopColor: "#1c7aff"
|
|
127
|
+
}), /*#__PURE__*/ React.createElement("stop", {
|
|
128
|
+
offset: "100%",
|
|
129
|
+
stopColor: "#76a9ff"
|
|
130
|
+
}), /*#__PURE__*/ React.createElement("stop", {
|
|
131
|
+
offset: "100%",
|
|
132
|
+
stopColor: "#8fb9ff"
|
|
133
|
+
})), /*#__PURE__*/ React.createElement("linearGradient", {
|
|
134
|
+
id: "SVGKvzpwcOj",
|
|
135
|
+
x1: "48.887%",
|
|
136
|
+
x2: "48.887%",
|
|
137
|
+
y1: "8.809%",
|
|
138
|
+
y2: "100%"
|
|
139
|
+
}, /*#__PURE__*/ React.createElement("stop", {
|
|
140
|
+
offset: "0%",
|
|
141
|
+
stopColor: "#076eff"
|
|
142
|
+
}), /*#__PURE__*/ React.createElement("stop", {
|
|
143
|
+
offset: "100%",
|
|
144
|
+
stopColor: "#3e93ff"
|
|
145
|
+
})), /*#__PURE__*/ React.createElement("linearGradient", {
|
|
146
|
+
id: "SVGaWXYB1Pi",
|
|
147
|
+
x1: "13.217%",
|
|
148
|
+
x2: "78.598%",
|
|
149
|
+
y1: "0%",
|
|
150
|
+
y2: "94.201%"
|
|
151
|
+
}, /*#__PURE__*/ React.createElement("stop", {
|
|
152
|
+
offset: "0%",
|
|
153
|
+
stopColor: "#076eff"
|
|
154
|
+
}), /*#__PURE__*/ React.createElement("stop", {
|
|
155
|
+
offset: "100%",
|
|
156
|
+
stopColor: "#69a3ff"
|
|
157
|
+
}))), /*#__PURE__*/ React.createElement("path", {
|
|
158
|
+
fill: "url(#SVGPMo0zqwk)",
|
|
159
|
+
d: "M125.939 126.64q0 26.094-15.482 41.575q-17.395 18.438-45.748 18.438q-27.135 0-45.923-18.786Q0 149.08 0 121.597q0-27.485 18.786-46.27Q37.573 56.54 64.71 56.54q13.741 0 25.918 4.87t20.004 13.742l-11.48 11.48q-5.74-6.957-14.873-10.871t-19.57-3.914q-20.351 0-34.441 14.09q-13.916 14.264-13.916 35.66t13.916 35.659q14.09 14.09 34.442 14.09q18.613 0 30.963-10.437t14.263-28.702H64.71v-14.96h60.36q.87 4.872.87 9.394"
|
|
160
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
161
|
+
fill: "url(#SVG6LOdsc2X)",
|
|
162
|
+
d: "M176.17 96.205q19.152 0 30.485 12.387q11.334 12.388 11.334 34.703l-.176 1.757h-67.648q.352 12.651 8.434 20.382q8.083 7.73 19.328 7.73q15.462 0 24.248-15.461l14.408 7.028q-5.799 10.894-16.077 17.044t-23.282 6.15q-18.976 0-31.276-13.003t-12.299-32.857q0-19.68 11.948-32.77t30.573-13.09m-.351 14.76q-9.137 0-15.726 5.622q-6.59 5.623-8.698 15.11h49.374q-.702-8.96-7.292-14.846t-17.658-5.887"
|
|
163
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
164
|
+
fill: "url(#SVGRoCRHePI)",
|
|
165
|
+
d: "M244.493 184.843h-16.116V99.008h15.416v11.912h.7q3.68-6.306 11.299-10.51q7.62-4.206 15.153-4.205q9.459 0 16.641 4.38q7.182 4.379 10.51 12.086q10.687-16.466 29.605-16.466q14.89 0 22.948 9.11q8.058 9.108 8.058 25.925v53.603h-16.116v-51.15q0-12.088-4.38-17.43q-4.379-5.343-14.714-5.343q-9.285 0-15.59 7.883q-6.307 7.882-6.307 18.568v47.472h-16.116v-51.15q0-12.088-4.38-17.43q-4.379-5.343-14.714-5.343q-9.285 0-15.59 7.883q-6.307 7.882-6.307 18.568z"
|
|
166
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
167
|
+
fill: "url(#SVGKvzpwcOj)",
|
|
168
|
+
d: "M393.263 69.216q0 4.737-3.334 8.07q-3.334 3.335-8.071 3.335t-8.071-3.334t-3.334-8.071q0-4.738 3.334-8.071q3.334-3.334 8.07-3.334q4.74 0 8.072 3.334q3.334 3.334 3.334 8.07m-3.334 29.652v85.975h-16.142V98.868z"
|
|
169
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
170
|
+
fill: "url(#SVG8W8bkc7G)",
|
|
171
|
+
d: "M512 69.216q0 4.737-3.334 8.07q-3.334 3.335-8.07 3.335q-4.74 0-8.072-3.334q-3.333-3.334-3.334-8.071q0-4.738 3.334-8.071q3.334-3.334 8.071-3.334t8.071 3.334t3.334 8.07m-3.334 29.652v85.975h-16.142V98.868z"
|
|
172
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
173
|
+
fill: "url(#SVGaWXYB1Pi)",
|
|
174
|
+
d: "M404.004 99.008h15.415v11.912h.7q3.68-6.306 11.3-10.51q7.62-4.206 15.853-4.205q15.765 0 24.261 9.022q8.496 9.02 8.496 25.663v53.953h-16.116v-52.902q-.526-21.021-21.196-21.021q-9.634 0-16.116 7.795t-6.481 18.656v47.472h-16.116z"
|
|
175
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
176
|
+
fill: "#076eff",
|
|
177
|
+
d: "M348.374 72.76c-2.846-18.788-17.592-33.533-36.38-36.38c18.788-2.847 33.534-17.593 36.38-36.38c2.847 18.787 17.593 33.533 36.38 36.38c-18.787 2.847-33.533 17.592-36.38 36.38"
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
@@ -6,5 +6,5 @@ export declare const useAISettings: ({ adminUserSlug, apiRoute, defaultModels, }
|
|
|
6
6
|
}) => {
|
|
7
7
|
selectedModel: string;
|
|
8
8
|
setSelectedModel: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
9
|
-
settingsProvider: "claude" | "google" | "
|
|
9
|
+
settingsProvider: "claude" | "google" | "mistral" | "openai" | null;
|
|
10
10
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PayloadHandler } from "payload";
|
|
2
|
+
import { type ResolvedAICollectionPermissionMap } from "../payload/collectionPermissions.js";
|
|
2
3
|
type AIApplyActionEndpointOptions = {
|
|
3
|
-
collections?:
|
|
4
|
+
collections?: ResolvedAICollectionPermissionMap;
|
|
4
5
|
};
|
|
5
6
|
export declare const createAIApplyActionEndpointHandler: (options?: AIApplyActionEndpointOptions) => PayloadHandler;
|
|
6
7
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { verifyAIActionProposal } from "../ai/proposals.js";
|
|
2
2
|
import { containsSensitiveData } from "../ai/sensitiveData.js";
|
|
3
3
|
import { getCollectionFields, isAuthCollection, normalizeAuthData, normalizeDataForFields } from "../payload/normalizeData.js";
|
|
4
|
+
import { isCollectionActionAllowed } from "../payload/collectionPermissions.js";
|
|
4
5
|
const getProposalMeta = (proposal)=>{
|
|
5
6
|
if (!proposal) return {};
|
|
6
7
|
return {
|
|
@@ -18,9 +19,13 @@ const getAppliedDocReference = (doc)=>{
|
|
|
18
19
|
const isKnownCollection = (req, collection)=>{
|
|
19
20
|
return req.payload.config.collections.some((item)=>item.slug === collection);
|
|
20
21
|
};
|
|
21
|
-
const isAllowedCollection = (req, collection, collections)=>{
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const isAllowedCollection = (req, collection, collections, action = "read")=>{
|
|
23
|
+
return isCollectionActionAllowed({
|
|
24
|
+
action,
|
|
25
|
+
permissions: collections,
|
|
26
|
+
req,
|
|
27
|
+
slug: collection
|
|
28
|
+
});
|
|
24
29
|
};
|
|
25
30
|
const isKnownGlobal = (req, slug)=>{
|
|
26
31
|
return req.payload.config.globals?.some((item)=>item.slug === slug) || false;
|
|
@@ -93,7 +98,7 @@ export const createAIApplyActionEndpointHandler = (options = {})=>async (req)=>{
|
|
|
93
98
|
status: "applied"
|
|
94
99
|
});
|
|
95
100
|
}
|
|
96
|
-
if (!isAllowedCollection(req, proposal.collection, options.collections)) return Response.json({
|
|
101
|
+
if (!isAllowedCollection(req, proposal.collection, options.collections, proposal.action)) return Response.json({
|
|
97
102
|
error: "Unknown collection"
|
|
98
103
|
}, {
|
|
99
104
|
status: 400
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PayloadHandler } from "payload";
|
|
2
2
|
import { type AIActionSignature } from "../ai/proposals.js";
|
|
3
|
+
import { type AIModelConfig } from "../ai/providerOptions.js";
|
|
4
|
+
import { type ResolvedAICollectionPermissionMap } from "../payload/collectionPermissions.js";
|
|
3
5
|
export type AIActionProposal = ({
|
|
4
6
|
action: "create";
|
|
5
7
|
collection: string;
|
|
@@ -25,7 +27,9 @@ export type AIActionProposal = ({
|
|
|
25
27
|
_aiSignature?: AIActionSignature;
|
|
26
28
|
};
|
|
27
29
|
type AIChatEndpointOptions = {
|
|
28
|
-
|
|
30
|
+
allowUserApiKeys?: boolean;
|
|
31
|
+
collections?: ResolvedAICollectionPermissionMap;
|
|
32
|
+
models?: AIModelConfig;
|
|
29
33
|
};
|
|
30
34
|
export declare const createAIChatEndpointHandler: (options?: AIChatEndpointOptions) => PayloadHandler;
|
|
31
35
|
export {};
|