@finos/legend-lego 2.0.194 → 2.0.195
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/LegendAITypes.d.ts +0 -33
- package/lib/legend-ai/LegendAITypes.d.ts.map +1 -1
- package/lib/legend-ai/LegendAITypes.js +1 -39
- package/lib/legend-ai/LegendAITypes.js.map +1 -1
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.d.ts +1 -96
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.d.ts.map +1 -1
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.js +0 -56
- package/lib/legend-ai/LegendAI_LegendApplicationPlugin_Extension.js.map +1 -1
- package/lib/legend-ai/__test-utils__/LegendAITestUtils.d.ts.map +1 -1
- package/lib/legend-ai/__test-utils__/LegendAITestUtils.js +0 -6
- package/lib/legend-ai/__test-utils__/LegendAITestUtils.js.map +1 -1
- package/lib/legend-ai/components/LegendAIChat.d.ts +1 -2
- package/lib/legend-ai/components/LegendAIChat.d.ts.map +1 -1
- package/lib/legend-ai/components/LegendAIChat.js +10 -14
- package/lib/legend-ai/components/LegendAIChat.js.map +1 -1
- package/lib/legend-ai/index.d.ts +2 -5
- package/lib/legend-ai/index.d.ts.map +1 -1
- package/lib/legend-ai/index.js +2 -5
- package/lib/legend-ai/index.js.map +1 -1
- package/lib/legend-ai/stores/LegendAIChatState.d.ts +5 -12
- package/lib/legend-ai/stores/LegendAIChatState.d.ts.map +1 -1
- package/lib/legend-ai/stores/LegendAIChatState.js +69 -604
- package/lib/legend-ai/stores/LegendAIChatState.js.map +1 -1
- package/package.json +5 -5
- package/src/legend-ai/LegendAITypes.ts +1 -51
- package/src/legend-ai/LegendAI_LegendApplicationPlugin_Extension.ts +0 -169
- package/src/legend-ai/__test-utils__/LegendAITestUtils.ts +0 -9
- package/src/legend-ai/components/LegendAIChat.tsx +26 -74
- package/src/legend-ai/index.ts +0 -18
- package/src/legend-ai/stores/LegendAIChatState.ts +128 -1039
- package/tsconfig.json +0 -3
- package/lib/legend-ai/components/LegendAIAnalysisPanel.d.ts +0 -24
- package/lib/legend-ai/components/LegendAIAnalysisPanel.d.ts.map +0 -1
- package/lib/legend-ai/components/LegendAIAnalysisPanel.js +0 -35
- package/lib/legend-ai/components/LegendAIAnalysisPanel.js.map +0 -1
- package/lib/legend-ai/components/LegendAIAnalysisUtils.d.ts +0 -23
- package/lib/legend-ai/components/LegendAIAnalysisUtils.d.ts.map +0 -1
- package/lib/legend-ai/components/LegendAIAnalysisUtils.js +0 -168
- package/lib/legend-ai/components/LegendAIAnalysisUtils.js.map +0 -1
- package/lib/legend-ai/components/LegendAICharts.d.ts +0 -25
- package/lib/legend-ai/components/LegendAICharts.d.ts.map +0 -1
- package/lib/legend-ai/components/LegendAICharts.js +0 -70
- package/lib/legend-ai/components/LegendAICharts.js.map +0 -1
- package/src/legend-ai/components/LegendAIAnalysisPanel.tsx +0 -102
- package/src/legend-ai/components/LegendAIAnalysisUtils.ts +0 -226
- package/src/legend-ai/components/LegendAICharts.tsx +0 -166
|
@@ -14,14 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
useMemo,
|
|
19
|
-
useCallback,
|
|
20
|
-
useState,
|
|
21
|
-
useRef,
|
|
22
|
-
useEffect,
|
|
23
|
-
useLayoutEffect,
|
|
24
|
-
} from 'react';
|
|
17
|
+
import { useMemo, useCallback, useState, useRef, useEffect } from 'react';
|
|
25
18
|
import {
|
|
26
19
|
SendIcon,
|
|
27
20
|
LoadingIcon,
|
|
@@ -30,11 +23,6 @@ import {
|
|
|
30
23
|
TableIcon,
|
|
31
24
|
CopyIcon,
|
|
32
25
|
RefreshIcon,
|
|
33
|
-
CheckIcon,
|
|
34
|
-
TimesIcon,
|
|
35
|
-
CaretDownIcon,
|
|
36
|
-
CaretRightIcon,
|
|
37
|
-
DotIcon,
|
|
38
26
|
MarkdownTextViewer,
|
|
39
27
|
} from '@finos/legend-art';
|
|
40
28
|
import { noop } from '@finos/legend-shared';
|
|
@@ -184,17 +172,13 @@ export function buildSuggestedQueries(
|
|
|
184
172
|
].slice(0, MAX_SUGGESTED_QUERIES);
|
|
185
173
|
}
|
|
186
174
|
|
|
187
|
-
|
|
175
|
+
function renderStepStatusIcon(
|
|
188
176
|
status: LegendAIThinkingStepStatus,
|
|
189
177
|
): React.ReactNode {
|
|
190
178
|
if (status === LegendAIThinkingStepStatus.ACTIVE) {
|
|
191
179
|
return <LoadingIcon isLoading={true} />;
|
|
192
180
|
}
|
|
193
|
-
return status === LegendAIThinkingStepStatus.DONE ?
|
|
194
|
-
<CheckIcon />
|
|
195
|
-
) : (
|
|
196
|
-
<TimesIcon />
|
|
197
|
-
);
|
|
181
|
+
return status === LegendAIThinkingStepStatus.DONE ? '\u2713' : '\u2717';
|
|
198
182
|
}
|
|
199
183
|
|
|
200
184
|
const AssistantMessageView = (props: {
|
|
@@ -202,15 +186,9 @@ const AssistantMessageView = (props: {
|
|
|
202
186
|
isThinkingVisible: boolean;
|
|
203
187
|
onToggleThinking: () => void;
|
|
204
188
|
onSuggestedQueryClick?: (query: string) => void;
|
|
205
|
-
onFallbackAction?: (messageId: string) => void;
|
|
206
189
|
}): React.ReactNode => {
|
|
207
|
-
const {
|
|
208
|
-
|
|
209
|
-
isThinkingVisible,
|
|
210
|
-
onToggleThinking,
|
|
211
|
-
onSuggestedQueryClick,
|
|
212
|
-
onFallbackAction,
|
|
213
|
-
} = props;
|
|
190
|
+
const { msg, isThinkingVisible, onToggleThinking, onSuggestedQueryClick } =
|
|
191
|
+
props;
|
|
214
192
|
|
|
215
193
|
const [sqlCopied, setSqlCopied] = useState(false);
|
|
216
194
|
const copyTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(
|
|
@@ -255,7 +233,7 @@ const AssistantMessageView = (props: {
|
|
|
255
233
|
onClick={onToggleThinking}
|
|
256
234
|
>
|
|
257
235
|
<span className="legend-ai__thinking-toggle-icon">
|
|
258
|
-
{isThinkingVisible ?
|
|
236
|
+
{isThinkingVisible ? '\u25BC' : '\u25B6'}
|
|
259
237
|
</span>
|
|
260
238
|
Thought for {msg.thinkingDuration ?? '...'}s
|
|
261
239
|
</button>
|
|
@@ -264,7 +242,7 @@ const AssistantMessageView = (props: {
|
|
|
264
242
|
<div className="legend-ai__thinking-steps">
|
|
265
243
|
{msg.thinkingSteps.map((step) => (
|
|
266
244
|
<div
|
|
267
|
-
key={step.
|
|
245
|
+
key={step.label}
|
|
268
246
|
className={`legend-ai__thinking-step legend-ai__thinking-step--${step.status}`}
|
|
269
247
|
>
|
|
270
248
|
<span className="legend-ai__thinking-step-icon">
|
|
@@ -299,7 +277,7 @@ const AssistantMessageView = (props: {
|
|
|
299
277
|
>
|
|
300
278
|
{sqlCopied ? (
|
|
301
279
|
<span className="legend-ai__sql-copy-btn--copied">
|
|
302
|
-
|
|
280
|
+
\u2713
|
|
303
281
|
</span>
|
|
304
282
|
) : (
|
|
305
283
|
<CopyIcon />
|
|
@@ -319,33 +297,6 @@ const AssistantMessageView = (props: {
|
|
|
319
297
|
</div>
|
|
320
298
|
)}
|
|
321
299
|
|
|
322
|
-
{msg.error && <div className="legend-ai__exec-error">{msg.error}</div>}
|
|
323
|
-
|
|
324
|
-
{msg.gridData && (
|
|
325
|
-
<div className="legend-ai__results-block">
|
|
326
|
-
<div className="legend-ai__results-header">
|
|
327
|
-
<span className="legend-ai__results-header-icon">
|
|
328
|
-
<TableIcon />
|
|
329
|
-
</span>
|
|
330
|
-
<span>Results</span>
|
|
331
|
-
<span className="legend-ai__results-meta">
|
|
332
|
-
{msg.gridData.rowData.length} row
|
|
333
|
-
{msg.gridData.rowData.length === 1 ? '' : 's'}
|
|
334
|
-
{msg.execTime ? (
|
|
335
|
-
<>
|
|
336
|
-
{' '}
|
|
337
|
-
<DotIcon className="legend-ai__results-meta-dot" />{' '}
|
|
338
|
-
{msg.execTime}s
|
|
339
|
-
</>
|
|
340
|
-
) : (
|
|
341
|
-
''
|
|
342
|
-
)}
|
|
343
|
-
</span>
|
|
344
|
-
</div>
|
|
345
|
-
<LegendAIResultGrid data={msg.gridData} />
|
|
346
|
-
</div>
|
|
347
|
-
)}
|
|
348
|
-
|
|
349
300
|
{msg.textAnswer && (
|
|
350
301
|
<div className="legend-ai__text-answer">
|
|
351
302
|
<MarkdownTextViewer
|
|
@@ -355,6 +306,8 @@ const AssistantMessageView = (props: {
|
|
|
355
306
|
</div>
|
|
356
307
|
)}
|
|
357
308
|
|
|
309
|
+
{msg.error && <div className="legend-ai__exec-error">{msg.error}</div>}
|
|
310
|
+
|
|
358
311
|
{!msg.isProcessing &&
|
|
359
312
|
msg.suggestedQueries.length > 0 &&
|
|
360
313
|
onSuggestedQueryClick && (
|
|
@@ -375,19 +328,21 @@ const AssistantMessageView = (props: {
|
|
|
375
328
|
</div>
|
|
376
329
|
)}
|
|
377
330
|
|
|
378
|
-
{msg.
|
|
379
|
-
<
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
331
|
+
{msg.gridData && (
|
|
332
|
+
<div className="legend-ai__results-block">
|
|
333
|
+
<div className="legend-ai__results-header">
|
|
334
|
+
<span className="legend-ai__results-header-icon">
|
|
335
|
+
<TableIcon />
|
|
336
|
+
</span>
|
|
337
|
+
<span>Results</span>
|
|
338
|
+
<span className="legend-ai__results-meta">
|
|
339
|
+
{msg.gridData.rowData.length} row
|
|
340
|
+
{msg.gridData.rowData.length === 1 ? '' : 's'}
|
|
341
|
+
{msg.execTime ? ` \u00B7 ${msg.execTime}s` : ''}
|
|
342
|
+
</span>
|
|
343
|
+
</div>
|
|
344
|
+
<LegendAIResultGrid data={msg.gridData} />
|
|
345
|
+
</div>
|
|
391
346
|
)}
|
|
392
347
|
</div>
|
|
393
348
|
</div>
|
|
@@ -421,7 +376,7 @@ export const LegendAIChat = (props: LegendAIChatProps): React.ReactNode => {
|
|
|
421
376
|
const hasMessages = state.messages.length > 0;
|
|
422
377
|
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
|
423
378
|
|
|
424
|
-
|
|
379
|
+
useEffect(() => {
|
|
425
380
|
const el = textareaRef.current;
|
|
426
381
|
if (el) {
|
|
427
382
|
el.style.height = 'auto';
|
|
@@ -498,9 +453,6 @@ export const LegendAIChat = (props: LegendAIChatProps): React.ReactNode => {
|
|
|
498
453
|
msg={msg}
|
|
499
454
|
isThinkingVisible={isThinkingVisible}
|
|
500
455
|
onToggleThinking={(): void => state.toggleThinking(msgIndex)}
|
|
501
|
-
onFallbackAction={(messageId): void =>
|
|
502
|
-
state.runFallbackAction(messageId)
|
|
503
|
-
}
|
|
504
456
|
onSuggestedQueryClick={(q): void =>
|
|
505
457
|
state.askQuestionWithIntent(
|
|
506
458
|
q,
|
package/src/legend-ai/index.ts
CHANGED
|
@@ -23,7 +23,6 @@ export {
|
|
|
23
23
|
isNumericColumn,
|
|
24
24
|
isDateColumn,
|
|
25
25
|
buildSuggestedQueries,
|
|
26
|
-
renderStepStatusIcon,
|
|
27
26
|
} from './components/LegendAIChat.js';
|
|
28
27
|
export { LegendAIErrorBoundary } from './components/LegendAIErrorBoundary.js';
|
|
29
28
|
export {
|
|
@@ -32,7 +31,6 @@ export {
|
|
|
32
31
|
addThinkingStep,
|
|
33
32
|
completeThinkingSteps,
|
|
34
33
|
finishWithThinkingError,
|
|
35
|
-
classifyError,
|
|
36
34
|
buildConversationHistory,
|
|
37
35
|
buildGenerationFailureMessage,
|
|
38
36
|
buildExecutionErrorMessage,
|
|
@@ -43,22 +41,6 @@ export {
|
|
|
43
41
|
processQuestion,
|
|
44
42
|
processQuestionWithIntent,
|
|
45
43
|
handleMetadataQuestion,
|
|
46
|
-
elapsedSeconds,
|
|
47
|
-
createMessagePair,
|
|
48
|
-
analyzeOrchestratorResults,
|
|
49
44
|
type MessageSetter,
|
|
50
|
-
type LegendAIOperationContext,
|
|
51
45
|
} from './stores/LegendAIChatState.js';
|
|
52
46
|
export { LegendAIResultGrid } from './components/LegendAIResultGrid.js';
|
|
53
|
-
export { LegendAIAnalysisPanel } from './components/LegendAIAnalysisPanel.js';
|
|
54
|
-
export {
|
|
55
|
-
LegendAIBarChart,
|
|
56
|
-
LegendAIDonutChart,
|
|
57
|
-
} from './components/LegendAICharts.js';
|
|
58
|
-
export {
|
|
59
|
-
computeKeyMetrics,
|
|
60
|
-
computeChartData,
|
|
61
|
-
inferChartType,
|
|
62
|
-
computeTopItems,
|
|
63
|
-
findNumericColumnName,
|
|
64
|
-
} from './components/LegendAIAnalysisUtils.js';
|