@finos/legend-lego 2.0.201 → 2.0.203
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/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/legend-ai/LegendAIDocEnrichment.d.ts +34 -1
- package/lib/legend-ai/LegendAIDocEnrichment.d.ts.map +1 -1
- package/lib/legend-ai/LegendAIDocEnrichment.js +890 -1
- package/lib/legend-ai/LegendAIDocEnrichment.js.map +1 -1
- package/lib/legend-ai/LegendAIServiceRetrieval.d.ts +36 -0
- package/lib/legend-ai/LegendAIServiceRetrieval.d.ts.map +1 -0
- package/lib/legend-ai/LegendAIServiceRetrieval.js +179 -0
- package/lib/legend-ai/LegendAIServiceRetrieval.js.map +1 -0
- package/lib/legend-ai/LegendAITypes.d.ts +62 -2
- package/lib/legend-ai/LegendAITypes.d.ts.map +1 -1
- package/lib/legend-ai/LegendAITypes.js +56 -30
- package/lib/legend-ai/LegendAITypes.js.map +1 -1
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.d.ts +29 -6
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.d.ts.map +1 -1
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.js +9 -0
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.js.map +1 -1
- package/lib/legend-ai/__test-utils__/LegendAITestUtils.d.ts +5 -0
- package/lib/legend-ai/__test-utils__/LegendAITestUtils.d.ts.map +1 -1
- package/lib/legend-ai/__test-utils__/LegendAITestUtils.js +18 -2
- package/lib/legend-ai/__test-utils__/LegendAITestUtils.js.map +1 -1
- package/lib/legend-ai/components/LegendAIAnalysisPanel.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAIAnalysisPanel.js +27 -8
- package/lib/legend-ai/components/LegendAIAnalysisPanel.js.map +1 -1
- package/lib/legend-ai/components/LegendAIAnalysisUtils.d.ts +1 -0
- package/lib/legend-ai/components/LegendAIAnalysisUtils.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAIAnalysisUtils.js +144 -22
- package/lib/legend-ai/components/LegendAIAnalysisUtils.js.map +1 -1
- package/lib/legend-ai/components/LegendAICharts.d.ts +4 -0
- package/lib/legend-ai/components/LegendAICharts.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAICharts.js +60 -1
- package/lib/legend-ai/components/LegendAICharts.js.map +1 -1
- package/lib/legend-ai/components/LegendAIChat.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAIChat.js +46 -17
- package/lib/legend-ai/components/LegendAIChat.js.map +1 -1
- package/lib/legend-ai/components/LegendAIChatHelpers.d.ts +1 -1
- package/lib/legend-ai/components/LegendAIChatHelpers.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAIChatHelpers.js +220 -15
- package/lib/legend-ai/components/LegendAIChatHelpers.js.map +1 -1
- package/lib/legend-ai/components/LegendAIChatInput.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAIChatInput.js +1 -0
- package/lib/legend-ai/components/LegendAIChatInput.js.map +1 -1
- package/lib/legend-ai/components/LegendAIScopeSelector.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAIScopeSelector.js +5 -2
- package/lib/legend-ai/components/LegendAIScopeSelector.js.map +1 -1
- package/lib/legend-ai/index.d.ts +4 -3
- package/lib/legend-ai/index.d.ts.map +1 -1
- package/lib/legend-ai/index.js +4 -3
- package/lib/legend-ai/index.js.map +1 -1
- package/lib/legend-ai/stores/LegendAIChatProcessors.d.ts +30 -13
- package/lib/legend-ai/stores/LegendAIChatProcessors.d.ts.map +1 -1
- package/lib/legend-ai/stores/LegendAIChatProcessors.js +776 -216
- package/lib/legend-ai/stores/LegendAIChatProcessors.js.map +1 -1
- package/lib/legend-ai/stores/LegendAIChatState.d.ts +2 -2
- package/lib/legend-ai/stores/LegendAIChatState.d.ts.map +1 -1
- package/lib/legend-ai/stores/LegendAIChatState.js +26 -25
- package/lib/legend-ai/stores/LegendAIChatState.js.map +1 -1
- package/package.json +3 -3
- package/src/legend-ai/LegendAIDocEnrichment.ts +1198 -1
- package/src/legend-ai/LegendAIServiceRetrieval.ts +228 -0
- package/src/legend-ai/LegendAITypes.ts +138 -32
- package/src/legend-ai/LegendAI_LegendApplicationPlugin_Extension.ts +62 -0
- package/src/legend-ai/__test-utils__/LegendAITestUtils.ts +28 -0
- package/src/legend-ai/components/LegendAIAnalysisPanel.tsx +36 -17
- package/src/legend-ai/components/LegendAIAnalysisUtils.ts +178 -22
- package/src/legend-ai/components/LegendAICharts.tsx +160 -0
- package/src/legend-ai/components/LegendAIChat.tsx +107 -14
- package/src/legend-ai/components/LegendAIChatHelpers.ts +334 -20
- package/src/legend-ai/components/LegendAIChatInput.tsx +2 -1
- package/src/legend-ai/components/LegendAIScopeSelector.tsx +7 -2
- package/src/legend-ai/index.ts +22 -1
- package/src/legend-ai/stores/LegendAIChatProcessors.ts +1205 -321
- package/src/legend-ai/stores/LegendAIChatState.ts +80 -69
- package/tsconfig.json +1 -0
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type LegendAIProductMetadata,
|
|
26
26
|
type LegendAIScopeItem,
|
|
27
27
|
type LegendAIQuestionIntent,
|
|
28
|
+
type LegendAIModelContext,
|
|
28
29
|
LegendAIMessageRole,
|
|
29
30
|
} from '../LegendAITypes.js';
|
|
30
31
|
import {
|
|
@@ -48,6 +49,7 @@ export const useLegendAIChatState = (
|
|
|
48
49
|
plugin: LegendAI_LegendApplicationPlugin_Extension,
|
|
49
50
|
dataProductCoordinates?: LegendAIOrchestratorDataProductCoordinates,
|
|
50
51
|
pureExecutionContext?: QueryExplicitExecutionContextInfo,
|
|
52
|
+
modelContext?: LegendAIModelContext,
|
|
51
53
|
): LegendAIChatState => {
|
|
52
54
|
const LEGEND_AI_MCP_SCOPE_ID = 'legend-ai-mcp';
|
|
53
55
|
const [questionText, setQuestionText] = useState('');
|
|
@@ -196,37 +198,39 @@ export const useLegendAIChatState = (
|
|
|
196
198
|
|
|
197
199
|
const askQuestion = useCallback(
|
|
198
200
|
(): void =>
|
|
199
|
-
dispatchQuestion(questionText, (trimmed, history) =>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
201
|
+
dispatchQuestion(questionText, (trimmed, history) => {
|
|
202
|
+
const operationContext = {
|
|
203
|
+
config: configForRequest,
|
|
204
|
+
plugin,
|
|
205
|
+
history,
|
|
206
|
+
setMessages,
|
|
207
|
+
};
|
|
208
|
+
if (
|
|
209
|
+
selectedScopes.some((scope) => scope.id === LEGEND_AI_MCP_SCOPE_ID) &&
|
|
210
|
+
configForRequest.orchestratorUrl &&
|
|
211
|
+
dataProductCoordinates
|
|
212
|
+
) {
|
|
213
|
+
return processQuestionViaOrchestrator(
|
|
214
|
+
trimmed,
|
|
215
|
+
dataProductCoordinates,
|
|
216
|
+
metadata,
|
|
217
|
+
operationContext,
|
|
218
|
+
pureExecutionContext,
|
|
219
|
+
undefined,
|
|
220
|
+
modelContext,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
return processQuestion(
|
|
224
|
+
trimmed,
|
|
225
|
+
services,
|
|
226
|
+
coordinates,
|
|
227
|
+
metadata,
|
|
228
|
+
operationContext,
|
|
229
|
+
dataProductCoordinates,
|
|
230
|
+
pureExecutionContext,
|
|
231
|
+
modelContext,
|
|
232
|
+
);
|
|
233
|
+
}),
|
|
230
234
|
[
|
|
231
235
|
questionText,
|
|
232
236
|
dispatchQuestion,
|
|
@@ -238,49 +242,52 @@ export const useLegendAIChatState = (
|
|
|
238
242
|
dataProductCoordinates,
|
|
239
243
|
pureExecutionContext,
|
|
240
244
|
selectedScopes,
|
|
245
|
+
modelContext,
|
|
241
246
|
],
|
|
242
247
|
);
|
|
243
248
|
|
|
244
249
|
const askQuestionWithIntent = useCallback(
|
|
245
250
|
(text: string, intent: LegendAIQuestionIntent): void =>
|
|
246
|
-
dispatchQuestion(text, (trimmed, history) =>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
251
|
+
dispatchQuestion(text, (trimmed, history) => {
|
|
252
|
+
const operationContext = {
|
|
253
|
+
config: configForRequest,
|
|
254
|
+
plugin,
|
|
255
|
+
history,
|
|
256
|
+
setMessages,
|
|
257
|
+
};
|
|
258
|
+
if (
|
|
259
|
+
selectedScopes.some((scope) => scope.id === LEGEND_AI_MCP_SCOPE_ID) &&
|
|
260
|
+
configForRequest.orchestratorUrl &&
|
|
261
|
+
dataProductCoordinates
|
|
262
|
+
) {
|
|
263
|
+
return processQuestionViaOrchestrator(
|
|
264
|
+
trimmed,
|
|
265
|
+
dataProductCoordinates,
|
|
266
|
+
metadata,
|
|
267
|
+
operationContext,
|
|
268
|
+
pureExecutionContext,
|
|
269
|
+
undefined,
|
|
270
|
+
modelContext,
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
return processQuestionWithIntent(
|
|
274
|
+
trimmed,
|
|
275
|
+
intent,
|
|
276
|
+
services,
|
|
277
|
+
coordinates,
|
|
278
|
+
metadata,
|
|
279
|
+
operationContext,
|
|
280
|
+
dataProductCoordinates
|
|
281
|
+
? {
|
|
282
|
+
dataProductCoordinates,
|
|
283
|
+
...(pureExecutionContext === undefined
|
|
284
|
+
? {}
|
|
285
|
+
: { pureExecutionContext }),
|
|
286
|
+
}
|
|
287
|
+
: undefined,
|
|
288
|
+
modelContext,
|
|
289
|
+
);
|
|
290
|
+
}),
|
|
284
291
|
[
|
|
285
292
|
dispatchQuestion,
|
|
286
293
|
services,
|
|
@@ -291,6 +298,7 @@ export const useLegendAIChatState = (
|
|
|
291
298
|
dataProductCoordinates,
|
|
292
299
|
pureExecutionContext,
|
|
293
300
|
selectedScopes,
|
|
301
|
+
modelContext,
|
|
294
302
|
],
|
|
295
303
|
);
|
|
296
304
|
|
|
@@ -338,6 +346,8 @@ export const useLegendAIChatState = (
|
|
|
338
346
|
setMessages,
|
|
339
347
|
},
|
|
340
348
|
pureExecutionContext,
|
|
349
|
+
undefined,
|
|
350
|
+
modelContext,
|
|
341
351
|
)
|
|
342
352
|
.catch(noop)
|
|
343
353
|
.finally(() => {
|
|
@@ -353,6 +363,7 @@ export const useLegendAIChatState = (
|
|
|
353
363
|
plugin,
|
|
354
364
|
dataProductCoordinates,
|
|
355
365
|
pureExecutionContext,
|
|
366
|
+
modelContext,
|
|
356
367
|
],
|
|
357
368
|
);
|
|
358
369
|
|
package/tsconfig.json
CHANGED
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"./src/data-grid/index.ts",
|
|
55
55
|
"./src/graph-editor/index.ts",
|
|
56
56
|
"./src/legend-ai/LegendAIDocEnrichment.ts",
|
|
57
|
+
"./src/legend-ai/LegendAIServiceRetrieval.ts",
|
|
57
58
|
"./src/legend-ai/LegendAITypes.ts",
|
|
58
59
|
"./src/legend-ai/LegendAI_LegendApplicationPlugin_Extension.ts",
|
|
59
60
|
"./src/legend-ai/index.ts",
|