@object-ui/plugin-ai 17.6.0 → 17.7.0
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/CHANGELOG.md +1194 -0
- package/README.md +152 -53
- package/dist/AIFormAssist.d.ts +11 -1
- package/dist/AIRecommendations.d.ts +14 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +207 -251
- package/dist/index.umd.cjs +1 -1
- package/dist/useAiTranslation.d.ts +51 -0
- package/package.json +10 -11
package/dist/index.js
CHANGED
|
@@ -2,384 +2,399 @@ import { ComponentRegistry as e } from "@object-ui/core";
|
|
|
2
2
|
import { useState as t } from "react";
|
|
3
3
|
import { Badge as n, Button as r, Card as i, CardContent as a, CardHeader as o, CardTitle as s, Input as c } from "@object-ui/components";
|
|
4
4
|
import { ArrowRight as l, Check as u, Clock as d, ExternalLink as f, Lightbulb as p, Loader2 as m, RefreshCw as h, Search as g, Sparkles as _, Star as v, Table as y, ThumbsDown as b, ThumbsUp as x, X as S } from "lucide-react";
|
|
5
|
-
import {
|
|
5
|
+
import { createSafeTranslation as C, useDisplayLocale as w } from "@object-ui/i18n";
|
|
6
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
7
|
+
var O = C({
|
|
8
|
+
"ai.nlQuery.placeholder": "Ask a question about your data…",
|
|
9
|
+
"ai.nlQuery.ask": "Ask",
|
|
10
|
+
"ai.nlQuery.results": "Results",
|
|
11
|
+
"ai.nlQuery.match": "{{percent}} match",
|
|
12
|
+
"ai.nlQuery.simulatedSummary": "Results for: {{query}}",
|
|
13
|
+
"ai.nlQuery.noResults": "No matching records found",
|
|
14
|
+
"ai.nlQuery.recentQueries": "Recent Queries",
|
|
15
|
+
"ai.formAssist.title": "AI Suggestions",
|
|
16
|
+
"ai.formAssist.suggestionCount": "{{count}} suggestions",
|
|
17
|
+
"ai.formAssist.suggestionCount_one": "{{count}} suggestion",
|
|
18
|
+
"ai.formAssist.suggestionCount_other": "{{count}} suggestions",
|
|
19
|
+
"ai.formAssist.applyAll": "Apply All",
|
|
20
|
+
"ai.formAssist.confidence": "{{percent}} confidence",
|
|
21
|
+
"ai.formAssist.appliedCount": "{{count}} suggestions applied",
|
|
22
|
+
"ai.formAssist.appliedCount_one": "{{count}} suggestion applied",
|
|
23
|
+
"ai.formAssist.appliedCount_other": "{{count}} suggestions applied",
|
|
24
|
+
"ai.recommendations.title": "Recommendations",
|
|
25
|
+
"ai.recommendations.generating": "Generating recommendations…",
|
|
26
|
+
"ai.recommendations.empty": "No recommendations available"
|
|
27
|
+
}, "ai.nlQuery.ask");
|
|
28
|
+
function k(e, t) {
|
|
29
|
+
return new Intl.NumberFormat(t, {
|
|
30
|
+
style: "percent",
|
|
31
|
+
maximumFractionDigits: 0
|
|
32
|
+
}).format(e);
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
6
35
|
//#region src/AIFormAssist.tsx
|
|
7
|
-
var
|
|
8
|
-
let {
|
|
9
|
-
c?.(e),
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
36
|
+
var A = ({ schema: e, onApply: c, onRefresh: l }) => {
|
|
37
|
+
let { t: d } = O(), f = w(), { suggestions: m = [], showConfidence: g = !0, showReasoning: v = !1 } = e, [y, b] = t(m), [x, C] = t(/* @__PURE__ */ new Set()), [T, A] = t(!1), [j, M] = t(!1), N = (e) => {
|
|
38
|
+
c?.(e), C((t) => new Set(t).add(e.fieldName));
|
|
39
|
+
}, P = () => {
|
|
40
|
+
y.forEach((e) => c?.(e)), C(new Set(y.map((e) => e.fieldName)));
|
|
41
|
+
}, F = (e) => {
|
|
42
|
+
b((t) => t.filter((t) => t.fieldName !== e));
|
|
43
|
+
}, I = () => {
|
|
44
|
+
M(!0), l && l(), setTimeout(() => M(!1), 1e3);
|
|
16
45
|
};
|
|
17
|
-
if (
|
|
18
|
-
let
|
|
19
|
-
return /* @__PURE__ */
|
|
46
|
+
if (T || y.length === 0) return null;
|
|
47
|
+
let L = y.filter((e) => !x.has(e.fieldName)), R = (e) => e >= .8 ? "text-green-600" : e >= .5 ? "text-yellow-600" : "text-red-600";
|
|
48
|
+
return /* @__PURE__ */ D(i, {
|
|
20
49
|
className: "border-blue-200 bg-blue-50/30",
|
|
21
|
-
children: [/* @__PURE__ */
|
|
50
|
+
children: [/* @__PURE__ */ E(o, {
|
|
22
51
|
className: "pb-2",
|
|
23
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ D("div", {
|
|
24
53
|
className: "flex items-center justify-between",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
54
|
+
children: [/* @__PURE__ */ D(s, {
|
|
26
55
|
className: "text-sm flex items-center gap-2",
|
|
27
56
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
"
|
|
30
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ E(_, { className: "h-4 w-4 text-blue-500" }),
|
|
58
|
+
d("ai.formAssist.title"),
|
|
59
|
+
/* @__PURE__ */ E(n, {
|
|
31
60
|
variant: "secondary",
|
|
32
61
|
className: "text-xs",
|
|
33
|
-
children:
|
|
34
|
-
N.length,
|
|
35
|
-
" suggestion",
|
|
36
|
-
N.length === 1 ? "" : "s"
|
|
37
|
-
]
|
|
62
|
+
children: d("ai.formAssist.suggestionCount", { count: L.length })
|
|
38
63
|
})
|
|
39
64
|
]
|
|
40
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ D("div", {
|
|
41
66
|
className: "flex items-center gap-1",
|
|
42
67
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ E(r, {
|
|
44
69
|
variant: "ghost",
|
|
45
70
|
size: "sm",
|
|
46
|
-
onClick:
|
|
47
|
-
disabled:
|
|
71
|
+
onClick: I,
|
|
72
|
+
disabled: j,
|
|
48
73
|
className: "h-7",
|
|
49
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ E(h, { className: `h-3 w-3 ${j ? "animate-spin" : ""}` })
|
|
50
75
|
}),
|
|
51
|
-
|
|
76
|
+
L.length > 1 && /* @__PURE__ */ E(r, {
|
|
52
77
|
variant: "outline",
|
|
53
78
|
size: "sm",
|
|
54
|
-
onClick:
|
|
79
|
+
onClick: P,
|
|
55
80
|
className: "h-7 text-xs",
|
|
56
|
-
children: "
|
|
81
|
+
children: d("ai.formAssist.applyAll")
|
|
57
82
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ E(r, {
|
|
59
84
|
variant: "ghost",
|
|
60
85
|
size: "sm",
|
|
61
|
-
onClick: () =>
|
|
86
|
+
onClick: () => A(!0),
|
|
62
87
|
className: "h-7",
|
|
63
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ E(S, { className: "h-3 w-3" })
|
|
64
89
|
})
|
|
65
90
|
]
|
|
66
91
|
})]
|
|
67
92
|
})
|
|
68
|
-
}), /* @__PURE__ */
|
|
93
|
+
}), /* @__PURE__ */ D(a, {
|
|
69
94
|
className: "space-y-2 pt-0",
|
|
70
|
-
children: [
|
|
95
|
+
children: [L.map((e) => /* @__PURE__ */ D("div", {
|
|
71
96
|
className: "flex items-center gap-3 p-2 rounded-md bg-white border text-sm",
|
|
72
97
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ E(p, { className: "h-4 w-4 text-yellow-500 shrink-0" }),
|
|
99
|
+
/* @__PURE__ */ D("div", {
|
|
75
100
|
className: "flex-1 min-w-0",
|
|
76
101
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ D("div", {
|
|
78
103
|
className: "flex items-center gap-2",
|
|
79
104
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ E("span", {
|
|
81
106
|
className: "font-medium",
|
|
82
107
|
children: e.fieldName
|
|
83
108
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ E("span", {
|
|
85
110
|
className: "text-muted-foreground",
|
|
86
111
|
children: "→"
|
|
87
112
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ E("span", {
|
|
89
114
|
className: "font-mono text-blue-600 truncate",
|
|
90
115
|
children: typeof e.value == "object" ? JSON.stringify(e.value) : String(e.value)
|
|
91
116
|
})
|
|
92
117
|
]
|
|
93
118
|
}),
|
|
94
|
-
|
|
95
|
-
className: `text-xs ${
|
|
96
|
-
children:
|
|
119
|
+
g && /* @__PURE__ */ E("div", {
|
|
120
|
+
className: `text-xs ${R(e.confidence)}`,
|
|
121
|
+
children: d("ai.formAssist.confidence", { percent: k(e.confidence, f) })
|
|
97
122
|
}),
|
|
98
|
-
|
|
123
|
+
v && e.reasoning && /* @__PURE__ */ E("div", {
|
|
99
124
|
className: "text-xs text-muted-foreground mt-1",
|
|
100
125
|
children: e.reasoning
|
|
101
126
|
})
|
|
102
127
|
]
|
|
103
128
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ D("div", {
|
|
105
130
|
className: "flex items-center gap-1 shrink-0",
|
|
106
|
-
children: [/* @__PURE__ */
|
|
131
|
+
children: [/* @__PURE__ */ E(r, {
|
|
107
132
|
variant: "ghost",
|
|
108
133
|
size: "sm",
|
|
109
134
|
className: "h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",
|
|
110
|
-
onClick: () =>
|
|
111
|
-
children: /* @__PURE__ */
|
|
112
|
-
}), /* @__PURE__ */
|
|
135
|
+
onClick: () => N(e),
|
|
136
|
+
children: /* @__PURE__ */ E(u, { className: "h-3.5 w-3.5" })
|
|
137
|
+
}), /* @__PURE__ */ E(r, {
|
|
113
138
|
variant: "ghost",
|
|
114
139
|
size: "sm",
|
|
115
140
|
className: "h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
116
|
-
onClick: () =>
|
|
117
|
-
children: /* @__PURE__ */
|
|
141
|
+
onClick: () => F(e.fieldName),
|
|
142
|
+
children: /* @__PURE__ */ E(S, { className: "h-3.5 w-3.5" })
|
|
118
143
|
})]
|
|
119
144
|
})
|
|
120
145
|
]
|
|
121
|
-
}, e.fieldName)),
|
|
146
|
+
}, e.fieldName)), x.size > 0 && /* @__PURE__ */ D("div", {
|
|
122
147
|
className: "text-xs text-green-600 flex items-center gap-1 pt-1",
|
|
123
|
-
children: [
|
|
124
|
-
/* @__PURE__ */ w(u, { className: "h-3 w-3" }),
|
|
125
|
-
b.size,
|
|
126
|
-
" suggestion",
|
|
127
|
-
b.size === 1 ? "" : "s",
|
|
128
|
-
" applied"
|
|
129
|
-
]
|
|
148
|
+
children: [/* @__PURE__ */ E(u, { className: "h-3 w-3" }), d("ai.formAssist.appliedCount", { count: x.size })]
|
|
130
149
|
})]
|
|
131
150
|
})]
|
|
132
151
|
});
|
|
133
|
-
},
|
|
134
|
-
let {
|
|
152
|
+
}, j = ({ schema: e, onSelect: t, onDismiss: c }) => {
|
|
153
|
+
let { t: l } = O(), u = w(), { recommendations: d = [], showScores: p = !1, layout: m = "list", loading: h = !1, emptyMessage: g = l("ai.recommendations.empty") } = e, y = (e) => {
|
|
135
154
|
t?.(e);
|
|
136
|
-
},
|
|
155
|
+
}, C = (e) => {
|
|
137
156
|
c?.(e);
|
|
138
157
|
};
|
|
139
|
-
if (
|
|
158
|
+
if (h) return /* @__PURE__ */ E(i, { children: /* @__PURE__ */ D(a, {
|
|
140
159
|
className: "p-8 text-center",
|
|
141
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ E(_, { className: "h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse" }), /* @__PURE__ */ E("p", {
|
|
142
161
|
className: "text-sm text-muted-foreground",
|
|
143
|
-
children: "
|
|
162
|
+
children: l("ai.recommendations.generating")
|
|
144
163
|
})]
|
|
145
164
|
}) });
|
|
146
|
-
if (
|
|
165
|
+
if (d.length === 0) return /* @__PURE__ */ E(i, { children: /* @__PURE__ */ E(a, {
|
|
147
166
|
className: "p-8 text-center text-muted-foreground",
|
|
148
|
-
children:
|
|
167
|
+
children: g
|
|
149
168
|
}) });
|
|
150
|
-
let
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
children: [t, "%"]
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
|
-
return /* @__PURE__ */ T(i, { children: [/* @__PURE__ */ w(o, { children: /* @__PURE__ */ T(s, {
|
|
169
|
+
let T = (e) => p ? /* @__PURE__ */ E(n, {
|
|
170
|
+
variant: e >= .7 ? "default" : e >= .4 ? "secondary" : "outline",
|
|
171
|
+
className: "text-xs",
|
|
172
|
+
children: k(e, u)
|
|
173
|
+
}) : null;
|
|
174
|
+
return /* @__PURE__ */ D(i, { children: [/* @__PURE__ */ E(o, { children: /* @__PURE__ */ D(s, {
|
|
160
175
|
className: "flex items-center gap-2 text-sm",
|
|
161
176
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
"
|
|
164
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ E(_, { className: "h-4 w-4 text-blue-500" }),
|
|
178
|
+
l("ai.recommendations.title"),
|
|
179
|
+
/* @__PURE__ */ E(n, {
|
|
165
180
|
variant: "secondary",
|
|
166
181
|
className: "text-xs",
|
|
167
|
-
children:
|
|
182
|
+
children: d.length
|
|
168
183
|
})
|
|
169
184
|
]
|
|
170
|
-
}) }), /* @__PURE__ */
|
|
185
|
+
}) }), /* @__PURE__ */ E(a, { children: m === "grid" ? /* @__PURE__ */ E("div", {
|
|
171
186
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",
|
|
172
|
-
children:
|
|
187
|
+
children: d.map((e) => /* @__PURE__ */ E(i, {
|
|
173
188
|
className: "cursor-pointer hover:shadow-md transition-shadow",
|
|
174
|
-
onClick: () =>
|
|
175
|
-
children: /* @__PURE__ */
|
|
189
|
+
onClick: () => y(e),
|
|
190
|
+
children: /* @__PURE__ */ D(a, {
|
|
176
191
|
className: "p-4",
|
|
177
192
|
children: [
|
|
178
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ D("div", {
|
|
179
194
|
className: "flex items-start justify-between mb-2",
|
|
180
|
-
children: [/* @__PURE__ */
|
|
195
|
+
children: [/* @__PURE__ */ E(v, { className: "h-4 w-4 text-yellow-500" }), T(e.score)]
|
|
181
196
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ E("h4", {
|
|
183
198
|
className: "font-medium text-sm mb-1",
|
|
184
199
|
children: e.title
|
|
185
200
|
}),
|
|
186
|
-
e.description && /* @__PURE__ */
|
|
201
|
+
e.description && /* @__PURE__ */ E("p", {
|
|
187
202
|
className: "text-xs text-muted-foreground line-clamp-3",
|
|
188
203
|
children: e.description
|
|
189
204
|
}),
|
|
190
|
-
e.category && /* @__PURE__ */
|
|
205
|
+
e.category && /* @__PURE__ */ E(n, {
|
|
191
206
|
variant: "outline",
|
|
192
207
|
className: "text-xs mt-2",
|
|
193
208
|
children: e.category
|
|
194
209
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ D("div", {
|
|
196
211
|
className: "flex items-center gap-1 mt-3",
|
|
197
|
-
children: [/* @__PURE__ */
|
|
212
|
+
children: [/* @__PURE__ */ E(r, {
|
|
198
213
|
variant: "ghost",
|
|
199
214
|
size: "sm",
|
|
200
215
|
className: "h-6 w-6 p-0 text-green-600",
|
|
201
|
-
children: /* @__PURE__ */
|
|
202
|
-
}), /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ E(x, { className: "h-3 w-3" })
|
|
217
|
+
}), /* @__PURE__ */ E(r, {
|
|
203
218
|
variant: "ghost",
|
|
204
219
|
size: "sm",
|
|
205
220
|
className: "h-6 w-6 p-0 text-red-500",
|
|
206
|
-
children: /* @__PURE__ */
|
|
221
|
+
children: /* @__PURE__ */ E(b, { className: "h-3 w-3" })
|
|
207
222
|
})]
|
|
208
223
|
})
|
|
209
224
|
]
|
|
210
225
|
})
|
|
211
226
|
}, e.id))
|
|
212
|
-
}) : /* @__PURE__ */
|
|
227
|
+
}) : /* @__PURE__ */ E("div", {
|
|
213
228
|
className: "space-y-2",
|
|
214
|
-
children:
|
|
229
|
+
children: d.map((e) => /* @__PURE__ */ D("div", {
|
|
215
230
|
className: "flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",
|
|
216
|
-
onClick: () =>
|
|
231
|
+
onClick: () => y(e),
|
|
217
232
|
children: [
|
|
218
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ E("div", {
|
|
219
234
|
className: "mt-1 shrink-0",
|
|
220
|
-
children: /* @__PURE__ */
|
|
235
|
+
children: /* @__PURE__ */ E(v, { className: "h-4 w-4 text-yellow-500" })
|
|
221
236
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ D("div", {
|
|
223
238
|
className: "flex-1 min-w-0",
|
|
224
|
-
children: [/* @__PURE__ */
|
|
239
|
+
children: [/* @__PURE__ */ D("div", {
|
|
225
240
|
className: "flex items-center gap-2 mb-1",
|
|
226
241
|
children: [
|
|
227
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ E("span", {
|
|
228
243
|
className: "font-medium text-sm",
|
|
229
244
|
children: e.title
|
|
230
245
|
}),
|
|
231
|
-
e.category && /* @__PURE__ */
|
|
246
|
+
e.category && /* @__PURE__ */ E(n, {
|
|
232
247
|
variant: "outline",
|
|
233
248
|
className: "text-xs",
|
|
234
249
|
children: e.category
|
|
235
250
|
}),
|
|
236
|
-
|
|
251
|
+
T(e.score)
|
|
237
252
|
]
|
|
238
|
-
}), e.description && /* @__PURE__ */
|
|
253
|
+
}), e.description && /* @__PURE__ */ E("p", {
|
|
239
254
|
className: "text-xs text-muted-foreground line-clamp-2",
|
|
240
255
|
children: e.description
|
|
241
256
|
})]
|
|
242
257
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ D("div", {
|
|
244
259
|
className: "flex items-center gap-1 shrink-0",
|
|
245
|
-
children: [e.action && /* @__PURE__ */
|
|
260
|
+
children: [e.action && /* @__PURE__ */ E(r, {
|
|
246
261
|
variant: "ghost",
|
|
247
262
|
size: "sm",
|
|
248
263
|
className: "h-7 w-7 p-0",
|
|
249
|
-
children: /* @__PURE__ */
|
|
250
|
-
}), /* @__PURE__ */
|
|
264
|
+
children: /* @__PURE__ */ E(f, { className: "h-3.5 w-3.5" })
|
|
265
|
+
}), /* @__PURE__ */ E(r, {
|
|
251
266
|
variant: "ghost",
|
|
252
267
|
size: "sm",
|
|
253
268
|
className: "h-7 w-7 p-0 text-muted-foreground",
|
|
254
269
|
onClick: (t) => {
|
|
255
|
-
t.stopPropagation(),
|
|
270
|
+
t.stopPropagation(), C(e);
|
|
256
271
|
},
|
|
257
|
-
children: /* @__PURE__ */
|
|
272
|
+
children: /* @__PURE__ */ E(S, { className: "h-3.5 w-3.5" })
|
|
258
273
|
})]
|
|
259
274
|
})
|
|
260
275
|
]
|
|
261
276
|
}, e.id))
|
|
262
277
|
}) })] });
|
|
263
|
-
},
|
|
264
|
-
let {
|
|
265
|
-
let t = e ||
|
|
266
|
-
t.trim() && (
|
|
267
|
-
|
|
278
|
+
}, M = ({ schema: e, onSubmit: u }) => {
|
|
279
|
+
let { t: f } = O(), p = w(), { placeholder: h = f("ai.nlQuery.placeholder"), result: v, suggestions: b = [], showHistory: x = !1, history: S = [], loading: C = !1 } = e, [A, j] = t(""), [M, N] = t(v), [P, F] = t(!1), I = P || C, L = (e) => {
|
|
280
|
+
let t = e || A;
|
|
281
|
+
t.trim() && (F(!0), u?.(t), u ? F(!1) : setTimeout(() => {
|
|
282
|
+
N({
|
|
268
283
|
query: t,
|
|
269
|
-
summary:
|
|
284
|
+
summary: f("ai.nlQuery.simulatedSummary", { query: t }),
|
|
270
285
|
confidence: .85,
|
|
271
286
|
data: [],
|
|
272
287
|
columns: []
|
|
273
|
-
}),
|
|
288
|
+
}), F(!1);
|
|
274
289
|
}, 1e3));
|
|
275
|
-
},
|
|
276
|
-
|
|
290
|
+
}, R = (e) => {
|
|
291
|
+
j(e), L(e);
|
|
277
292
|
};
|
|
278
|
-
return /* @__PURE__ */
|
|
293
|
+
return /* @__PURE__ */ D("div", {
|
|
279
294
|
className: "space-y-4",
|
|
280
295
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ E(i, { children: /* @__PURE__ */ D(a, {
|
|
282
297
|
className: "p-4",
|
|
283
|
-
children: [/* @__PURE__ */
|
|
298
|
+
children: [/* @__PURE__ */ E("div", {
|
|
284
299
|
className: "flex items-center gap-2",
|
|
285
|
-
children: /* @__PURE__ */
|
|
300
|
+
children: /* @__PURE__ */ D("div", {
|
|
286
301
|
className: "relative flex-1",
|
|
287
302
|
children: [
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
value:
|
|
291
|
-
onChange: (e) =>
|
|
292
|
-
onKeyDown: (e) => e.key === "Enter" &&
|
|
293
|
-
placeholder:
|
|
303
|
+
/* @__PURE__ */ E(g, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
304
|
+
/* @__PURE__ */ E(c, {
|
|
305
|
+
value: A,
|
|
306
|
+
onChange: (e) => j(e.target.value),
|
|
307
|
+
onKeyDown: (e) => e.key === "Enter" && L(),
|
|
308
|
+
placeholder: h,
|
|
294
309
|
className: "pl-10 pr-20",
|
|
295
|
-
disabled:
|
|
310
|
+
disabled: I
|
|
296
311
|
}),
|
|
297
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ E("div", {
|
|
298
313
|
className: "absolute right-2 top-1/2 -translate-y-1/2",
|
|
299
|
-
children: /* @__PURE__ */
|
|
314
|
+
children: /* @__PURE__ */ E(r, {
|
|
300
315
|
size: "sm",
|
|
301
|
-
onClick: () =>
|
|
302
|
-
disabled:
|
|
316
|
+
onClick: () => L(),
|
|
317
|
+
disabled: I || !A.trim(),
|
|
303
318
|
className: "h-7",
|
|
304
|
-
children:
|
|
319
|
+
children: I ? /* @__PURE__ */ E(m, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(_, { className: "h-3.5 w-3.5 mr-1" }), f("ai.nlQuery.ask")] })
|
|
305
320
|
})
|
|
306
321
|
})
|
|
307
322
|
]
|
|
308
323
|
})
|
|
309
|
-
}),
|
|
324
|
+
}), b.length > 0 && !M && /* @__PURE__ */ E("div", {
|
|
310
325
|
className: "mt-3 flex flex-wrap gap-2",
|
|
311
|
-
children:
|
|
326
|
+
children: b.map((e, t) => /* @__PURE__ */ E("button", {
|
|
312
327
|
type: "button",
|
|
313
|
-
onClick: () =>
|
|
328
|
+
onClick: () => R(e),
|
|
314
329
|
className: "text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
|
|
315
|
-
disabled:
|
|
330
|
+
disabled: I,
|
|
316
331
|
children: e
|
|
317
332
|
}, t))
|
|
318
333
|
})]
|
|
319
334
|
}) }),
|
|
320
|
-
|
|
335
|
+
M && /* @__PURE__ */ D(i, { children: [/* @__PURE__ */ E(o, {
|
|
321
336
|
className: "pb-2",
|
|
322
|
-
children: /* @__PURE__ */
|
|
337
|
+
children: /* @__PURE__ */ D("div", {
|
|
323
338
|
className: "flex items-center justify-between",
|
|
324
|
-
children: [/* @__PURE__ */
|
|
339
|
+
children: [/* @__PURE__ */ D(s, {
|
|
325
340
|
className: "text-sm flex items-center gap-2",
|
|
326
|
-
children: [/* @__PURE__ */
|
|
327
|
-
}),
|
|
328
|
-
variant:
|
|
341
|
+
children: [/* @__PURE__ */ E(y, { className: "h-4 w-4" }), f("ai.nlQuery.results")]
|
|
342
|
+
}), M.confidence !== void 0 && /* @__PURE__ */ E(n, {
|
|
343
|
+
variant: M.confidence >= .7 ? "default" : "secondary",
|
|
329
344
|
className: "text-xs",
|
|
330
|
-
children:
|
|
345
|
+
children: f("ai.nlQuery.match", { percent: k(M.confidence, p) })
|
|
331
346
|
})]
|
|
332
347
|
})
|
|
333
|
-
}), /* @__PURE__ */
|
|
334
|
-
|
|
348
|
+
}), /* @__PURE__ */ D(a, { children: [
|
|
349
|
+
M.summary && /* @__PURE__ */ E("p", {
|
|
335
350
|
className: "text-sm text-muted-foreground mb-3",
|
|
336
|
-
children:
|
|
351
|
+
children: M.summary
|
|
337
352
|
}),
|
|
338
|
-
|
|
353
|
+
M.data && M.data.length > 0 && M.columns && /* @__PURE__ */ E("div", {
|
|
339
354
|
className: "border rounded-lg overflow-hidden",
|
|
340
|
-
children: /* @__PURE__ */
|
|
355
|
+
children: /* @__PURE__ */ D("table", {
|
|
341
356
|
className: "w-full text-sm",
|
|
342
|
-
children: [/* @__PURE__ */
|
|
357
|
+
children: [/* @__PURE__ */ E("thead", {
|
|
343
358
|
className: "bg-muted",
|
|
344
|
-
children: /* @__PURE__ */
|
|
359
|
+
children: /* @__PURE__ */ E("tr", { children: M.columns.map((e, t) => /* @__PURE__ */ E("th", {
|
|
345
360
|
className: "px-4 py-2 text-left font-medium",
|
|
346
361
|
children: e.label || e.name
|
|
347
362
|
}, t)) })
|
|
348
|
-
}), /* @__PURE__ */
|
|
363
|
+
}), /* @__PURE__ */ E("tbody", { children: M.data.map((e, t) => /* @__PURE__ */ E("tr", {
|
|
349
364
|
className: "border-t",
|
|
350
|
-
children:
|
|
365
|
+
children: M.columns.map((t, n) => /* @__PURE__ */ E("td", {
|
|
351
366
|
className: "px-4 py-2",
|
|
352
367
|
children: String(e[t.name] ?? "")
|
|
353
368
|
}, n))
|
|
354
369
|
}, t)) })]
|
|
355
370
|
})
|
|
356
371
|
}),
|
|
357
|
-
(!
|
|
372
|
+
(!M.data || M.data.length === 0) && /* @__PURE__ */ E("div", {
|
|
358
373
|
className: "text-center py-6 text-muted-foreground text-sm",
|
|
359
|
-
children: "
|
|
374
|
+
children: f("ai.nlQuery.noResults")
|
|
360
375
|
})
|
|
361
376
|
] })] }),
|
|
362
|
-
|
|
377
|
+
x && S.length > 0 && /* @__PURE__ */ D(i, { children: [/* @__PURE__ */ E(o, {
|
|
363
378
|
className: "pb-2",
|
|
364
|
-
children: /* @__PURE__ */
|
|
379
|
+
children: /* @__PURE__ */ D(s, {
|
|
365
380
|
className: "text-xs text-muted-foreground flex items-center gap-1",
|
|
366
|
-
children: [/* @__PURE__ */
|
|
381
|
+
children: [/* @__PURE__ */ E(d, { className: "h-3 w-3" }), f("ai.nlQuery.recentQueries")]
|
|
367
382
|
})
|
|
368
|
-
}), /* @__PURE__ */
|
|
383
|
+
}), /* @__PURE__ */ E(a, {
|
|
369
384
|
className: "space-y-1",
|
|
370
|
-
children:
|
|
385
|
+
children: S.slice(0, 5).map((e, t) => /* @__PURE__ */ D("button", {
|
|
371
386
|
type: "button",
|
|
372
|
-
onClick: () =>
|
|
387
|
+
onClick: () => R(e.query),
|
|
373
388
|
className: "w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",
|
|
374
389
|
children: [
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ E(l, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
391
|
+
/* @__PURE__ */ E("span", {
|
|
377
392
|
className: "truncate",
|
|
378
393
|
children: e.query
|
|
379
394
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ E("span", {
|
|
381
396
|
className: "text-xs text-muted-foreground shrink-0 ml-auto",
|
|
382
|
-
children: new Date(e.timestamp).toLocaleDateString()
|
|
397
|
+
children: new Date(e.timestamp).toLocaleDateString(p)
|
|
383
398
|
})
|
|
384
399
|
]
|
|
385
400
|
}, t))
|
|
@@ -387,127 +402,68 @@ var E = ({ schema: e, onApply: c, onRefresh: l }) => {
|
|
|
387
402
|
]
|
|
388
403
|
});
|
|
389
404
|
};
|
|
390
|
-
e.register("ai-form-assist",
|
|
405
|
+
e.register("ai-form-assist", A, {
|
|
391
406
|
label: "AI Form Assist",
|
|
392
407
|
category: "AI",
|
|
393
408
|
inputs: [
|
|
394
|
-
{
|
|
395
|
-
name: "formId",
|
|
396
|
-
type: "string",
|
|
397
|
-
label: "Form ID"
|
|
398
|
-
},
|
|
399
|
-
{
|
|
400
|
-
name: "objectName",
|
|
401
|
-
type: "string",
|
|
402
|
-
label: "Object Name"
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
name: "fields",
|
|
406
|
-
type: "array",
|
|
407
|
-
label: "Fields to suggest"
|
|
408
|
-
},
|
|
409
409
|
{
|
|
410
410
|
name: "suggestions",
|
|
411
|
-
type: "code"
|
|
412
|
-
label: "Suggestions Data"
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: "autoFill",
|
|
416
|
-
type: "boolean",
|
|
417
|
-
label: "Auto Fill",
|
|
418
|
-
defaultValue: !1
|
|
411
|
+
type: "code"
|
|
419
412
|
},
|
|
420
413
|
{
|
|
421
414
|
name: "showConfidence",
|
|
422
|
-
type: "boolean"
|
|
423
|
-
label: "Show Confidence",
|
|
424
|
-
defaultValue: !0
|
|
415
|
+
type: "boolean"
|
|
425
416
|
},
|
|
426
417
|
{
|
|
427
418
|
name: "showReasoning",
|
|
428
|
-
type: "boolean"
|
|
429
|
-
label: "Show Reasoning",
|
|
430
|
-
defaultValue: !1
|
|
419
|
+
type: "boolean"
|
|
431
420
|
}
|
|
432
421
|
]
|
|
433
|
-
}), e.register("ai-recommendations",
|
|
422
|
+
}), e.register("ai-recommendations", j, {
|
|
434
423
|
label: "AI Recommendations",
|
|
435
424
|
category: "AI",
|
|
436
425
|
inputs: [
|
|
437
|
-
{
|
|
438
|
-
name: "objectName",
|
|
439
|
-
type: "string",
|
|
440
|
-
label: "Object Name"
|
|
441
|
-
},
|
|
442
426
|
{
|
|
443
427
|
name: "recommendations",
|
|
444
|
-
type: "code"
|
|
445
|
-
label: "Recommendations Data"
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
name: "maxResults",
|
|
449
|
-
type: "number",
|
|
450
|
-
label: "Max Results",
|
|
451
|
-
defaultValue: 10
|
|
428
|
+
type: "code"
|
|
452
429
|
},
|
|
453
430
|
{
|
|
454
431
|
name: "showScores",
|
|
455
|
-
type: "boolean"
|
|
456
|
-
label: "Show Scores",
|
|
457
|
-
defaultValue: !1
|
|
432
|
+
type: "boolean"
|
|
458
433
|
},
|
|
459
434
|
{
|
|
460
435
|
name: "layout",
|
|
461
436
|
type: "enum",
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
label: "Grid",
|
|
470
|
-
value: "grid"
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
label: "Carousel",
|
|
474
|
-
value: "carousel"
|
|
475
|
-
}
|
|
476
|
-
],
|
|
477
|
-
defaultValue: "list"
|
|
437
|
+
enum: [{
|
|
438
|
+
label: "List",
|
|
439
|
+
value: "list"
|
|
440
|
+
}, {
|
|
441
|
+
label: "Grid",
|
|
442
|
+
value: "grid"
|
|
443
|
+
}]
|
|
478
444
|
},
|
|
479
445
|
{
|
|
480
446
|
name: "emptyMessage",
|
|
481
|
-
type: "string"
|
|
482
|
-
label: "Empty Message"
|
|
447
|
+
type: "string"
|
|
483
448
|
}
|
|
484
449
|
]
|
|
485
|
-
}), e.register("nl-query",
|
|
450
|
+
}), e.register("nl-query", M, {
|
|
486
451
|
label: "Natural Language Query",
|
|
487
452
|
category: "AI",
|
|
488
453
|
inputs: [
|
|
489
|
-
{
|
|
490
|
-
name: "objectName",
|
|
491
|
-
type: "string",
|
|
492
|
-
label: "Object Name"
|
|
493
|
-
},
|
|
494
454
|
{
|
|
495
455
|
name: "placeholder",
|
|
496
|
-
type: "string"
|
|
497
|
-
label: "Placeholder Text"
|
|
456
|
+
type: "string"
|
|
498
457
|
},
|
|
499
458
|
{
|
|
500
459
|
name: "suggestions",
|
|
501
|
-
type: "array"
|
|
502
|
-
label: "Example Queries"
|
|
460
|
+
type: "array"
|
|
503
461
|
},
|
|
504
462
|
{
|
|
505
463
|
name: "showHistory",
|
|
506
|
-
type: "boolean"
|
|
507
|
-
label: "Show History",
|
|
508
|
-
defaultValue: !1
|
|
464
|
+
type: "boolean"
|
|
509
465
|
}
|
|
510
466
|
]
|
|
511
467
|
});
|
|
512
468
|
//#endregion
|
|
513
|
-
export {
|
|
469
|
+
export { A as AIFormAssist, j as AIRecommendations, M as NLQueryInput };
|