@trilogy-data/trilogy-studio-components 0.1.10 → 0.1.11
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/{ChatCreatorModal-kqIGFHPN.js → ChatCreatorModal-ByXgDUoO.js} +1 -1
- package/dist/{Dashboard-BhcB9-ov.js → Dashboard-D6A2aYgv.js} +3 -3
- package/dist/{DashboardCreatorInline-Cp8fI1iG.js → DashboardCreatorInline-Cgfinl3I.js} +1 -1
- package/dist/{DashboardMobile-nSuC_ygH.js → DashboardMobile-BbZH1Qir.js} +20 -20
- package/dist/{LLMConnectionList-CwfSkiq_.js → LLMConnectionList-Cl3h5pBm.js} +884 -856
- package/dist/LLMView-BRDqi_8s.js +656 -0
- package/dist/Manager-Baa6Lvxg.js +4 -0
- package/dist/{ResultComponent-CDU0FkOQ.js → ResultComponent-RFos0Fha.js} +6 -6
- package/dist/{Sidebar-dZtwrs0v.js → Sidebar-Bvu5hS2B.js} +289 -268
- package/dist/{TutorialPage-kWCo9lD6.js → TutorialPage-ChaeJTUC.js} +4 -4
- package/dist/{WelcomePage-BjLQLYt8.js → WelcomePage-B06IC6Uy.js} +1 -1
- package/dist/chats/chat.d.ts +11 -1
- package/dist/chats/chat.d.ts.map +1 -1
- package/dist/chats/publishArtifactsToDashboard.d.ts +21 -0
- package/dist/chats/publishArtifactsToDashboard.d.ts.map +1 -0
- package/dist/components/editor/Editor.vue.d.ts +1 -2
- package/dist/components/editor/Editor.vue.d.ts.map +1 -1
- package/dist/components/editor/ResultComponent.vue.d.ts +74 -15
- package/dist/components/editor/ResultComponent.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarLayout.vue.d.ts +14 -2
- package/dist/components/layout/SidebarLayout.vue.d.ts.map +1 -1
- package/dist/components/llm/ArtifactsPane.vue.d.ts +885 -0
- package/dist/components/llm/ArtifactsPane.vue.d.ts.map +1 -0
- package/dist/components/llm/ChatArtifact.vue.d.ts +37 -1
- package/dist/components/llm/ChatArtifact.vue.d.ts.map +1 -1
- package/dist/components/llm/LLMChat.vue.d.ts +18 -3
- package/dist/components/llm/LLMChat.vue.d.ts.map +1 -1
- package/dist/components/llm/LLMChatSplitView.vue.d.ts +858 -702
- package/dist/components/llm/LLMChatSplitView.vue.d.ts.map +1 -1
- package/dist/components/llm/LLMEditorRefinement.vue.d.ts +74 -15
- package/dist/components/llm/LLMEditorRefinement.vue.d.ts.map +1 -1
- package/dist/components/model/ModelCard.vue.d.ts +1 -2
- package/dist/components/model/ModelCard.vue.d.ts.map +1 -1
- package/dist/components/sidebar/ConnectionList.vue.d.ts.map +1 -1
- package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -1
- package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts.map +1 -1
- package/dist/components/sidebar/LLMConnectionList.vue.d.ts +2 -2
- package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
- package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts.map +1 -1
- package/dist/components/sidebar/LLMProviderIcon.vue.d.ts.map +1 -1
- package/dist/components/tutorial/TutorialPrompt.vue.d.ts +75 -17
- package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
- package/dist/composables/useChatWithTools.d.ts.map +1 -1
- package/dist/composables/useEditorRefinement.d.ts.map +1 -1
- package/dist/composables/useToolLoop.d.ts +0 -2
- package/dist/composables/useToolLoop.d.ts.map +1 -1
- package/dist/{cssMode-BgTpWprH.js → cssMode-C091JrjG.js} +1 -1
- package/dist/dashboards/helpers.d.ts.map +1 -1
- package/dist/data/githubStorage.d.ts.map +1 -1
- package/dist/data/localStorage.d.ts.map +1 -1
- package/dist/editors/results.d.ts.map +1 -1
- package/dist/{freemarker2-BCVHBEgI.js → freemarker2-X1eIBwal.js} +1 -1
- package/dist/{handlebars-CvE5drDj.js → handlebars-BlVeu042.js} +1 -1
- package/dist/{html-CZGBnyei.js → html-WyM-Pvly.js} +1 -1
- package/dist/{htmlMode-CzN0D6_N.js → htmlMode-DQST6Ar_.js} +1 -1
- package/dist/{javascript-D9vXE5ET.js → javascript-CYyejasU.js} +1 -1
- package/dist/{jsonMode-CY69B03N.js → jsonMode-CESsFbpD.js} +1 -1
- package/dist/{liquid-D2Izcg9H.js → liquid-DdP-I3Ox.js} +1 -1
- package/dist/llm/chatAgentPrompt.d.ts +262 -0
- package/dist/llm/chatAgentPrompt.d.ts.map +1 -1
- package/dist/llm/chatHelpers.d.ts +0 -11
- package/dist/llm/chatHelpers.d.ts.map +1 -1
- package/dist/llm/chatToolExecutor.d.ts +10 -0
- package/dist/llm/chatToolExecutor.d.ts.map +1 -1
- package/dist/llm/demo.d.ts +29 -0
- package/dist/llm/demo.d.ts.map +1 -0
- package/dist/llm/editorRefinementToolExecutor.d.ts +4 -0
- package/dist/llm/editorRefinementToolExecutor.d.ts.map +1 -1
- package/dist/llm/editorRefinementTools.d.ts +40 -0
- package/dist/llm/editorRefinementTools.d.ts.map +1 -1
- package/dist/llm/index.d.ts +3 -2
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/openrouter.d.ts +5 -0
- package/dist/llm/openrouter.d.ts.map +1 -1
- package/dist/llm/toolLoopCore.d.ts +36 -7
- package/dist/llm/toolLoopCore.d.ts.map +1 -1
- package/dist/llm/utils.d.ts +4 -1
- package/dist/llm/utils.d.ts.map +1 -1
- package/dist/{main-YvioU1lW.js → main-DP4aLnEK.js} +38043 -37183
- package/dist/main.css +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +10 -10
- package/dist/main.umd.cjs +605 -560
- package/dist/{mdx-DfvKDyTa.js → mdx-VGDZf6-F.js} +1 -1
- package/dist/{python-CmewBYeN.js → python-BiiBBLHE.js} +1 -1
- package/dist/{razor-C-YsC2u-.js → razor-ogBkymZ8.js} +1 -1
- package/dist/stores/chatStore.d.ts.map +1 -1
- package/dist/stores/editorStore.d.ts.map +1 -1
- package/dist/stores/llmStore.d.ts +1 -10
- package/dist/stores/llmStore.d.ts.map +1 -1
- package/dist/stores/queryExecutionService.d.ts +1 -0
- package/dist/stores/queryExecutionService.d.ts.map +1 -1
- package/dist/stores/resolver.d.ts +1 -0
- package/dist/stores/resolver.d.ts.map +1 -1
- package/dist/stores/useScreenNavigation.d.ts.map +1 -1
- package/dist/{tsMode-LfgRVGbQ.js → tsMode-DP-1CE0D.js} +1 -1
- package/dist/{typescript-ChhJ4j27.js → typescript-ByG-a0Ne.js} +1 -1
- package/dist/{useDashboard-vvK-sCbo.js → useDashboard-Dx-2dWkF.js} +1 -1
- package/dist/utility/markdownRenderer.d.ts.map +1 -1
- package/dist/views/LLMView.vue.d.ts +2713 -2140
- package/dist/views/LLMView.vue.d.ts.map +1 -1
- package/dist/views/ModelView.vue.d.ts +2 -4
- package/dist/views/ModelView.vue.d.ts.map +1 -1
- package/dist/views/TutorialPage.vue.d.ts +154 -40
- package/dist/views/TutorialPage.vue.d.ts.map +1 -1
- package/dist/{xml-DM40RTTn.js → xml-DmCesN6f.js} +1 -1
- package/dist/{yaml-0wmwSdSU.js → yaml-DpZLn6t1.js} +1 -1
- package/package.json +1 -1
- package/dist/LLMView-e38fpjum.js +0 -558
- package/dist/Manager-CtK5dHJ8.js +0 -4
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
import { defineComponent as z, inject as k, ref as L, computed as Q, watch as U, nextTick as Z, onMounted as x, createElementBlock as p, openBlock as d, createElementVNode as r, createCommentVNode as T, createTextVNode as O, withDirectives as Y, Fragment as B, renderList as j, toDisplayString as w, vModelSelect as ee, normalizeClass as P, withKeys as te, withModifiers as ne, vModelText as se, resolveComponent as G, createBlock as H, createVNode as ae, withCtx as K } from "vue";
|
|
2
|
+
import { y as D, z as oe, a as J, D as ie, B as F, F as re, I as le, J as ce } from "./main-DP4aLnEK.js";
|
|
3
|
+
const _ = [
|
|
4
|
+
{ name: "id", type: "int" },
|
|
5
|
+
{ name: "quantity", type: "float" },
|
|
6
|
+
{ name: "extended_price", type: "float::money" },
|
|
7
|
+
{ name: "discount", type: "float::percent", description: "percent discount" },
|
|
8
|
+
{ name: "tax", type: "float::percent", description: "tax, as percentage" },
|
|
9
|
+
{ name: "return_flag", type: "string" },
|
|
10
|
+
{ name: "line_status", type: "string" },
|
|
11
|
+
{ name: "ship_date", type: "date" },
|
|
12
|
+
{ name: "commit_date", type: "date" },
|
|
13
|
+
{ name: "receipt_date", type: "date" },
|
|
14
|
+
{ name: "ship_instruct", type: "string" },
|
|
15
|
+
{ name: "ship_mode", type: "string" },
|
|
16
|
+
{ name: "comment", type: "string" },
|
|
17
|
+
{ name: "supplier.id", type: "int" },
|
|
18
|
+
{ name: "supplier.nation.name", type: "string" },
|
|
19
|
+
{ name: "supplier.name", type: "string" },
|
|
20
|
+
{ name: "order.id", type: "int" },
|
|
21
|
+
{ name: "order.date", type: "date" },
|
|
22
|
+
{ name: "order.customer.name", type: "string" },
|
|
23
|
+
{ name: "order.customer.nation.name", type: "string" },
|
|
24
|
+
{ name: "order.customer.id", type: "int" }
|
|
25
|
+
], de = [
|
|
26
|
+
{
|
|
27
|
+
name: "Basic Query",
|
|
28
|
+
description: "Tests if the LLM can create a simple trilogy query from user input.",
|
|
29
|
+
prompt: D("what were sales for the last 3 months by order date?", _),
|
|
30
|
+
expectedResponse: {
|
|
31
|
+
contains: ["extended_price"],
|
|
32
|
+
mustIdentify: "order.date",
|
|
33
|
+
notContains: ["FROM"]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "Aggregate Query",
|
|
38
|
+
description: "Tests if the LLM can generate an aggregate query.",
|
|
39
|
+
prompt: D("what are sales by supplier name and nation?", _),
|
|
40
|
+
expectedResponse: {
|
|
41
|
+
contains: ["extended_price"],
|
|
42
|
+
mustIdentify: "supplier.nation.name",
|
|
43
|
+
notContains: ["FROM", "GROUP BY"]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "Complex Query",
|
|
48
|
+
description: "Tests for a more complex query, with limits and ordering.",
|
|
49
|
+
prompt: D("Who were the top ten customers by sales in august 1995?", _),
|
|
50
|
+
expectedResponse: {
|
|
51
|
+
contains: ["extended_price", "order.customer.name", "8"],
|
|
52
|
+
mustIdentify: "order.customer.name",
|
|
53
|
+
notContains: ["FROM", "GROUP BY"]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Multi-part Conditions",
|
|
58
|
+
description: "Tests for a query that includes multiple conditions.",
|
|
59
|
+
prompt: D(
|
|
60
|
+
"Who were the top ten customers by sales in august 1995 who had orders that shipped in october or september?",
|
|
61
|
+
_
|
|
62
|
+
),
|
|
63
|
+
expectedResponse: {
|
|
64
|
+
contains: ["extended_price", "order.customer.name", "8"],
|
|
65
|
+
mustIdentify: "order.customer.name",
|
|
66
|
+
notContains: ["FROM", "GROUP BY"]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Test Count(*) Handling",
|
|
71
|
+
description: "Test proper counting of identifiers",
|
|
72
|
+
prompt: D("How many customers are there by country?", _),
|
|
73
|
+
expectedResponse: {
|
|
74
|
+
contains: ["order.customer.id"],
|
|
75
|
+
mustIdentify: "order.customer.nation.name",
|
|
76
|
+
notContains: ["FROM", "GROUP BY", "*"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
], ue = z({
|
|
80
|
+
name: "LLMValidationView",
|
|
81
|
+
props: {
|
|
82
|
+
initialProvider: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: ""
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
setup(e) {
|
|
88
|
+
const s = k("llmConnectionStore"), i = L([]), h = L(""), a = L(!1), C = L(!1), t = L(""), l = L(null), u = L([]), b = L([]), y = 5, v = 4, f = L(
|
|
89
|
+
e.initialProvider || (Object.keys(s.connections).length > 0 ? Object.keys(s.connections)[0] : "")
|
|
90
|
+
), $ = L(de), o = Q(() => Object.keys(s.connections)), S = Q(() => !!f.value && s.getConnection(f.value) !== null);
|
|
91
|
+
U(i, () => {
|
|
92
|
+
Z(() => {
|
|
93
|
+
l.value && (l.value.scrollTop = l.value.scrollHeight);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
const M = (m) => m ? s.getConnectionStatus(m) : "disconnected", A = (m, c) => {
|
|
97
|
+
const n = { passed: !0 };
|
|
98
|
+
let I = oe(m);
|
|
99
|
+
if (c.contains) {
|
|
100
|
+
for (const g of c.contains)
|
|
101
|
+
if (!I.toLowerCase().includes(g.toLowerCase()))
|
|
102
|
+
return n.passed = !1, n.reason = `Response missing expected phrase: "${g}"`, n;
|
|
103
|
+
}
|
|
104
|
+
if (c.notContains)
|
|
105
|
+
for (const g of c.notContains) {
|
|
106
|
+
const R = I.split(`
|
|
107
|
+
`);
|
|
108
|
+
for (const q of R)
|
|
109
|
+
if (!q.trim().startsWith("#") && q.toLowerCase().includes(g.toLowerCase()))
|
|
110
|
+
return n.passed = !1, n.reason = `Response contains forbidden phrase: "${g}"`, n;
|
|
111
|
+
}
|
|
112
|
+
if (c.mustIdentify) {
|
|
113
|
+
const g = I.toLowerCase(), R = c.mustIdentify.toLowerCase();
|
|
114
|
+
if (!g.includes(R) && !V(g, R))
|
|
115
|
+
return n.passed = !1, n.reason = `Response did not identify the issue: "${c.mustIdentify}"`, n;
|
|
116
|
+
}
|
|
117
|
+
return n;
|
|
118
|
+
}, V = (m, c) => {
|
|
119
|
+
const n = {
|
|
120
|
+
"missing index": [
|
|
121
|
+
"no index",
|
|
122
|
+
"should create index",
|
|
123
|
+
"index would improve",
|
|
124
|
+
"needs an index"
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
return c in n ? n[c].some((I) => m.includes(I)) : !1;
|
|
128
|
+
}, N = async () => {
|
|
129
|
+
if (!h.value.trim() || a.value || !f.value) return;
|
|
130
|
+
i.value.push({
|
|
131
|
+
role: "user",
|
|
132
|
+
content: h.value
|
|
133
|
+
});
|
|
134
|
+
const m = h.value;
|
|
135
|
+
h.value = "", a.value = !0, t.value = "";
|
|
136
|
+
try {
|
|
137
|
+
const c = {
|
|
138
|
+
prompt: m
|
|
139
|
+
}, n = await s.generateCompletion(
|
|
140
|
+
f.value,
|
|
141
|
+
c
|
|
142
|
+
);
|
|
143
|
+
i.value.push({
|
|
144
|
+
role: "assistant",
|
|
145
|
+
content: n.text,
|
|
146
|
+
modelInfo: {
|
|
147
|
+
totalTokens: n.usage.totalTokens
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
} catch (c) {
|
|
151
|
+
t.value = c instanceof Error ? c.message : "An unknown error occurred";
|
|
152
|
+
} finally {
|
|
153
|
+
a.value = !1;
|
|
154
|
+
}
|
|
155
|
+
}, E = async (m) => {
|
|
156
|
+
const c = $.value[m];
|
|
157
|
+
try {
|
|
158
|
+
const n = {
|
|
159
|
+
prompt: c.prompt
|
|
160
|
+
}, I = await s.generateCompletion(
|
|
161
|
+
f.value,
|
|
162
|
+
n
|
|
163
|
+
);
|
|
164
|
+
return A(I.text, c.expectedResponse);
|
|
165
|
+
} catch (n) {
|
|
166
|
+
return {
|
|
167
|
+
passed: !1,
|
|
168
|
+
reason: `Error: ${n instanceof Error ? n.message : "An unknown error occurred"}`
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}, W = async (m) => {
|
|
172
|
+
if (a.value || !f.value) return;
|
|
173
|
+
const c = $.value[m];
|
|
174
|
+
i.value = [], i.value.push({
|
|
175
|
+
role: "user",
|
|
176
|
+
content: `RUNNING TEST: ${c.name} (${y} iterations)`
|
|
177
|
+
}), a.value = !0, t.value = "";
|
|
178
|
+
try {
|
|
179
|
+
const n = {
|
|
180
|
+
passed: 0,
|
|
181
|
+
total: y,
|
|
182
|
+
runs: []
|
|
183
|
+
};
|
|
184
|
+
i.value.push({
|
|
185
|
+
role: "assistant",
|
|
186
|
+
content: `Running ${y} iterations of test "${c.name}"...`
|
|
187
|
+
});
|
|
188
|
+
for (let g = 0; g < y; g++) {
|
|
189
|
+
g > 0 && (i.value[i.value.length - 1].content += `
|
|
190
|
+
Running iteration ${g + 1}/${y}...`);
|
|
191
|
+
const R = await E(m);
|
|
192
|
+
n.runs.push(R), R.passed && n.passed++;
|
|
193
|
+
}
|
|
194
|
+
const I = {
|
|
195
|
+
passed: n.passed >= v,
|
|
196
|
+
reason: n.passed >= v ? void 0 : `Only ${n.passed}/${y} runs passed (need at least ${v})`
|
|
197
|
+
};
|
|
198
|
+
u.value[m] = I, b.value[m] = n, i.value[i.value.length - 1].content = `Test "${c.name}" completed: ${n.passed}/${y} runs passed.
|
|
199
|
+
|
|
200
|
+
${I.passed ? "✓ OVERALL PASSED" : "✗ OVERALL FAILED"}
|
|
201
|
+
|
|
202
|
+
Iteration Results:
|
|
203
|
+
` + n.runs.map(
|
|
204
|
+
(g, R) => `Iteration ${R + 1}: ${g.passed ? "✓ PASSED" : "✗ FAILED"}${g.reason ? " - " + g.reason : ""}`
|
|
205
|
+
).join(`
|
|
206
|
+
`), i.value[i.value.length - 1].testResult = I;
|
|
207
|
+
} catch (n) {
|
|
208
|
+
t.value = n instanceof Error ? n.message : "An unknown error occurred", u.value[m] = {
|
|
209
|
+
passed: !1,
|
|
210
|
+
reason: `Error: ${t.value}`
|
|
211
|
+
};
|
|
212
|
+
} finally {
|
|
213
|
+
a.value = !1;
|
|
214
|
+
}
|
|
215
|
+
}, X = async () => {
|
|
216
|
+
if (!(a.value || !f.value)) {
|
|
217
|
+
C.value = !0, i.value = [], i.value.push({
|
|
218
|
+
role: "user",
|
|
219
|
+
content: "RUNNING ALL TESTS IN SEQUENCE (5 iterations each)"
|
|
220
|
+
});
|
|
221
|
+
try {
|
|
222
|
+
for (let n = 0; n < $.value.length; n++)
|
|
223
|
+
await W(n), n < $.value.length - 1 && await new Promise((I) => setTimeout(I, 500));
|
|
224
|
+
const m = Object.values(u.value).filter((n) => n == null ? void 0 : n.passed).length, c = Object.values(u.value).filter(
|
|
225
|
+
(n) => n && !n.passed
|
|
226
|
+
).length;
|
|
227
|
+
i.value.push({
|
|
228
|
+
role: "user",
|
|
229
|
+
content: `ALL TESTS COMPLETED: ${m} passed, ${c} failed`
|
|
230
|
+
});
|
|
231
|
+
} catch (m) {
|
|
232
|
+
t.value = m instanceof Error ? m.message : "An unknown error occurred";
|
|
233
|
+
} finally {
|
|
234
|
+
C.value = !1;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
return x(() => {
|
|
239
|
+
o.value.length === 0 && (t.value = "No LLM connections found. Please add connections in the sidebar.");
|
|
240
|
+
}), {
|
|
241
|
+
messages: i,
|
|
242
|
+
userInput: h,
|
|
243
|
+
isLoading: a,
|
|
244
|
+
isRunningAll: C,
|
|
245
|
+
error: t,
|
|
246
|
+
selectedProvider: f,
|
|
247
|
+
availableProviders: o,
|
|
248
|
+
isProviderSelected: S,
|
|
249
|
+
messagesContainer: l,
|
|
250
|
+
getConnectionStatus: M,
|
|
251
|
+
sendPrompt: N,
|
|
252
|
+
scenarios: $,
|
|
253
|
+
runScenario: W,
|
|
254
|
+
scenarioResults: u,
|
|
255
|
+
testRunDetails: b,
|
|
256
|
+
runAllScenarios: X
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}), pe = { class: "debug-container" }, me = { class: "llm-chat-container" }, he = { class: "connection-controls" }, ve = { class: "provider-selector" }, fe = ["value"], ge = { key: 0 }, ye = {
|
|
260
|
+
key: 0,
|
|
261
|
+
class: "error-message"
|
|
262
|
+
}, Ce = {
|
|
263
|
+
class: "chat-messages",
|
|
264
|
+
ref: "messagesContainer"
|
|
265
|
+
}, be = { class: "message-header" }, Ie = {
|
|
266
|
+
key: 0,
|
|
267
|
+
class: "model-info"
|
|
268
|
+
}, we = { class: "message-content" }, Le = {
|
|
269
|
+
key: 0,
|
|
270
|
+
class: "failure-reason"
|
|
271
|
+
}, Se = { class: "input-container" }, Te = ["disabled"], Ae = ["disabled"], Re = { class: "scenarios-container" }, $e = { class: "section-header" }, ke = { class: "header-controls" }, Pe = ["disabled"], Me = {
|
|
272
|
+
key: 0,
|
|
273
|
+
class: "pass-indicator text-small"
|
|
274
|
+
}, Ne = { class: "scenarios-list" }, Ee = ["onClick"], De = { class: "scenario-name" }, _e = { class: "scenario-description" }, Ue = {
|
|
275
|
+
key: 0,
|
|
276
|
+
class: "scenario-result-indicator"
|
|
277
|
+
}, Ve = {
|
|
278
|
+
key: 0,
|
|
279
|
+
class: "pass-indicator"
|
|
280
|
+
}, Oe = {
|
|
281
|
+
key: 1,
|
|
282
|
+
class: "fail-indicator"
|
|
283
|
+
}, Fe = {
|
|
284
|
+
key: 1,
|
|
285
|
+
class: "test-run-details"
|
|
286
|
+
};
|
|
287
|
+
function qe(e, s, i, h, a, C) {
|
|
288
|
+
return d(), p("div", pe, [
|
|
289
|
+
r("div", me, [
|
|
290
|
+
s[6] || (s[6] = r("div", { class: "section-header" }, [
|
|
291
|
+
O(" LLM Validation "),
|
|
292
|
+
r("span", { class: "text-faint text-small" }, "Test that your LLM connection will deliver acceptable experience.")
|
|
293
|
+
], -1)),
|
|
294
|
+
r("div", he, [
|
|
295
|
+
r("div", ve, [
|
|
296
|
+
s[5] || (s[5] = r("label", { for: "provider-select" }, "Provider:", -1)),
|
|
297
|
+
Y(r("select", {
|
|
298
|
+
id: "provider-select",
|
|
299
|
+
"onUpdate:modelValue": s[0] || (s[0] = (t) => e.selectedProvider = t)
|
|
300
|
+
}, [
|
|
301
|
+
(d(!0), p(B, null, j(e.availableProviders, (t) => (d(), p("option", {
|
|
302
|
+
key: t,
|
|
303
|
+
value: t
|
|
304
|
+
}, [
|
|
305
|
+
O(w(t) + " ", 1),
|
|
306
|
+
e.getConnectionStatus(t) ? (d(), p("span", ge, " (" + w(e.getConnectionStatus(t)) + ") ", 1)) : T("", !0)
|
|
307
|
+
], 8, fe))), 128))
|
|
308
|
+
], 512), [
|
|
309
|
+
[ee, e.selectedProvider]
|
|
310
|
+
]),
|
|
311
|
+
r("span", {
|
|
312
|
+
class: P(["status-indicator", e.getConnectionStatus(e.selectedProvider)])
|
|
313
|
+
}, null, 2)
|
|
314
|
+
])
|
|
315
|
+
]),
|
|
316
|
+
e.error ? (d(), p("div", ye, w(e.error), 1)) : T("", !0),
|
|
317
|
+
r("div", Ce, [
|
|
318
|
+
(d(!0), p(B, null, j(e.messages, (t, l) => (d(), p("div", {
|
|
319
|
+
key: l,
|
|
320
|
+
class: P(["message", t.role])
|
|
321
|
+
}, [
|
|
322
|
+
r("div", be, [
|
|
323
|
+
r("strong", null, w(t.role === "user" ? "You" : "AI"), 1),
|
|
324
|
+
t.role === "assistant" && t.modelInfo ? (d(), p("span", Ie, w(t.modelInfo.totalTokens) + " tokens ", 1)) : T("", !0)
|
|
325
|
+
]),
|
|
326
|
+
r("div", we, [
|
|
327
|
+
r("pre", null, w(t.content), 1)
|
|
328
|
+
]),
|
|
329
|
+
t.testResult ? (d(), p("div", {
|
|
330
|
+
key: 0,
|
|
331
|
+
class: P(["test-result", t.testResult.passed ? "passed" : "failed"])
|
|
332
|
+
}, [
|
|
333
|
+
O(" Test: " + w(t.testResult.passed ? "PASSED ✓" : "FAILED ✗") + " ", 1),
|
|
334
|
+
t.testResult.passed ? T("", !0) : (d(), p("div", Le, w(t.testResult.reason), 1))
|
|
335
|
+
], 2)) : T("", !0)
|
|
336
|
+
], 2))), 128))
|
|
337
|
+
], 512),
|
|
338
|
+
r("div", Se, [
|
|
339
|
+
Y(r("textarea", {
|
|
340
|
+
"onUpdate:modelValue": s[1] || (s[1] = (t) => e.userInput = t),
|
|
341
|
+
onKeydown: s[2] || (s[2] = te(ne((...t) => e.sendPrompt && e.sendPrompt(...t), ["ctrl"]), ["enter"])),
|
|
342
|
+
placeholder: "Type your message here... (Ctrl+Enter to send)",
|
|
343
|
+
disabled: e.isLoading || !e.isProviderSelected
|
|
344
|
+
}, " ", 40, Te), [
|
|
345
|
+
[se, e.userInput]
|
|
346
|
+
]),
|
|
347
|
+
r("button", {
|
|
348
|
+
onClick: s[3] || (s[3] = (...t) => e.sendPrompt && e.sendPrompt(...t)),
|
|
349
|
+
disabled: e.isLoading || !e.userInput.trim() || !e.isProviderSelected
|
|
350
|
+
}, w(e.isLoading ? "Sending..." : "Send"), 9, Ae)
|
|
351
|
+
])
|
|
352
|
+
]),
|
|
353
|
+
r("div", Re, [
|
|
354
|
+
r("div", $e, [
|
|
355
|
+
s[7] || (s[7] = O(" Test Scenarios ", -1)),
|
|
356
|
+
r("div", ke, [
|
|
357
|
+
r("button", {
|
|
358
|
+
onClick: s[4] || (s[4] = (...t) => e.runAllScenarios && e.runAllScenarios(...t)),
|
|
359
|
+
disabled: e.isLoading || !e.isProviderSelected,
|
|
360
|
+
class: "run-all-button"
|
|
361
|
+
}, w(e.isRunningAll ? "Running..." : "Run All Tests"), 9, Pe),
|
|
362
|
+
Object.values(e.scenarioResults).length == e.scenarios.length && Object.values(e.scenarioResults).every((t) => t == null ? void 0 : t.passed) ? (d(), p("span", Me, "✓ All passed, LLM integration should meet expectations!")) : T("", !0)
|
|
363
|
+
])
|
|
364
|
+
]),
|
|
365
|
+
r("div", Ne, [
|
|
366
|
+
(d(!0), p(B, null, j(e.scenarios, (t, l) => {
|
|
367
|
+
var u;
|
|
368
|
+
return d(), p("div", {
|
|
369
|
+
key: l,
|
|
370
|
+
class: P(["scenario-item", { passed: (u = e.scenarioResults[l]) == null ? void 0 : u.passed }]),
|
|
371
|
+
onClick: (b) => e.runScenario(l)
|
|
372
|
+
}, [
|
|
373
|
+
r("div", De, w(t.name), 1),
|
|
374
|
+
r("div", _e, w(t.description), 1),
|
|
375
|
+
e.scenarioResults[l] ? (d(), p("div", Ue, [
|
|
376
|
+
e.scenarioResults[l].passed ? (d(), p("span", Ve, "✓")) : (d(), p("span", Oe, "✗"))
|
|
377
|
+
])) : T("", !0),
|
|
378
|
+
e.testRunDetails[l] ? (d(), p("div", Fe, w(e.testRunDetails[l].passed) + "/5 runs passed ", 1)) : T("", !0)
|
|
379
|
+
], 10, Ee);
|
|
380
|
+
}), 128))
|
|
381
|
+
])
|
|
382
|
+
])
|
|
383
|
+
]);
|
|
384
|
+
}
|
|
385
|
+
const Be = /* @__PURE__ */ J(ue, [["render", qe], ["__scopeId", "data-v-28356d02"]]);
|
|
386
|
+
function je(e, s) {
|
|
387
|
+
const i = s.name || "Chat Artifacts", h = new ie({
|
|
388
|
+
id: i,
|
|
389
|
+
name: i,
|
|
390
|
+
connection: s.connection,
|
|
391
|
+
storage: "local",
|
|
392
|
+
state: "editing"
|
|
393
|
+
});
|
|
394
|
+
s.imports && (h.imports = s.imports.map((C) => ({ ...C })));
|
|
395
|
+
const a = 20;
|
|
396
|
+
for (const C of e) {
|
|
397
|
+
const t = Ge(C);
|
|
398
|
+
if (!t) continue;
|
|
399
|
+
const { type: l, content: u, name: b, chartConfig: y, height: v } = t, f = h.addItem(l, 0, 0, a, v, null, b);
|
|
400
|
+
h.gridItems[f].content = u, y && (h.gridItems[f].chartConfig = y);
|
|
401
|
+
}
|
|
402
|
+
return h.changed = !0, h;
|
|
403
|
+
}
|
|
404
|
+
function Ge(e) {
|
|
405
|
+
var s, i, h, a, C, t, l, u, b, y;
|
|
406
|
+
switch (e.type) {
|
|
407
|
+
case "chart": {
|
|
408
|
+
const v = ((s = e.config) == null ? void 0 : s.query) || "";
|
|
409
|
+
return {
|
|
410
|
+
type: F.CHART,
|
|
411
|
+
content: v,
|
|
412
|
+
name: ((i = e.config) == null ? void 0 : i.title) || "Chart",
|
|
413
|
+
chartConfig: (h = e.config) == null ? void 0 : h.chartConfig,
|
|
414
|
+
height: 10
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
case "results": {
|
|
418
|
+
const v = ((a = e.config) == null ? void 0 : a.query) || "";
|
|
419
|
+
return {
|
|
420
|
+
type: F.TABLE,
|
|
421
|
+
content: v,
|
|
422
|
+
name: ((C = e.config) == null ? void 0 : C.title) || "Table",
|
|
423
|
+
height: 10
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
case "markdown": {
|
|
427
|
+
const v = {
|
|
428
|
+
markdown: ((t = e.data) == null ? void 0 : t.markdown) || "",
|
|
429
|
+
query: ((l = e.data) == null ? void 0 : l.query) || ""
|
|
430
|
+
};
|
|
431
|
+
return {
|
|
432
|
+
type: F.MARKDOWN,
|
|
433
|
+
content: v,
|
|
434
|
+
name: ((u = e.config) == null ? void 0 : u.title) || "Markdown",
|
|
435
|
+
height: v.query ? 10 : 4
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
case "code": {
|
|
439
|
+
const v = ((b = e.config) == null ? void 0 : b.language) || "sql", f = e.data || "", $ = `\`\`\`${v}
|
|
440
|
+
${f}
|
|
441
|
+
\`\`\``;
|
|
442
|
+
return {
|
|
443
|
+
type: F.MARKDOWN,
|
|
444
|
+
content: $,
|
|
445
|
+
name: ((y = e.config) == null ? void 0 : y.title) || "Code",
|
|
446
|
+
height: 4
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
default:
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
const We = z({
|
|
454
|
+
name: "LLMChatDebugComponent",
|
|
455
|
+
components: {
|
|
456
|
+
LLMChatSplitView: le,
|
|
457
|
+
LLMValidationView: Be,
|
|
458
|
+
DashboardImportSelector: re
|
|
459
|
+
},
|
|
460
|
+
props: {
|
|
461
|
+
initialProvider: {
|
|
462
|
+
type: String,
|
|
463
|
+
default: ""
|
|
464
|
+
},
|
|
465
|
+
initialModel: {
|
|
466
|
+
type: String,
|
|
467
|
+
default: ""
|
|
468
|
+
},
|
|
469
|
+
initialTab: {
|
|
470
|
+
type: String,
|
|
471
|
+
default: ""
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
setup(e) {
|
|
475
|
+
const s = k("llmConnectionStore"), i = k("connectionStore"), h = k("queryExecutionService"), a = k("chatStore"), C = k("editorStore"), t = k("navigationStore"), l = k("dashboardStore"), u = L(
|
|
476
|
+
e.initialTab === "chat" || e.initialTab === "validation" ? e.initialTab : "chat"
|
|
477
|
+
), b = L(null), y = ce({
|
|
478
|
+
llmConnectionStore: s,
|
|
479
|
+
connectionStore: i,
|
|
480
|
+
queryExecutionService: h,
|
|
481
|
+
chatStore: a,
|
|
482
|
+
editorStore: C,
|
|
483
|
+
navigationStore: t
|
|
484
|
+
});
|
|
485
|
+
U(
|
|
486
|
+
() => e.initialTab,
|
|
487
|
+
(o) => {
|
|
488
|
+
(o === "chat" || o === "validation") && (u.value = o);
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
const v = async () => {
|
|
492
|
+
var S;
|
|
493
|
+
const o = ((S = a == null ? void 0 : a.activeChat) == null ? void 0 : S.llmConnectionName) || s.activeConnection;
|
|
494
|
+
if (o && s.getConnectionStatus(o) === "disabled")
|
|
495
|
+
try {
|
|
496
|
+
await s.resetConnection(o);
|
|
497
|
+
} catch (A) {
|
|
498
|
+
console.error("Failed to auto-connect LLM:", A);
|
|
499
|
+
}
|
|
500
|
+
}, f = async () => {
|
|
501
|
+
if (!i || !(a != null && a.activeChat)) return;
|
|
502
|
+
const o = a.activeChat.dataConnectionName;
|
|
503
|
+
if (!o) return;
|
|
504
|
+
const S = i.connections[o];
|
|
505
|
+
if (!S) return;
|
|
506
|
+
if (i.connectionStateToStatus(S) === "disabled")
|
|
507
|
+
try {
|
|
508
|
+
await i.resetConnection(o);
|
|
509
|
+
} catch (A) {
|
|
510
|
+
console.error("Failed to auto-connect DB:", A);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
return U(
|
|
514
|
+
() => u.value,
|
|
515
|
+
(o) => {
|
|
516
|
+
o === "chat" && (v(), f());
|
|
517
|
+
},
|
|
518
|
+
{ immediate: !0 }
|
|
519
|
+
), a && (U(
|
|
520
|
+
() => {
|
|
521
|
+
var o;
|
|
522
|
+
return (o = a == null ? void 0 : a.activeChat) == null ? void 0 : o.dataConnectionName;
|
|
523
|
+
},
|
|
524
|
+
(o) => {
|
|
525
|
+
u.value === "chat" && o && f();
|
|
526
|
+
}
|
|
527
|
+
), U(
|
|
528
|
+
() => {
|
|
529
|
+
var o;
|
|
530
|
+
return (o = a == null ? void 0 : a.activeChat) == null ? void 0 : o.llmConnectionName;
|
|
531
|
+
},
|
|
532
|
+
(o) => {
|
|
533
|
+
u.value === "chat" && o && v();
|
|
534
|
+
}
|
|
535
|
+
)), {
|
|
536
|
+
activeView: u,
|
|
537
|
+
chatSplitView: b,
|
|
538
|
+
handlePublishArtifacts: () => {
|
|
539
|
+
if (!l) {
|
|
540
|
+
console.error("Dashboard store not available");
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
const o = a == null ? void 0 : a.activeChat;
|
|
544
|
+
if (!o || o.artifacts.length === 0) {
|
|
545
|
+
console.warn("No artifacts to publish");
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
const S = o.dataConnectionName || "";
|
|
549
|
+
if (!S) {
|
|
550
|
+
console.error("No data connection associated with this chat");
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
let M = o.name || "Chat Artifacts", A = M, V = 1;
|
|
554
|
+
for (; l.getDashboardByName(A); )
|
|
555
|
+
A = `${M} (${V})`, V++;
|
|
556
|
+
const N = je(o.artifacts, {
|
|
557
|
+
name: A,
|
|
558
|
+
connection: S,
|
|
559
|
+
imports: o.imports.map((E) => ({
|
|
560
|
+
id: E.id,
|
|
561
|
+
name: E.name,
|
|
562
|
+
alias: E.alias || ""
|
|
563
|
+
}))
|
|
564
|
+
});
|
|
565
|
+
l.addDashboard(N), l.setActiveDashboard(N.id), t && t.setActiveDashboard(N.id);
|
|
566
|
+
},
|
|
567
|
+
// Spread all chat composable returns
|
|
568
|
+
...y
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
}), Qe = { class: "llm-view-container" }, Ye = { class: "view-tabs" }, He = {
|
|
572
|
+
key: 0,
|
|
573
|
+
class: "chat-view"
|
|
574
|
+
}, Ke = ["disabled"], ze = {
|
|
575
|
+
key: 0,
|
|
576
|
+
class: "mdi mdi-auto-fix"
|
|
577
|
+
}, Je = {
|
|
578
|
+
key: 1,
|
|
579
|
+
class: "spinner"
|
|
580
|
+
}, Xe = { class: "chat-header-controls" }, Ze = {
|
|
581
|
+
key: 1,
|
|
582
|
+
class: "connection-info"
|
|
583
|
+
};
|
|
584
|
+
function xe(e, s, i, h, a, C) {
|
|
585
|
+
const t = G("dashboard-import-selector"), l = G("l-l-m-chat-split-view"), u = G("l-l-m-validation-view");
|
|
586
|
+
return d(), p("div", Qe, [
|
|
587
|
+
r("div", Ye, [
|
|
588
|
+
r("button", {
|
|
589
|
+
class: P(["view-tab", { active: e.activeView === "chat" }]),
|
|
590
|
+
onClick: s[0] || (s[0] = (b) => e.activeView = "chat"),
|
|
591
|
+
"data-testid": "llm-view-tab-chat"
|
|
592
|
+
}, " Chat ", 2),
|
|
593
|
+
r("button", {
|
|
594
|
+
class: P(["view-tab", { active: e.activeView === "validation" }]),
|
|
595
|
+
onClick: s[1] || (s[1] = (b) => e.activeView = "validation"),
|
|
596
|
+
"data-testid": "llm-view-tab-validation"
|
|
597
|
+
}, " Validation Tests ", 2)
|
|
598
|
+
]),
|
|
599
|
+
e.activeView === "chat" ? (d(), p("div", He, [
|
|
600
|
+
ae(l, {
|
|
601
|
+
ref: "chatSplitView",
|
|
602
|
+
title: e.activeChatTitle,
|
|
603
|
+
editableTitle: !0,
|
|
604
|
+
placeholder: "Ask about your data... (Enter to send)",
|
|
605
|
+
systemPrompt: e.chatSystemPrompt,
|
|
606
|
+
connectionInfo: e.chatConnectionInfo,
|
|
607
|
+
availableImports: e.availableImportsForChat,
|
|
608
|
+
activeImports: e.activeImportsForChat,
|
|
609
|
+
symbols: e.chatSymbols,
|
|
610
|
+
initialMessages: e.activeChatMessages,
|
|
611
|
+
initialArtifacts: e.activeChatArtifacts,
|
|
612
|
+
initialActiveArtifactIndex: e.activeChatArtifactIndex,
|
|
613
|
+
externalLoading: e.isChatLoading,
|
|
614
|
+
activeToolName: e.activeToolName,
|
|
615
|
+
onSendMessage: e.handleChatMessageWithTools,
|
|
616
|
+
"onUpdate:messages": e.handleMessagesUpdate,
|
|
617
|
+
"onUpdate:artifacts": e.handleArtifactsUpdate,
|
|
618
|
+
"onUpdate:activeArtifactIndex": e.handleActiveArtifactUpdate,
|
|
619
|
+
onImportChange: e.handleImportChange,
|
|
620
|
+
onTitleUpdate: e.handleTitleUpdate,
|
|
621
|
+
onPublishArtifacts: e.handlePublishArtifacts
|
|
622
|
+
}, {
|
|
623
|
+
"header-prefix": K(() => [
|
|
624
|
+
r("button", {
|
|
625
|
+
class: P(["auto-name-btn", { "is-loading": e.isGeneratingName }]),
|
|
626
|
+
onClick: s[2] || (s[2] = (...b) => e.generateChatName && e.generateChatName(...b)),
|
|
627
|
+
disabled: e.isGeneratingName || e.activeChatMessages.length === 0,
|
|
628
|
+
title: "Auto-generate chat name",
|
|
629
|
+
"data-testid": "auto-name-chat-btn"
|
|
630
|
+
}, [
|
|
631
|
+
e.isGeneratingName ? (d(), p("span", Je)) : (d(), p("i", ze))
|
|
632
|
+
], 10, Ke)
|
|
633
|
+
]),
|
|
634
|
+
"header-actions": K(() => [
|
|
635
|
+
r("div", Xe, [
|
|
636
|
+
e.availableImportsForChat.length > 0 ? (d(), H(t, {
|
|
637
|
+
key: 0,
|
|
638
|
+
"available-imports": e.availableImportsForChat,
|
|
639
|
+
"active-imports": e.activeImportsForChat,
|
|
640
|
+
"onUpdate:imports": e.handleImportChange
|
|
641
|
+
}, null, 8, ["available-imports", "active-imports", "onUpdate:imports"])) : T("", !0),
|
|
642
|
+
e.chatConnectionInfo ? (d(), p("span", Ze, w(e.chatConnectionInfo), 1)) : T("", !0)
|
|
643
|
+
])
|
|
644
|
+
]),
|
|
645
|
+
_: 1
|
|
646
|
+
}, 8, ["title", "systemPrompt", "connectionInfo", "availableImports", "activeImports", "symbols", "initialMessages", "initialArtifacts", "initialActiveArtifactIndex", "externalLoading", "activeToolName", "onSendMessage", "onUpdate:messages", "onUpdate:artifacts", "onUpdate:activeArtifactIndex", "onImportChange", "onTitleUpdate", "onPublishArtifacts"])
|
|
647
|
+
])) : (d(), H(u, {
|
|
648
|
+
key: 1,
|
|
649
|
+
initialProvider: e.initialProvider
|
|
650
|
+
}, null, 8, ["initialProvider"]))
|
|
651
|
+
]);
|
|
652
|
+
}
|
|
653
|
+
const nt = /* @__PURE__ */ J(We, [["render", xe], ["__scopeId", "data-v-1adde99f"]]);
|
|
654
|
+
export {
|
|
655
|
+
nt as default
|
|
656
|
+
};
|