Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release merge rc into main #3079

Merged
merged 24 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5839ebf
chore: vitest mitgration
tracy-french Nov 20, 2024
5d4ecac
fix(react-components): allow vertical legend reszing when title prese…
ssjagad Nov 20, 2024
5041aa2
fix: build conflicts
Nov 21, 2024
a03fbb0
fix: dashboard editor grid dot
Nov 21, 2024
9f271ca
fix: assistant failing to fetch
Nov 21, 2024
ac5a618
feat: improve prompt engering for assistant dashboard
Nov 22, 2024
25c456c
chore: adjust documentation links and have the same README to all pac…
Nov 22, 2024
e65ae4b
chore: vitest mitgration
tracy-french Nov 20, 2024
833f3e7
chore: force update packages
tracy-french Nov 21, 2024
c282317
fix: missing package-lock.json updates
tracy-french Nov 25, 2024
d8ea960
chore: move doc-site to apps dir
tracy-french Nov 25, 2024
2dc39f5
docs: installation dev guide
tracy-french Nov 25, 2024
7a3ecdc
chore: shard dashboard playwright tests in CI
tracy-french Nov 25, 2024
289c135
fix: fix time series data hook reactivity
jmbuss Nov 25, 2024
135bc48
chore: add assistant documentation, overview, kpi, gauge, chart, tabl…
Nov 22, 2024
18385e6
fix: disable chatbot button when assistant is loading, improve error …
Nov 25, 2024
67bfe3b
chore: get started page updates
Nov 26, 2024
7d33668
chore: move dashboard dev env + msw to separate packages for reuse
tracy-french Nov 26, 2024
7999974
fix: type-fest dep
tracy-french Nov 26, 2024
3204abc
chore: update lodash imports to use esm
tracy-french Nov 26, 2024
71bae9c
chore: specified permissions need for dashboard to operate in docs
chejimmy Nov 27, 2024
09a7874
fix: exports
tracy-french Nov 27, 2024
2160f88
fix: doc site assistant pages
tracy-french Nov 27, 2024
2b1a541
fix: doc site import
tracy-french Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: improve prompt engering for assistant dashboard
  • Loading branch information
Fernando Pauer authored and fpauer committed Nov 22, 2024
commit ac5a618589fd0bd7b2d65b6888a96f64fdcfc0b2
48 changes: 34 additions & 14 deletions packages/dashboard/src/components/assistant/chatbot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,36 @@ export const Chatbot: FC<AssistantChatbotProps> = (
.map((item) => getContextByComponent(item.widgetId))
.join('');

const utterance = contexts.includes('alarmName')
? EVENT_SUMMARY_DEFAULT_UTTERANCE
: SITUATION_SUMMARY_DEFAULT_UTTERANCE;
generateSummary({
componentId: 'dashboard',
target: 'dashboard',
conversationId: assistant.conversationId,
context: contexts,
utterance,
});
const hasAlarms = contexts.includes('alarmName');

let totalSelected = 0;
assistant.selectedQueries.forEach(
(q) => (totalSelected += q.selectedProperties)
);

if (hasAlarms) {
generateSummary({
componentId: 'dashboard',
target: 'dashboard',
conversationId: assistant.conversationId,
context: contexts,
utterance:
totalSelected === 1
? EVENT_SUMMARY_DEFAULT_UTTERANCE
: 'generate summaries and compare and return the response in markdown format.',
});
} else {
generateSummary({
componentId: 'dashboard',
target: 'dashboard',
conversationId: assistant.conversationId,
context: contexts,
utterance:
totalSelected > 1
? 'generate property summaries and compare and return the response in markdown format.'
: SITUATION_SUMMARY_DEFAULT_UTTERANCE,
});
}
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand All @@ -85,14 +105,14 @@ export const Chatbot: FC<AssistantChatbotProps> = (
]);

const handleSubmit = (utterance: string) => {
const componentContext = assistant.callerComponentId
? getContextByComponent(assistant.callerComponentId)
: '';
const contexts = assistant.selectedQueries
.map((item) => getContextByComponent(item.widgetId))
.join('');
invokeAssistant({
componentId: assistant.callerComponentId ?? 'chatbot',
conversationId: assistant.conversationId,
utterance,
context: componentContext,
context: contexts,
target: 'dashboard',
});
};
Expand Down
5 changes: 5 additions & 0 deletions packages/react-components/src/common/assistantProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ export type AssistantActionType =
| 'clear-selection';
export type AssistantWidgetTypes = 'kpi' | 'gauge' | 'table' | 'chart';
export type ComponentId = string;

export type AlarmAssistantContext = {
assetId?: string;
alarmName?: string;
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useMemo } from 'react';
import { bisector } from 'd3-array';
import { uniqWith } from 'lodash';
import { type AlarmContent } from '../../alarm-components/alarm-content/types';
import { type AlarmAssistantContext } from '../../assistant-common/types';
import type { AlarmAssistantContext } from '../../../common/assistantProps';

const interpolateY = (
point1: DataPointWithAlarm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { type TrendCursorValues } from '../../../../echarts/extensions/trendCurs
import { useDataStreamMaxMin } from '../../hooks/useDataStreamMaxMin';
import { type MinMaxMap } from '../../store/dataStreamMinMaxStore';
import type { TableProps } from '@cloudscape-design/components/table';
import type { AssistantProperty } from '../../../../common/assistantProps';
import { type AlarmAssistantContext } from '../../../assistant-common/types';
import type {
AssistantProperty,
AlarmAssistantContext,
} from '../../../../common/assistantProps';

type LegendTableDataStream = Pick<
DataStream,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type DataStream, type Primitive } from '@iot-app-kit/core';
import { type AlarmAssistantContext } from '../../../assistant-common/types';
import type { AlarmAssistantContext } from '../../../../common/assistantProps';

export type TrendCursorValues = { [id in string]?: number };
export type DataStreamInformation = Pick<
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export type {
AssistantActionType,
AssistantProperty,
AssistantWidgetTypes,
AlarmAssistantContext,
} from './common/assistantProps';
export { AssistantChatbot } from './components/assistant-chatbot';
export {
Expand Down
Loading