Browse Source

feat: action label and details for adding a SCADA symbol to the widgets library

pull/16833/head
Igor Kulikov 2 weeks ago
parent
commit
d2b97f2a9d
  1. 9
      ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts
  2. 1
      ui-ngx/src/app/modules/home/components/ai/ai-action.models.ts
  3. 6
      ui-ngx/src/assets/locale/locale.constant-en_US.json

9
ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts

@ -1660,6 +1660,15 @@ function describe(tool: string, values: Values, result: unknown, names: AiDetail
return {hood, blocks: [...(rows.length ? [{type: 'facts' as const, rows}] : []),
...(warnings.length ? [{type: 'list' as const, label: text('widget-warnings'), rows: warnings.slice(0, MAX_ROWS)}] : [])]};
}
case 'create_scada_symbol_widget': {
const raw = typeof result === 'string' && result.startsWith('OK: ') ? aiParse(result.slice(4)) : result;
const name = (isObject(raw) ? str(raw.name) : undefined) ?? str(values.name) ?? '—';
if (!isObject(raw)) {
return {hood: text('create-scada-symbol-widget', {name}), blocks: generic(raw, 'result')};
}
const rows = facts(raw, ['widgetTypeId']);
return {hood: text('create-scada-symbol-widget', {name}), blocks: rows.length ? [{type: 'facts', rows}] : []};
}
case 'check_scada_symbol': {
if (!isObject(result)) {
return {hood: text('check-scada-symbol'), blocks: generic(result, 'result')};

1
ui-ngx/src/app/modules/home/components/ai/ai-action.models.ts

@ -106,6 +106,7 @@ const TOOL_WORDS: Record<string, string> = {
create_scada_symbol: 'copy-scada-symbol',
update_scada_symbol: 'update-scada-symbol',
check_scada_symbol: 'check-scada-symbol',
create_scada_symbol_widget: 'create-scada-symbol-widget',
save_two_factor_settings: 'save-two-factor-settings',
save_oauth2_domain: 'save-oauth2-domain',
read_my_account: 'read-my-account',

6
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -985,6 +985,7 @@
"copy-scada-symbol": "Copied the SCADA symbol as {{name}}",
"change-scada-symbol": "Changed the SCADA symbol {{name}}",
"check-scada-symbol": "Ran the SCADA symbol",
"create-scada-symbol-widget": "Added {{name}} to the widgets library",
"scada-symbol-check-clean": "Rendered without errors",
"scada-symbol-check-not-rendered": "The symbol did not render",
"scada-symbol-behaviors": "Behaviors",
@ -1647,6 +1648,10 @@
"run": "Running the SCADA symbol",
"done": "Ran the SCADA symbol"
},
"create-scada-symbol-widget": {
"run": "Adding the symbol to the widgets library",
"done": "Added the symbol to the widgets library"
},
"read-widget-parts": {
"run": "Reading the widget's {{parts}}",
"done": "Read the widget's {{parts}}"
@ -2234,6 +2239,7 @@
"scada-tags": "Search tags",
"scada-copyOf": "Copy of",
"scada-changed": "Changed",
"scada-bundle": "Bundle",
"format": "Format",
"templateType": "Template type",
"added": "Added",

Loading…
Cancel
Save