@aivue/tabular-intelligence 1.3.7 → 1.3.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/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +230 -225
- package/dist/index.mjs.map +1 -1
- package/dist/utils/qaEngine.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ref as D, defineComponent as U, createElementBlock as p, openBlock as g, createElementVNode as h, createCommentVNode as q, withDirectives as ee, withKeys as L, withModifiers as H, vModelText as te, toDisplayString as k, normalizeClass as ne, createTextVNode as se, Fragment as Q, renderList as j, computed as
|
|
2
|
-
function N(
|
|
3
|
-
if (
|
|
1
|
+
import { ref as D, defineComponent as U, createElementBlock as p, openBlock as g, createElementVNode as h, createCommentVNode as q, withDirectives as ee, withKeys as L, withModifiers as H, vModelText as te, toDisplayString as k, normalizeClass as ne, createTextVNode as se, Fragment as Q, renderList as j, computed as re } from "vue";
|
|
2
|
+
function N(l, e) {
|
|
3
|
+
if (l.length === 0)
|
|
4
4
|
return { columns: [], rowCount: 0, name: e };
|
|
5
|
-
const t =
|
|
5
|
+
const t = l[0];
|
|
6
6
|
return {
|
|
7
7
|
columns: Object.keys(t).map((s) => {
|
|
8
|
-
const
|
|
8
|
+
const r = O(l, s);
|
|
9
9
|
return {
|
|
10
10
|
name: s,
|
|
11
|
-
type:
|
|
12
|
-
nullable:
|
|
11
|
+
type: r,
|
|
12
|
+
nullable: l.some((o) => o[s] == null)
|
|
13
13
|
};
|
|
14
14
|
}),
|
|
15
|
-
rowCount:
|
|
15
|
+
rowCount: l.length,
|
|
16
16
|
name: e
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function O(
|
|
20
|
-
const t =
|
|
19
|
+
function O(l, e) {
|
|
20
|
+
const t = l.map((s) => s[e]).filter((s) => s != null);
|
|
21
21
|
if (t.length === 0) return "string";
|
|
22
22
|
if (t.every((s) => typeof s == "number" || !isNaN(Number(s))))
|
|
23
23
|
return "number";
|
|
@@ -28,18 +28,18 @@ function O(c, e) {
|
|
|
28
28
|
const n = new Set(t);
|
|
29
29
|
return n.size < t.length * 0.5 && n.size < 20 ? "categorical" : "string";
|
|
30
30
|
}
|
|
31
|
-
function J(
|
|
32
|
-
const n =
|
|
31
|
+
function J(l, e, t) {
|
|
32
|
+
const n = l.map((a) => a[e]).filter((a) => a != null), s = n.length, r = l.length - s, o = {
|
|
33
33
|
column: e,
|
|
34
34
|
count: s,
|
|
35
|
-
nullCount:
|
|
35
|
+
nullCount: r
|
|
36
36
|
};
|
|
37
37
|
if (t === "number") {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
const i = [...
|
|
41
|
-
o.mean =
|
|
42
|
-
const w =
|
|
38
|
+
const a = n.map(Number).filter((i) => !isNaN(i));
|
|
39
|
+
if (a.length > 0) {
|
|
40
|
+
const i = [...a].sort((f, d) => f - d), c = a.reduce((f, d) => f + d, 0);
|
|
41
|
+
o.mean = c / a.length, o.median = i[Math.floor(i.length / 2)], o.min = i[0], o.max = i[i.length - 1];
|
|
42
|
+
const w = a.reduce((f, d) => f + Math.pow(d - o.mean, 2), 0) / a.length;
|
|
43
43
|
o.std = Math.sqrt(w), o.percentiles = {
|
|
44
44
|
25: i[Math.floor(i.length * 0.25)],
|
|
45
45
|
50: o.median,
|
|
@@ -48,37 +48,37 @@ function J(c, e, t) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
} else {
|
|
51
|
-
const
|
|
52
|
-
o.uniqueValues =
|
|
51
|
+
const a = new Set(n);
|
|
52
|
+
o.uniqueValues = a.size;
|
|
53
53
|
const i = {};
|
|
54
54
|
n.forEach((w) => {
|
|
55
55
|
const f = String(w);
|
|
56
56
|
i[f] = (i[f] || 0) + 1;
|
|
57
57
|
});
|
|
58
|
-
const
|
|
59
|
-
o.mode = Object.keys(i).find((w) => i[w] ===
|
|
58
|
+
const c = Math.max(...Object.values(i));
|
|
59
|
+
o.mode = Object.keys(i).find((w) => i[w] === c);
|
|
60
60
|
}
|
|
61
61
|
return o;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function ae(l, e, t = 0.5) {
|
|
64
64
|
const n = [], s = 1.5 + (1 - t) * 1.5;
|
|
65
|
-
return e.forEach((
|
|
66
|
-
const o =
|
|
65
|
+
return e.forEach((r) => {
|
|
66
|
+
const o = l.map((y, A) => ({ value: Number(y[r]), idx: A })).filter((y) => !isNaN(y.value));
|
|
67
67
|
if (o.length === 0) return;
|
|
68
|
-
const
|
|
68
|
+
const a = [...o].sort((y, A) => y.value - A.value), i = a[Math.floor(a.length * 0.25)].value, c = a[Math.floor(a.length * 0.75)].value, w = c - i, f = i - s * w, d = c + s * w;
|
|
69
69
|
o.forEach(({ value: y, idx: A }) => {
|
|
70
70
|
if (y < f || y > d) {
|
|
71
|
-
const _ = n.find((T) => T.rowIndex === A), x = y < f ? `${
|
|
72
|
-
_ ? (_.reasons.push(x), _.affectedColumns.push(
|
|
71
|
+
const _ = n.find((T) => T.rowIndex === A), x = y < f ? `${r}: ${y.toFixed(2)} < ${f.toFixed(2)}` : `${r}: ${y.toFixed(2)} > ${d.toFixed(2)}`;
|
|
72
|
+
_ ? (_.reasons.push(x), _.affectedColumns.push(r), _.score = Math.min(1, _.score + 0.2)) : n.push({
|
|
73
73
|
rowIndex: A,
|
|
74
|
-
row:
|
|
74
|
+
row: l[A],
|
|
75
75
|
score: 0.7,
|
|
76
76
|
reasons: [x],
|
|
77
|
-
affectedColumns: [
|
|
77
|
+
affectedColumns: [r]
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
-
}), n.sort((
|
|
81
|
+
}), n.sort((r, o) => o.score - r.score);
|
|
82
82
|
}
|
|
83
83
|
class B {
|
|
84
84
|
constructor(e) {
|
|
@@ -94,9 +94,12 @@ class B {
|
|
|
94
94
|
async answerQuestion(e) {
|
|
95
95
|
const t = Date.now();
|
|
96
96
|
try {
|
|
97
|
-
const { question: n, schema: s, data:
|
|
97
|
+
const { question: n, schema: s, data: r, sampleSize: o = 100, includeAggregates: a = !0 } = e;
|
|
98
|
+
if (!r || !Array.isArray(r) || r.length === 0)
|
|
99
|
+
throw new Error("No data available. Please load data first.");
|
|
100
|
+
const i = r.length > o ? this.sampleData(r, o) : r, c = a ? this.calculateAggregates(r, s) : void 0, w = this.buildPrompt(n, s, i, c, r.length), f = await this.callLLM(w);
|
|
98
101
|
return {
|
|
99
|
-
answer: this.parseResponse(f, n,
|
|
102
|
+
answer: this.parseResponse(f, n, r.length > o),
|
|
100
103
|
processingTime: Date.now() - t
|
|
101
104
|
};
|
|
102
105
|
} catch (n) {
|
|
@@ -117,11 +120,13 @@ class B {
|
|
|
117
120
|
* Sample data for large datasets
|
|
118
121
|
*/
|
|
119
122
|
sampleData(e, t) {
|
|
123
|
+
if (!e || !Array.isArray(e) || e.length === 0)
|
|
124
|
+
return [];
|
|
120
125
|
if (e.length <= t)
|
|
121
126
|
return e;
|
|
122
127
|
const n = Math.floor(e.length / t), s = [];
|
|
123
|
-
for (let
|
|
124
|
-
s.push(e[
|
|
128
|
+
for (let r = 0; r < e.length && s.length < t; r += n)
|
|
129
|
+
s.push(e[r]);
|
|
125
130
|
return s;
|
|
126
131
|
}
|
|
127
132
|
/**
|
|
@@ -129,27 +134,27 @@ class B {
|
|
|
129
134
|
*/
|
|
130
135
|
calculateAggregates(e, t) {
|
|
131
136
|
const n = {};
|
|
132
|
-
if (!t || !t.columns || !Array.isArray(t.columns))
|
|
137
|
+
if (!e || !Array.isArray(e) || e.length === 0 || !t || !t.columns || !Array.isArray(t.columns))
|
|
133
138
|
return n;
|
|
134
139
|
for (const s of t.columns)
|
|
135
140
|
if (s.type === "number" && e.length > 0)
|
|
136
141
|
try {
|
|
137
|
-
const
|
|
142
|
+
const r = J(e, s.name, "number");
|
|
138
143
|
n[s.name] = {
|
|
139
|
-
mean:
|
|
140
|
-
median:
|
|
141
|
-
min:
|
|
142
|
-
max:
|
|
143
|
-
count:
|
|
144
|
+
mean: r.mean,
|
|
145
|
+
median: r.median,
|
|
146
|
+
min: r.min,
|
|
147
|
+
max: r.max,
|
|
148
|
+
count: r.count
|
|
144
149
|
};
|
|
145
150
|
} catch {
|
|
146
151
|
}
|
|
147
152
|
else if (s.type === "categorical" || s.type === "string") {
|
|
148
|
-
const
|
|
153
|
+
const r = e.map((a) => a[s.name]).filter((a) => a != null), o = new Set(r);
|
|
149
154
|
n[s.name] = {
|
|
150
155
|
uniqueCount: o.size,
|
|
151
|
-
totalCount:
|
|
152
|
-
topValues: this.getTopValues(
|
|
156
|
+
totalCount: r.length,
|
|
157
|
+
topValues: this.getTopValues(r, 5)
|
|
153
158
|
};
|
|
154
159
|
}
|
|
155
160
|
return n;
|
|
@@ -161,57 +166,57 @@ class B {
|
|
|
161
166
|
const n = /* @__PURE__ */ new Map();
|
|
162
167
|
for (const s of e)
|
|
163
168
|
n.set(s, (n.get(s) || 0) + 1);
|
|
164
|
-
return Array.from(n.entries()).map(([s,
|
|
169
|
+
return Array.from(n.entries()).map(([s, r]) => ({ value: s, count: r })).sort((s, r) => r.count - s.count).slice(0, t);
|
|
165
170
|
}
|
|
166
171
|
/**
|
|
167
172
|
* Build prompt for LLM
|
|
168
173
|
*/
|
|
169
|
-
buildPrompt(e, t, n, s,
|
|
170
|
-
const o =
|
|
171
|
-
let
|
|
174
|
+
buildPrompt(e, t, n, s, r) {
|
|
175
|
+
const o = r && r > n.length;
|
|
176
|
+
let a = `You are a data analyst assistant. Answer the following question about a table dataset.
|
|
172
177
|
|
|
173
178
|
`;
|
|
174
|
-
|
|
175
|
-
`,
|
|
176
|
-
`,
|
|
179
|
+
a += `**Table Schema:**
|
|
180
|
+
`, a += `Table: ${t.name}
|
|
181
|
+
`, a += `Columns:
|
|
177
182
|
`;
|
|
178
183
|
for (const i of t.columns)
|
|
179
|
-
|
|
184
|
+
a += `- ${i.name} (${i.type})
|
|
180
185
|
`;
|
|
181
|
-
return
|
|
182
|
-
`, s && Object.keys(s).length > 0 && (
|
|
183
|
-
`,
|
|
186
|
+
return a += `
|
|
187
|
+
`, s && Object.keys(s).length > 0 && (a += `**Summary Statistics:**
|
|
188
|
+
`, a += JSON.stringify(s, null, 2), a += `
|
|
184
189
|
|
|
185
|
-
`),
|
|
186
|
-
`,
|
|
190
|
+
`), a += `**Sample Data** (${n.length} rows${o ? ` out of ${r} total` : ""}):
|
|
191
|
+
`, a += JSON.stringify(n.slice(0, 10), null, 2), a += `
|
|
187
192
|
|
|
188
|
-
`,
|
|
193
|
+
`, a += `**Question:** ${e}
|
|
189
194
|
|
|
190
|
-
`,
|
|
191
|
-
`,
|
|
192
|
-
`,
|
|
193
|
-
`,
|
|
194
|
-
`,
|
|
195
|
-
`,
|
|
196
|
-
`,
|
|
197
|
-
`,
|
|
198
|
-
`,
|
|
199
|
-
`,
|
|
200
|
-
`,
|
|
201
|
-
`,
|
|
202
|
-
`,
|
|
203
|
-
`,
|
|
204
|
-
`,
|
|
195
|
+
`, a += `**Instructions:**
|
|
196
|
+
`, a += `1. Answer ONLY based on the data provided above.
|
|
197
|
+
`, a += `2. If the question cannot be answered from the available data, clearly state "I cannot answer this question from the available data" and explain why.
|
|
198
|
+
`, a += `3. Provide a clear, concise answer.
|
|
199
|
+
`, a += `4. Include specific numbers or examples from the data when relevant.
|
|
200
|
+
`, a += `5. If the answer is based on sampled data, mention that it's an approximation.
|
|
201
|
+
`, a += `6. Format your response as JSON with the following structure:
|
|
202
|
+
`, a += `{
|
|
203
|
+
`, a += ` "answer": "Your answer text here",
|
|
204
|
+
`, a += ` "confidence": 0.0-1.0,
|
|
205
|
+
`, a += ` "cannotAnswer": false,
|
|
206
|
+
`, a += ` "isApproximate": ${o},
|
|
207
|
+
`, a += ` "supportingData": { "key": "value" } // optional
|
|
208
|
+
`, a += `}
|
|
209
|
+
`, a;
|
|
205
210
|
}
|
|
206
211
|
/**
|
|
207
212
|
* Call LLM API
|
|
208
213
|
*/
|
|
209
214
|
async callLLM(e) {
|
|
210
|
-
const { provider: t, apiKey: n, baseUrl: s, model:
|
|
215
|
+
const { provider: t, apiKey: n, baseUrl: s, model: r, maxTokens: o, temperature: a } = this.config;
|
|
211
216
|
if (t === "openai")
|
|
212
|
-
return this.callOpenAI(e, n,
|
|
217
|
+
return this.callOpenAI(e, n, r || "gpt-4-turbo-preview", o, a);
|
|
213
218
|
if (t === "anthropic")
|
|
214
|
-
return this.callAnthropic(e, n,
|
|
219
|
+
return this.callAnthropic(e, n, r || "claude-3-5-sonnet-20241022", o, a);
|
|
215
220
|
if (t === "custom" && s)
|
|
216
221
|
return this.callCustomAPI(e, s, n);
|
|
217
222
|
throw new Error(`Unsupported provider: ${t}`);
|
|
@@ -219,8 +224,8 @@ class B {
|
|
|
219
224
|
/**
|
|
220
225
|
* Call OpenAI API
|
|
221
226
|
*/
|
|
222
|
-
async callOpenAI(e, t, n, s,
|
|
223
|
-
var i,
|
|
227
|
+
async callOpenAI(e, t, n, s, r) {
|
|
228
|
+
var i, c;
|
|
224
229
|
const o = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
225
230
|
method: "POST",
|
|
226
231
|
headers: {
|
|
@@ -231,18 +236,18 @@ class B {
|
|
|
231
236
|
model: n,
|
|
232
237
|
messages: [{ role: "user", content: e }],
|
|
233
238
|
max_tokens: s,
|
|
234
|
-
temperature:
|
|
239
|
+
temperature: r,
|
|
235
240
|
response_format: { type: "json_object" }
|
|
236
241
|
})
|
|
237
242
|
});
|
|
238
243
|
if (!o.ok)
|
|
239
244
|
throw new Error(`OpenAI API error: ${o.statusText}`);
|
|
240
|
-
return ((
|
|
245
|
+
return ((c = (i = (await o.json()).choices[0]) == null ? void 0 : i.message) == null ? void 0 : c.content) || "";
|
|
241
246
|
}
|
|
242
247
|
/**
|
|
243
248
|
* Call Anthropic API
|
|
244
249
|
*/
|
|
245
|
-
async callAnthropic(e, t, n, s,
|
|
250
|
+
async callAnthropic(e, t, n, s, r) {
|
|
246
251
|
var i;
|
|
247
252
|
const o = await fetch("https://api.anthropic.com/v1/messages", {
|
|
248
253
|
method: "POST",
|
|
@@ -254,7 +259,7 @@ class B {
|
|
|
254
259
|
body: JSON.stringify({
|
|
255
260
|
model: n,
|
|
256
261
|
max_tokens: s,
|
|
257
|
-
temperature:
|
|
262
|
+
temperature: r,
|
|
258
263
|
messages: [{ role: "user", content: e }]
|
|
259
264
|
})
|
|
260
265
|
});
|
|
@@ -270,14 +275,14 @@ class B {
|
|
|
270
275
|
"Content-Type": "application/json"
|
|
271
276
|
};
|
|
272
277
|
n && (s.Authorization = `Bearer ${n}`);
|
|
273
|
-
const
|
|
278
|
+
const r = await fetch(t, {
|
|
274
279
|
method: "POST",
|
|
275
280
|
headers: s,
|
|
276
281
|
body: JSON.stringify({ prompt: e })
|
|
277
282
|
});
|
|
278
|
-
if (!
|
|
279
|
-
throw new Error(`Custom API error: ${
|
|
280
|
-
const o = await
|
|
283
|
+
if (!r.ok)
|
|
284
|
+
throw new Error(`Custom API error: ${r.statusText}`);
|
|
285
|
+
const o = await r.json();
|
|
281
286
|
return o.response || o.answer || JSON.stringify(o);
|
|
282
287
|
}
|
|
283
288
|
/**
|
|
@@ -313,34 +318,34 @@ class B {
|
|
|
313
318
|
return `qa_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
|
-
function oe(
|
|
321
|
+
function oe(l = {}) {
|
|
317
322
|
const {
|
|
318
323
|
selector: e = "table",
|
|
319
324
|
includeHeaders: t = !0,
|
|
320
325
|
maxRows: n,
|
|
321
326
|
inferTypes: s = !0,
|
|
322
|
-
skipEmptyRows:
|
|
323
|
-
} =
|
|
327
|
+
skipEmptyRows: r = !0
|
|
328
|
+
} = l, o = document.querySelector(e);
|
|
324
329
|
if (!o || o.tagName !== "TABLE")
|
|
325
330
|
return console.warn(`No table found with selector: ${e}`), null;
|
|
326
331
|
const i = Array.from(o.rows);
|
|
327
332
|
if (i.length === 0)
|
|
328
333
|
return null;
|
|
329
|
-
let
|
|
334
|
+
let c = [], w = 0;
|
|
330
335
|
if (t && i[0]) {
|
|
331
336
|
const A = i[0];
|
|
332
|
-
|
|
337
|
+
c = Array.from(A.cells).map((_, x) => {
|
|
333
338
|
var E;
|
|
334
339
|
return ((E = _.textContent) == null ? void 0 : E.trim()) || "" || `Column${x + 1}`;
|
|
335
340
|
}), w = 1;
|
|
336
341
|
} else {
|
|
337
342
|
const A = i[0];
|
|
338
|
-
|
|
343
|
+
c = Array.from(A.cells).map((_, x) => `Column${x + 1}`);
|
|
339
344
|
}
|
|
340
345
|
const f = [], d = n ? i.slice(w, w + n) : i.slice(w);
|
|
341
346
|
for (const A of d) {
|
|
342
347
|
const _ = Array.from(A.cells);
|
|
343
|
-
if (
|
|
348
|
+
if (r && _.every((T) => {
|
|
344
349
|
var E;
|
|
345
350
|
return !((E = T.textContent) != null && E.trim());
|
|
346
351
|
}))
|
|
@@ -348,7 +353,7 @@ function oe(c = {}) {
|
|
|
348
353
|
const x = {};
|
|
349
354
|
_.forEach((T, E) => {
|
|
350
355
|
var z;
|
|
351
|
-
const F =
|
|
356
|
+
const F = c[E] || `Column${E + 1}`;
|
|
352
357
|
let I = ((z = T.textContent) == null ? void 0 : z.trim()) || "";
|
|
353
358
|
if (s && I) {
|
|
354
359
|
const M = parseFloat(I);
|
|
@@ -358,43 +363,43 @@ function oe(c = {}) {
|
|
|
358
363
|
}), f.push(x);
|
|
359
364
|
}
|
|
360
365
|
return {
|
|
361
|
-
schema: s && f.length > 0 ? N(f, "Extracted Table") :
|
|
366
|
+
schema: s && f.length > 0 ? N(f, "Extracted Table") : le(c, f.length),
|
|
362
367
|
data: f,
|
|
363
368
|
source: "dom",
|
|
364
369
|
metadata: {
|
|
365
370
|
selector: e,
|
|
366
371
|
rowCount: f.length,
|
|
367
|
-
columnCount:
|
|
372
|
+
columnCount: c.length,
|
|
368
373
|
extractedAt: /* @__PURE__ */ new Date()
|
|
369
374
|
}
|
|
370
375
|
};
|
|
371
376
|
}
|
|
372
|
-
function ie(
|
|
373
|
-
const { maxRows: n, inferTypes: s = !0 } = t,
|
|
377
|
+
function ie(l, e, t = {}) {
|
|
378
|
+
const { maxRows: n, inferTypes: s = !0 } = t, r = n ? l.slice(0, n) : l;
|
|
374
379
|
let o;
|
|
375
380
|
return e && e.length > 0 ? o = {
|
|
376
381
|
name: "Vue Data Grid",
|
|
377
|
-
columns: e.map((
|
|
378
|
-
name:
|
|
379
|
-
type: s &&
|
|
382
|
+
columns: e.map((a) => ({
|
|
383
|
+
name: a.field,
|
|
384
|
+
type: s && r.length > 0 ? O(r, a.field) : "string",
|
|
380
385
|
nullable: !0
|
|
381
386
|
})),
|
|
382
|
-
rowCount:
|
|
383
|
-
} :
|
|
387
|
+
rowCount: r.length
|
|
388
|
+
} : r.length > 0 ? o = N(r, "Vue Data Grid") : o = { name: "Vue Data Grid", columns: [], rowCount: 0 }, {
|
|
384
389
|
schema: o,
|
|
385
|
-
data:
|
|
390
|
+
data: r,
|
|
386
391
|
source: "vue",
|
|
387
392
|
metadata: {
|
|
388
|
-
rowCount:
|
|
393
|
+
rowCount: r.length,
|
|
389
394
|
columnCount: o.columns.length,
|
|
390
395
|
extractedAt: /* @__PURE__ */ new Date()
|
|
391
396
|
}
|
|
392
397
|
};
|
|
393
398
|
}
|
|
394
|
-
function
|
|
399
|
+
function le(l, e = 0) {
|
|
395
400
|
return {
|
|
396
401
|
name: "Extracted Table",
|
|
397
|
-
columns:
|
|
402
|
+
columns: l.map((t) => ({
|
|
398
403
|
name: t,
|
|
399
404
|
type: "string",
|
|
400
405
|
nullable: !0
|
|
@@ -402,27 +407,27 @@ function ce(c, e = 0) {
|
|
|
402
407
|
rowCount: e
|
|
403
408
|
};
|
|
404
409
|
}
|
|
405
|
-
function
|
|
410
|
+
function ce(l) {
|
|
406
411
|
const e = {};
|
|
407
|
-
|
|
408
|
-
e[
|
|
412
|
+
l.variable && l.variable.forEach((r) => {
|
|
413
|
+
e[r.key] = r.value;
|
|
409
414
|
});
|
|
410
|
-
const t =
|
|
411
|
-
function s(
|
|
412
|
-
|
|
413
|
-
|
|
415
|
+
const t = l.auth ? K(l.auth) : void 0, n = [];
|
|
416
|
+
function s(r, o = "") {
|
|
417
|
+
r.forEach((a) => {
|
|
418
|
+
a.item ? s(a.item, o ? `${o}/${a.name}` : a.name) : a.request && n.push(ue(a, t));
|
|
414
419
|
});
|
|
415
420
|
}
|
|
416
|
-
return s(
|
|
417
|
-
name:
|
|
418
|
-
description:
|
|
421
|
+
return s(l.item), {
|
|
422
|
+
name: l.info.name,
|
|
423
|
+
description: l.info.description,
|
|
419
424
|
endpoints: n,
|
|
420
425
|
variables: e,
|
|
421
426
|
auth: t
|
|
422
427
|
};
|
|
423
428
|
}
|
|
424
|
-
function ue(
|
|
425
|
-
const t =
|
|
429
|
+
function ue(l, e) {
|
|
430
|
+
const t = l.request, n = {};
|
|
426
431
|
t.header && t.header.forEach((o) => {
|
|
427
432
|
n[o.key] = o.value;
|
|
428
433
|
});
|
|
@@ -430,43 +435,43 @@ function ue(c, e) {
|
|
|
430
435
|
t.url.query && t.url.query.forEach((o) => {
|
|
431
436
|
s[o.key] = o.value;
|
|
432
437
|
});
|
|
433
|
-
const
|
|
438
|
+
const r = t.auth ? K(t.auth) : e;
|
|
434
439
|
return {
|
|
435
|
-
name:
|
|
440
|
+
name: l.name,
|
|
436
441
|
method: t.method,
|
|
437
442
|
url: t.url.raw,
|
|
438
443
|
description: t.description,
|
|
439
444
|
headers: n,
|
|
440
445
|
queryParams: s,
|
|
441
|
-
auth:
|
|
446
|
+
auth: r
|
|
442
447
|
};
|
|
443
448
|
}
|
|
444
|
-
function K(
|
|
449
|
+
function K(l) {
|
|
445
450
|
const e = {};
|
|
446
|
-
return
|
|
451
|
+
return l.apikey ? l.apikey.forEach((t) => {
|
|
447
452
|
e[t.key] = t.value;
|
|
448
|
-
}) :
|
|
453
|
+
}) : l.bearer ? l.bearer.forEach((t) => {
|
|
449
454
|
e[t.key] = t.value;
|
|
450
|
-
}) :
|
|
455
|
+
}) : l.basic && l.basic.forEach((t) => {
|
|
451
456
|
e[t.key] = t.value;
|
|
452
457
|
}), {
|
|
453
|
-
type:
|
|
458
|
+
type: l.type,
|
|
454
459
|
credentials: e
|
|
455
460
|
};
|
|
456
461
|
}
|
|
457
|
-
function P(
|
|
458
|
-
let t =
|
|
462
|
+
function P(l, e) {
|
|
463
|
+
let t = l;
|
|
459
464
|
return Object.keys(e).forEach((n) => {
|
|
460
465
|
const s = new RegExp(`{{${n}}}`, "g");
|
|
461
466
|
t = t.replace(s, e[n]);
|
|
462
467
|
}), t;
|
|
463
468
|
}
|
|
464
|
-
async function G(
|
|
465
|
-
const { endpoint: e, variables: t = {}, additionalHeaders: n = {}, additionalParams: s = {} } =
|
|
469
|
+
async function G(l) {
|
|
470
|
+
const { endpoint: e, variables: t = {}, additionalHeaders: n = {}, additionalParams: s = {} } = l;
|
|
466
471
|
try {
|
|
467
|
-
let
|
|
468
|
-
const o = { ...e.queryParams, ...t, ...s },
|
|
469
|
-
|
|
472
|
+
let r = P(e.url, t);
|
|
473
|
+
const o = { ...e.queryParams, ...t, ...s }, a = Object.keys(o).filter((d) => o[d] !== void 0 && o[d] !== "").map((d) => `${encodeURIComponent(d)}=${encodeURIComponent(P(String(o[d]), t))}`).join("&");
|
|
474
|
+
a && (r = r.includes("?") ? `${r}&${a}` : `${r}?${a}`);
|
|
470
475
|
const i = {
|
|
471
476
|
"Content-Type": "application/json",
|
|
472
477
|
...e.headers,
|
|
@@ -486,42 +491,42 @@ async function G(c) {
|
|
|
486
491
|
i.Authorization = `Basic ${A}`;
|
|
487
492
|
}
|
|
488
493
|
}
|
|
489
|
-
const
|
|
494
|
+
const c = await fetch(r, {
|
|
490
495
|
method: e.method,
|
|
491
496
|
headers: i
|
|
492
497
|
}), w = {};
|
|
493
|
-
return
|
|
498
|
+
return c.headers.forEach((d, y) => {
|
|
494
499
|
w[y] = d;
|
|
495
|
-
}),
|
|
500
|
+
}), c.ok ? {
|
|
496
501
|
success: !0,
|
|
497
|
-
data: await
|
|
498
|
-
statusCode:
|
|
502
|
+
data: await c.json(),
|
|
503
|
+
statusCode: c.status,
|
|
499
504
|
headers: w
|
|
500
505
|
} : {
|
|
501
506
|
success: !1,
|
|
502
|
-
error: `HTTP ${
|
|
503
|
-
statusCode:
|
|
507
|
+
error: `HTTP ${c.status}: ${c.statusText}`,
|
|
508
|
+
statusCode: c.status,
|
|
504
509
|
headers: w
|
|
505
510
|
};
|
|
506
|
-
} catch (
|
|
511
|
+
} catch (r) {
|
|
507
512
|
return {
|
|
508
513
|
success: !1,
|
|
509
|
-
error:
|
|
514
|
+
error: r.message || "Unknown error occurred"
|
|
510
515
|
};
|
|
511
516
|
}
|
|
512
517
|
}
|
|
513
|
-
async function Ye(
|
|
518
|
+
async function Ye(l, e = {}) {
|
|
514
519
|
const t = [];
|
|
515
|
-
for (const n of
|
|
520
|
+
for (const n of l) {
|
|
516
521
|
const s = await G({ endpoint: n, variables: e });
|
|
517
522
|
t.push(s);
|
|
518
523
|
}
|
|
519
524
|
return t;
|
|
520
525
|
}
|
|
521
|
-
function de(
|
|
522
|
-
if (!
|
|
526
|
+
function de(l) {
|
|
527
|
+
if (!l.success || !l.data)
|
|
523
528
|
return [];
|
|
524
|
-
const e =
|
|
529
|
+
const e = l.data;
|
|
525
530
|
return Array.isArray(e) ? e : e.data && Array.isArray(e.data) ? e.data : e.results && Array.isArray(e.results) ? e.results : e.items && Array.isArray(e.items) ? e.items : typeof e == "object" ? [e] : [];
|
|
526
531
|
}
|
|
527
532
|
class me {
|
|
@@ -559,17 +564,17 @@ class me {
|
|
|
559
564
|
signal: AbortSignal.timeout(this.config.timeout || 3e4)
|
|
560
565
|
});
|
|
561
566
|
if (!s.ok) {
|
|
562
|
-
const
|
|
563
|
-
throw new Error(`TFM API error: ${s.status} - ${
|
|
567
|
+
const a = await s.text();
|
|
568
|
+
throw new Error(`TFM API error: ${s.status} - ${a}`);
|
|
564
569
|
}
|
|
565
|
-
const
|
|
570
|
+
const r = await s.json(), o = Date.now() - t;
|
|
566
571
|
return {
|
|
567
572
|
success: !0,
|
|
568
|
-
result:
|
|
573
|
+
result: r.result || r,
|
|
569
574
|
metadata: {
|
|
570
575
|
processingTime: o,
|
|
571
576
|
model: this.config.model || "unknown",
|
|
572
|
-
version:
|
|
577
|
+
version: r.version
|
|
573
578
|
}
|
|
574
579
|
};
|
|
575
580
|
} catch (n) {
|
|
@@ -704,7 +709,7 @@ class me {
|
|
|
704
709
|
* Load Postman collection
|
|
705
710
|
*/
|
|
706
711
|
loadPostmanCollection(e) {
|
|
707
|
-
return this.parsedCollection =
|
|
712
|
+
return this.parsedCollection = ce(e), this.parsedCollection;
|
|
708
713
|
}
|
|
709
714
|
/**
|
|
710
715
|
* Get loaded collection
|
|
@@ -731,11 +736,11 @@ class me {
|
|
|
731
736
|
const s = {
|
|
732
737
|
...this.parsedCollection.variables,
|
|
733
738
|
...t
|
|
734
|
-
},
|
|
735
|
-
if (!
|
|
736
|
-
throw new Error(`API request failed: ${
|
|
737
|
-
const o = de(
|
|
738
|
-
return { data: o, schema:
|
|
739
|
+
}, r = await G({ endpoint: n, variables: s });
|
|
740
|
+
if (!r.success)
|
|
741
|
+
throw new Error(`API request failed: ${r.error}`);
|
|
742
|
+
const o = de(r), a = N(o);
|
|
743
|
+
return { data: o, schema: a };
|
|
739
744
|
}
|
|
740
745
|
/**
|
|
741
746
|
* Query API data with natural language
|
|
@@ -746,16 +751,16 @@ class me {
|
|
|
746
751
|
const t = Date.now(), { data: n, schema: s } = await this.fetchDataFromAPI(
|
|
747
752
|
e.dataSource.endpoint || "",
|
|
748
753
|
e.variables
|
|
749
|
-
),
|
|
754
|
+
), r = {
|
|
750
755
|
question: e.question,
|
|
751
756
|
schema: s,
|
|
752
757
|
data: n
|
|
753
|
-
}, o = await this.qaEngine.answerQuestion(
|
|
758
|
+
}, o = await this.qaEngine.answerQuestion(r), a = Date.now() - t;
|
|
754
759
|
return {
|
|
755
760
|
answer: o.answer,
|
|
756
761
|
apiResponse: n,
|
|
757
762
|
endpoint: e.dataSource.endpoint,
|
|
758
|
-
executionTime:
|
|
763
|
+
executionTime: a
|
|
759
764
|
};
|
|
760
765
|
}
|
|
761
766
|
/**
|
|
@@ -769,19 +774,19 @@ class me {
|
|
|
769
774
|
})) : [];
|
|
770
775
|
}
|
|
771
776
|
}
|
|
772
|
-
function We(
|
|
773
|
-
const e = new me(
|
|
777
|
+
function We(l) {
|
|
778
|
+
const e = new me(l.config, l.qaConfig), t = D(!1), n = D(null), s = D(null), r = l.data || D([]), o = l.schema || D(null), a = D([]), i = D([]), c = D(null), w = l.maxQuestionHistory || 50, f = l.useLocalFallback !== !1;
|
|
774
779
|
async function d(u, m) {
|
|
775
780
|
t.value = !0, n.value = null;
|
|
776
781
|
try {
|
|
777
|
-
if (
|
|
782
|
+
if (l.config.provider === "local" || f) {
|
|
778
783
|
console.log("🔧 Using local analysis (no API call)");
|
|
779
784
|
const b = y(u, m);
|
|
780
785
|
return s.value = b, b;
|
|
781
786
|
}
|
|
782
787
|
const $ = {
|
|
783
788
|
type: u,
|
|
784
|
-
data:
|
|
789
|
+
data: r.value,
|
|
785
790
|
schema: o.value || void 0,
|
|
786
791
|
options: m
|
|
787
792
|
}, C = await e.analyze($);
|
|
@@ -795,11 +800,11 @@ function We(c) {
|
|
|
795
800
|
}
|
|
796
801
|
}
|
|
797
802
|
function y(u, m) {
|
|
798
|
-
const $ = o.value || N(
|
|
803
|
+
const $ = o.value || N(r.value);
|
|
799
804
|
switch (u) {
|
|
800
805
|
case "descriptive_stats": {
|
|
801
806
|
const C = $.columns.map(
|
|
802
|
-
(b) => J(
|
|
807
|
+
(b) => J(r.value, b.name, b.type)
|
|
803
808
|
);
|
|
804
809
|
return {
|
|
805
810
|
type: u,
|
|
@@ -811,8 +816,8 @@ function We(c) {
|
|
|
811
816
|
};
|
|
812
817
|
}
|
|
813
818
|
case "anomaly_detection": {
|
|
814
|
-
const C = $.columns.filter((v) => v.type === "number").map((v) => v.name), b =
|
|
815
|
-
|
|
819
|
+
const C = $.columns.filter((v) => v.type === "number").map((v) => v.name), b = ae(
|
|
820
|
+
r.value,
|
|
816
821
|
C,
|
|
817
822
|
m == null ? void 0 : m.sensitivity
|
|
818
823
|
);
|
|
@@ -831,7 +836,7 @@ function We(c) {
|
|
|
831
836
|
id: R,
|
|
832
837
|
label: `Cluster ${R + 1}`,
|
|
833
838
|
centroid: {},
|
|
834
|
-
size: Math.floor(
|
|
839
|
+
size: Math.floor(r.value.length / b),
|
|
835
840
|
characteristics: [`Group ${R + 1} characteristics`]
|
|
836
841
|
}));
|
|
837
842
|
return {
|
|
@@ -878,20 +883,20 @@ function We(c) {
|
|
|
878
883
|
e.updateConfig(u);
|
|
879
884
|
}
|
|
880
885
|
function F(u, m = !0) {
|
|
881
|
-
|
|
886
|
+
r.value = u, m && (o.value = N(u));
|
|
882
887
|
}
|
|
883
888
|
function I() {
|
|
884
|
-
t.value = !1, n.value = null, s.value = null,
|
|
889
|
+
t.value = !1, n.value = null, s.value = null, a.value = [], i.value = [], c.value = null;
|
|
885
890
|
}
|
|
886
891
|
async function z(u, m) {
|
|
887
892
|
t.value = !0, n.value = null;
|
|
888
893
|
try {
|
|
889
|
-
if (!
|
|
894
|
+
if (!r.value || !Array.isArray(r.value) || r.value.length === 0)
|
|
890
895
|
throw new Error("No data available. Please load data first.");
|
|
891
|
-
const $ = o.value || N(
|
|
896
|
+
const $ = o.value || N(r.value), C = {
|
|
892
897
|
question: u,
|
|
893
898
|
schema: $,
|
|
894
|
-
data:
|
|
899
|
+
data: r.value,
|
|
895
900
|
sampleSize: 100,
|
|
896
901
|
includeAggregates: !0,
|
|
897
902
|
...m
|
|
@@ -901,10 +906,10 @@ function We(c) {
|
|
|
901
906
|
timestamp: /* @__PURE__ */ new Date(),
|
|
902
907
|
context: {
|
|
903
908
|
tableSchema: $,
|
|
904
|
-
rowCount:
|
|
909
|
+
rowCount: r.value.length
|
|
905
910
|
}
|
|
906
911
|
};
|
|
907
|
-
return
|
|
912
|
+
return a.value || (a.value = []), i.value || (i.value = []), a.value.push(S), i.value.push(v), c.value = v, a.value.length > w && (a.value.shift(), i.value.shift()), v;
|
|
908
913
|
} catch ($) {
|
|
909
914
|
throw n.value = $ instanceof Error ? $ : new Error("Q&A failed"), n.value;
|
|
910
915
|
} finally {
|
|
@@ -914,8 +919,8 @@ function We(c) {
|
|
|
914
919
|
async function M() {
|
|
915
920
|
t.value = !0, n.value = null;
|
|
916
921
|
try {
|
|
917
|
-
const u = o.value || N(
|
|
918
|
-
return await e.generateSummary(
|
|
922
|
+
const u = o.value || N(r.value);
|
|
923
|
+
return await e.generateSummary(r.value, u);
|
|
919
924
|
} catch (u) {
|
|
920
925
|
throw n.value = u instanceof Error ? u : new Error("Summary generation failed"), n.value;
|
|
921
926
|
} finally {
|
|
@@ -923,15 +928,15 @@ function We(c) {
|
|
|
923
928
|
}
|
|
924
929
|
}
|
|
925
930
|
function Y() {
|
|
926
|
-
|
|
931
|
+
a.value = [], i.value = [], c.value = null;
|
|
927
932
|
}
|
|
928
933
|
function W(u) {
|
|
929
934
|
const m = e.extractFromDOM(u);
|
|
930
|
-
return m && (
|
|
935
|
+
return m && (r.value = m.data, o.value = m.schema), m;
|
|
931
936
|
}
|
|
932
937
|
function X(u, m, $) {
|
|
933
938
|
const C = e.normalizeVueData(u, m, $);
|
|
934
|
-
|
|
939
|
+
r.value = C.data, o.value = C.schema;
|
|
935
940
|
}
|
|
936
941
|
function Z(u) {
|
|
937
942
|
e.initializeQA(u);
|
|
@@ -941,11 +946,11 @@ function We(c) {
|
|
|
941
946
|
loading: t,
|
|
942
947
|
error: n,
|
|
943
948
|
lastResult: s,
|
|
944
|
-
data:
|
|
949
|
+
data: r,
|
|
945
950
|
schema: o,
|
|
946
|
-
questionHistory:
|
|
951
|
+
questionHistory: a,
|
|
947
952
|
answerHistory: i,
|
|
948
|
-
lastAnswer:
|
|
953
|
+
lastAnswer: c,
|
|
949
954
|
analyze: d,
|
|
950
955
|
getDescriptiveStats: A,
|
|
951
956
|
detectAnomalies: _,
|
|
@@ -980,41 +985,41 @@ const he = { class: "ti-question-input" }, fe = { class: "ti-input-wrapper" }, p
|
|
|
980
985
|
loading: { type: Boolean, default: !1 }
|
|
981
986
|
},
|
|
982
987
|
emits: ["submit"],
|
|
983
|
-
setup(
|
|
984
|
-
const t =
|
|
985
|
-
function
|
|
988
|
+
setup(l, { emit: e }) {
|
|
989
|
+
const t = l, n = e, s = D("");
|
|
990
|
+
function r() {
|
|
986
991
|
s.value.trim() && !t.disabled && !t.loading && (n("submit", s.value.trim()), s.value = "");
|
|
987
992
|
}
|
|
988
|
-
function o(
|
|
993
|
+
function o(a) {
|
|
989
994
|
}
|
|
990
|
-
return (
|
|
995
|
+
return (a, i) => (g(), p("div", he, [
|
|
991
996
|
h("div", fe, [
|
|
992
997
|
ee(h("textarea", {
|
|
993
|
-
"onUpdate:modelValue": i[0] || (i[0] = (
|
|
994
|
-
placeholder:
|
|
995
|
-
disabled:
|
|
998
|
+
"onUpdate:modelValue": i[0] || (i[0] = (c) => s.value = c),
|
|
999
|
+
placeholder: a.placeholder,
|
|
1000
|
+
disabled: a.disabled,
|
|
996
1001
|
class: "ti-textarea",
|
|
997
1002
|
rows: "1",
|
|
998
1003
|
onKeydown: [
|
|
999
|
-
L(H(
|
|
1004
|
+
L(H(r, ["exact", "prevent"]), ["enter"]),
|
|
1000
1005
|
L(H(o, ["shift"]), ["enter"])
|
|
1001
1006
|
]
|
|
1002
1007
|
}, null, 40, pe), [
|
|
1003
1008
|
[te, s.value]
|
|
1004
1009
|
]),
|
|
1005
1010
|
h("button", {
|
|
1006
|
-
disabled:
|
|
1011
|
+
disabled: a.disabled || !s.value.trim(),
|
|
1007
1012
|
class: "ti-submit-btn",
|
|
1008
|
-
onClick:
|
|
1013
|
+
onClick: r
|
|
1009
1014
|
}, [
|
|
1010
|
-
|
|
1015
|
+
a.loading ? (g(), p("span", ye, k(a.loadingLabel), 1)) : (g(), p("span", we, k(a.submitLabel), 1))
|
|
1011
1016
|
], 8, ge)
|
|
1012
1017
|
]),
|
|
1013
|
-
|
|
1018
|
+
a.showHint ? (g(), p("div", ve, k(a.hint), 1)) : q("", !0)
|
|
1014
1019
|
]));
|
|
1015
1020
|
}
|
|
1016
|
-
}), V = (
|
|
1017
|
-
const t =
|
|
1021
|
+
}), V = (l, e) => {
|
|
1022
|
+
const t = l.__vccOpts || l;
|
|
1018
1023
|
for (const [n, s] of e)
|
|
1019
1024
|
t[n] = s;
|
|
1020
1025
|
return t;
|
|
@@ -1041,7 +1046,7 @@ const he = { class: "ti-question-input" }, fe = { class: "ti-input-wrapper" }, p
|
|
|
1041
1046
|
props: {
|
|
1042
1047
|
answer: {}
|
|
1043
1048
|
},
|
|
1044
|
-
setup(
|
|
1049
|
+
setup(l) {
|
|
1045
1050
|
const e = D(!1);
|
|
1046
1051
|
function t(n) {
|
|
1047
1052
|
return new Date(n).toLocaleTimeString();
|
|
@@ -1067,7 +1072,7 @@ const he = { class: "ti-question-input" }, fe = { class: "ti-input-wrapper" }, p
|
|
|
1067
1072
|
n.answer.supportingData ? (g(), p("div", Te, [
|
|
1068
1073
|
h("button", {
|
|
1069
1074
|
class: "ti-toggle-btn",
|
|
1070
|
-
onClick: s[0] || (s[0] = (
|
|
1075
|
+
onClick: s[0] || (s[0] = (r) => e.value = !e.value)
|
|
1071
1076
|
}, k(e.value ? "▼" : "▶") + " Supporting Data ", 1),
|
|
1072
1077
|
e.value ? (g(), p("div", Ie, [
|
|
1073
1078
|
n.answer.supportingData.aggregates ? (g(), p("div", Pe, [
|
|
@@ -1080,12 +1085,12 @@ const he = { class: "ti-question-input" }, fe = { class: "ti-input-wrapper" }, p
|
|
|
1080
1085
|
h("table", ze, [
|
|
1081
1086
|
h("thead", null, [
|
|
1082
1087
|
h("tr", null, [
|
|
1083
|
-
(g(!0), p(Q, null, j(Object.keys(n.answer.supportingData.rows[0]), (
|
|
1088
|
+
(g(!0), p(Q, null, j(Object.keys(n.answer.supportingData.rows[0]), (r, o) => (g(), p("th", { key: o }, k(r), 1))), 128))
|
|
1084
1089
|
])
|
|
1085
1090
|
]),
|
|
1086
1091
|
h("tbody", null, [
|
|
1087
|
-
(g(!0), p(Q, null, j(n.answer.supportingData.rows.slice(0, 5), (
|
|
1088
|
-
(g(!0), p(Q, null, j(Object.keys(
|
|
1092
|
+
(g(!0), p(Q, null, j(n.answer.supportingData.rows.slice(0, 5), (r, o) => (g(), p("tr", { key: o }, [
|
|
1093
|
+
(g(!0), p(Q, null, j(Object.keys(r), (a, i) => (g(), p("td", { key: i }, k(r[a]), 1))), 128))
|
|
1089
1094
|
]))), 128))
|
|
1090
1095
|
])
|
|
1091
1096
|
])
|
|
@@ -1110,37 +1115,37 @@ const he = { class: "ti-question-input" }, fe = { class: "ti-input-wrapper" }, p
|
|
|
1110
1115
|
questions: {}
|
|
1111
1116
|
},
|
|
1112
1117
|
emits: ["clear", "select"],
|
|
1113
|
-
setup(
|
|
1114
|
-
const t =
|
|
1115
|
-
function s(
|
|
1116
|
-
const o = new Date(
|
|
1117
|
-
return
|
|
1118
|
+
setup(l, { emit: e }) {
|
|
1119
|
+
const t = l, n = re(() => [...t.questions].reverse());
|
|
1120
|
+
function s(r) {
|
|
1121
|
+
const o = new Date(r), i = (/* @__PURE__ */ new Date()).getTime() - o.getTime(), c = Math.floor(i / 6e4), w = Math.floor(i / 36e5), f = Math.floor(i / 864e5);
|
|
1122
|
+
return c < 1 ? "Just now" : c < 60 ? `${c}m ago` : w < 24 ? `${w}h ago` : `${f}d ago`;
|
|
1118
1123
|
}
|
|
1119
|
-
return (
|
|
1124
|
+
return (r, o) => (g(), p("div", je, [
|
|
1120
1125
|
h("div", Fe, [
|
|
1121
1126
|
o[1] || (o[1] = h("h3", null, "Question History", -1)),
|
|
1122
|
-
|
|
1127
|
+
r.questions.length > 0 ? (g(), p("button", {
|
|
1123
1128
|
key: 0,
|
|
1124
1129
|
class: "ti-clear-btn",
|
|
1125
|
-
onClick: o[0] || (o[0] = (
|
|
1130
|
+
onClick: o[0] || (o[0] = (a) => r.$emit("clear"))
|
|
1126
1131
|
}, " Clear History ")) : q("", !0)
|
|
1127
1132
|
]),
|
|
1128
|
-
|
|
1133
|
+
r.questions.length === 0 ? (g(), p("div", Re, o[2] || (o[2] = [
|
|
1129
1134
|
h("div", { class: "ti-empty-icon" }, "💬", -1),
|
|
1130
1135
|
h("p", null, "No questions asked yet", -1),
|
|
1131
1136
|
h("p", { class: "ti-empty-hint" }, "Ask a question about your data to get started", -1)
|
|
1132
1137
|
]))) : (g(), p("div", Ue, [
|
|
1133
|
-
(g(!0), p(Q, null, j(n.value, (
|
|
1134
|
-
key:
|
|
1138
|
+
(g(!0), p(Q, null, j(n.value, (a, i) => (g(), p("div", {
|
|
1139
|
+
key: a.id,
|
|
1135
1140
|
class: "ti-history-item",
|
|
1136
|
-
onClick: (
|
|
1141
|
+
onClick: (c) => r.$emit("select", a)
|
|
1137
1142
|
}, [
|
|
1138
1143
|
h("div", Le, [
|
|
1139
|
-
h("span", He, "#" + k(
|
|
1140
|
-
h("span", Be, k(s(
|
|
1144
|
+
h("span", He, "#" + k(r.questions.length - i), 1),
|
|
1145
|
+
h("span", Be, k(s(a.timestamp)), 1)
|
|
1141
1146
|
]),
|
|
1142
|
-
h("div", Oe, k(
|
|
1143
|
-
|
|
1147
|
+
h("div", Oe, k(a.text), 1),
|
|
1148
|
+
a.context ? (g(), p("div", Je, k(a.context.rowCount) + " rows ", 1)) : q("", !0)
|
|
1144
1149
|
], 8, Ve))), 128))
|
|
1145
1150
|
]))
|
|
1146
1151
|
]));
|
|
@@ -1154,14 +1159,14 @@ export {
|
|
|
1154
1159
|
me as TabularIntelligence,
|
|
1155
1160
|
J as calculateStats,
|
|
1156
1161
|
de as convertToTabular,
|
|
1157
|
-
|
|
1162
|
+
ae as detectAnomalies,
|
|
1158
1163
|
G as executeAPIRequest,
|
|
1159
1164
|
Ye as executeMultipleRequests,
|
|
1160
1165
|
oe as extractFromDOM,
|
|
1161
1166
|
O as inferColumnType,
|
|
1162
1167
|
N as inferSchema,
|
|
1163
1168
|
ie as normalizeVueData,
|
|
1164
|
-
|
|
1169
|
+
ce as parsePostmanCollection,
|
|
1165
1170
|
P as replaceVariables,
|
|
1166
1171
|
We as useTabularIntelligence
|
|
1167
1172
|
};
|