diff --git a/ui-ngx/src/app/core/services/ai-assistant-config.service.ts b/ui-ngx/src/app/core/services/ai-assistant-config.service.ts index 7b63f2a8c4..b1474c28bb 100644 --- a/ui-ngx/src/app/core/services/ai-assistant-config.service.ts +++ b/ui-ngx/src/app/core/services/ai-assistant-config.service.ts @@ -29,5 +29,3 @@ export class AiAssistantConfigService { }; } } - -export const isEdgeScope = (scope: string): boolean => scope === 'edge' || scope === 'edges'; diff --git a/ui-ngx/src/app/core/services/ai-assistant-panel.service.ts b/ui-ngx/src/app/core/services/ai-assistant-panel.service.ts index aa19e75779..357e284df0 100644 --- a/ui-ngx/src/app/core/services/ai-assistant-panel.service.ts +++ b/ui-ngx/src/app/core/services/ai-assistant-panel.service.ts @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { computed, DestroyRef, inject, Injectable, OnDestroy, signal } from '@angular/core'; +import { computed, DestroyRef, effect, inject, Injectable, OnDestroy, signal } from '@angular/core'; import { defer, Observable, Subject } from 'rxjs'; import { distinctUntilChanged, filter, finalize, map } from 'rxjs/operators'; import { NavigationEnd, NavigationStart, Router } from '@angular/router'; @@ -33,9 +33,17 @@ export class AiAssistantPanelService implements OnDestroy { private static readonly WITHOUT_PANEL = ['/home', '/ai-assistant']; - private _open = signal(false); + private static readonly OPEN_KEY = 'tb-ai-panel-open'; + private static readonly CHATS_KEY = 'tb-ai-panel-chats'; + + private _open = signal(AiAssistantPanelService.readSession(AiAssistantPanelService.OPEN_KEY) === 'true'); readonly open = this._open.asReadonly(); + private openSync = effect(() => AiAssistantPanelService.writeSession(AiAssistantPanelService.OPEN_KEY, this._open() ? 'true' : null)); + + private _restored = signal(this._open()); + readonly restored = this._restored.asReadonly(); + private _suppressed = signal(false); readonly suppressed = this._suppressed.asReadonly(); @@ -56,7 +64,7 @@ export class AiAssistantPanelService implements OnDestroy { private _chats = signal(null); readonly chats = this._chats.asReadonly(); - private _lastChatIdByContext = new Map(); + private _lastChatIdByContext = AiAssistantPanelService.readChats(); private static readonly AUTO_APPROVE_STORAGE_KEY = 'aiAssistantAutoApproveChats'; @@ -93,6 +101,40 @@ export class AiAssistantPanelService implements OnDestroy { }); })(); + private static readSession(key: string): string | null { + try { + return sessionStorage.getItem(key); + } catch { + return null; + } + } + + private static writeSession(key: string, value: string | null): void { + try { + if (value === null) { + sessionStorage.removeItem(key); + } else { + sessionStorage.setItem(key, value); + } + } catch { + return; + } + } + + private static readChats(): Map { + try { + const stored = JSON.parse(AiAssistantPanelService.readSession(AiAssistantPanelService.CHATS_KEY) ?? '{}'); + return new Map(Object.entries(stored).filter((entry): entry is [string, string] => typeof entry[1] === 'string')); + } catch { + return new Map(); + } + } + + private storeChats(): void { + AiAssistantPanelService.writeSession(AiAssistantPanelService.CHATS_KEY, + this._lastChatIdByContext.size ? JSON.stringify(Object.fromEntries(this._lastChatIdByContext)) : null); + } + private static withoutPanel(url: string): boolean { const path = (url || '/').split(/[?#]/)[0]; return path === '/' || AiAssistantPanelService.WITHOUT_PANEL.some(page => path === page || path.startsWith(page + '/')); @@ -144,11 +186,13 @@ export class AiAssistantPanelService implements OnDestroy { } if (key !== null) { this._lastChatIdByContext.set(key, carried.chatId); + this.storeChats(); } return carried.chatId; } toggle(): void { + this._restored.set(false); this._open.update(open => !open); } @@ -172,6 +216,7 @@ export class AiAssistantPanelService implements OnDestroy { this._lastChatIdByContext.delete(key); } } + this.storeChats(); } updateChatAutoApprove(chatId: string, autoApprove: boolean): void { @@ -276,6 +321,7 @@ export class AiAssistantPanelService implements OnDestroy { } else { this._lastChatIdByContext.delete(key); } + this.storeChats(); } lastChatIdForContext(): string | undefined { @@ -284,10 +330,12 @@ export class AiAssistantPanelService implements OnDestroy { } close(): void { + this._restored.set(false); this._open.set(false); } openPanel(): void { + this._restored.set(false); this._open.set(true); } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts b/ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts index ac3ec73a8e..dadb0040e3 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts @@ -1751,6 +1751,59 @@ function describe(tool: string, values: Values, result: unknown, names: AiDetail } return {hood: str(values.menuId) ? text('save-custom-menu') : text('create-custom-menu', {name: str(values.name) ?? '—'}), blocks}; } + case 'read_edges': { + if (!isObject(result)) { + return {hood: text('read-edges'), blocks: generic(result, 'result')}; + } + if (Array.isArray(result.edges)) { + const counts: AiDetailFact[] = Object.entries(isObject(result.connection) ? result.connection : {}) + .map(([state, count]) => ({label: aiHumanize(state), raw: true, value: String(count)})); + const rows = result.edges.filter(isObject).slice(0, MAX_ROWS) + .map(edge => [edge.name, edge.connection, str(edge.version)].filter(Boolean).join(' · ')); + const blocks: AiDetailBlock[] = counts.length ? [{type: 'facts', rows: counts}] : []; + if (rows.length) { + blocks.push({type: 'list', rows}); + } + return {hood: text('read-edges'), blocks}; + } + const rows = facts(result, ['id', 'assigned', 'missingRuleChains']); + const blocks: AiDetailBlock[] = rows.length ? [{type: 'facts', rows}] : []; + const assigned = isObject(result.assigned) ? result.assigned : {}; + const lines: string[] = []; + for (const [kind, items] of Object.entries(assigned)) { + if (Array.isArray(items) && items.length) { + lines.push(`${aiHumanize(kind)}: ${items.filter(isObject).map(item => item.name).join(', ')}`); + } else if (isObject(items)) { + for (const [groupType, groups] of Object.entries(items)) { + if (Array.isArray(groups) && groups.length) { + lines.push(`${aiHumanize(groupType)}: ${groups.filter(isObject).map(group => group.name).join(', ')}`); + } + } + } + } + if (lines.length) { + blocks.push({type: 'list', label: text('edge-assigned'), rows: lines.slice(0, MAX_ROWS)}); + } + return {hood: text('read-edge', {name: str(result.name) ?? '—'}), blocks}; + } + case 'read_edge_events': { + if (!isObject(result)) { + return {hood: text('read-edge-events'), blocks: generic(result, 'result')}; + } + const counts: AiDetailFact[] = Object.entries(isObject(result.counts) ? result.counts : {}) + .map(([state, count]) => ({label: aiHumanize(state), raw: true, value: String(count)})); + const rows = (Array.isArray(result.downlinks) ? result.downlinks.filter(isObject) : []).slice(0, MAX_ROWS) + .map(event => [event.status, event.type, event.action, str(event.time) ? new Date(event.time).toLocaleString() : undefined] + .filter(Boolean).join(' · ')); + const blocks: AiDetailBlock[] = counts.length ? [{type: 'facts', rows: counts}] : []; + if (rows.length) { + blocks.push({type: 'list', rows}); + } + return {hood: text('read-edge-events'), blocks}; + } + case 'read_edge_instructions': + return {hood: text(values.upgrade ? 'read-edge-upgrade-instructions' : 'read-edge-install-instructions'), + blocks: typeof result === 'string' && result.trim() ? [{type: 'markdown', text: result}] : []}; case 'read_ota': { if (!isObject(result)) { return {hood: text('read-ota'), blocks: generic(result, 'result')}; @@ -1770,6 +1823,117 @@ function describe(tool: string, values: Values, result: unknown, names: AiDetail } return {hood: text('read-ota', {count: Number(result.devices) || 0}), blocks}; } + case 'save_edge': + return {hood: text(str(values.edgeId) ? 'update-edge' : 'create-edge', {name: str(values.name) ?? '—'}), blocks: generic(result, 'result')}; + case 'assign_to_edge': { + const done = isObject(result) && Array.isArray(result.done) ? result.done.map(String) : []; + const failed = isObject(result) && Array.isArray(result.failed) ? result.failed.filter(isObject) : []; + const blocks: AiDetailBlock[] = []; + if (done.length) { + blocks.push({type: 'list', label: text('alarms-done'), rows: done.slice(0, MAX_ROWS)}); + } + if (failed.length) { + blocks.push({type: 'list', label: text('alarms-failed'), rows: failed.slice(0, MAX_ROWS).map(row => `${row.item}: ${row.error}`)}); + } + if (isObject(result) && result.missingRuleChains) { + blocks.push({type: 'list', label: text('edge-missing-rule-chains'), rows: [typeof result.missingRuleChains === 'string' + ? result.missingRuleChains : JSON.stringify(result.missingRuleChains)]}); + } + return {hood: text('assign-to-edge'), blocks: blocks.length ? blocks : generic(result, 'result')}; + } + case 'read_agents': { + if (!isObject(result)) { + return {hood: text('read-agents'), blocks: generic(result, 'result')}; + } + if (Array.isArray(result.agents)) { + const rows = result.agents.filter(isObject).slice(0, MAX_ROWS) + .map(agent => [agent.name, agent.online ? '●' : '○', str(agent.version), str(agent.profile)].filter(Boolean).join(' · ')); + return {hood: text('read-agents'), blocks: rows.length ? [{type: 'list', rows}] : []}; + } + const blocks: AiDetailBlock[] = []; + const apps = Array.isArray(result.applications) ? result.applications.filter(isObject) : []; + if (apps.length) { + blocks.push({type: 'list', label: text('agent-applications'), rows: apps.slice(0, MAX_ROWS) + .map(app => [app.name, app.appType, str(app.version), str(app.upgradeTo) ? '→ ' + app.upgradeTo : undefined].filter(Boolean).join(' · '))}); + } + const units = Array.isArray(result.units) ? result.units.filter(isObject) : []; + if (units.length) { + blocks.push({type: 'list', label: text('agent-units'), rows: units.slice(0, MAX_ROWS) + .map(unit => [unit.type, unit.name, str(unit.state)].filter(Boolean).join(' · '))}); + } + const ops = Array.isArray(result.recentOperations) ? result.recentOperations.filter(isObject) : []; + if (ops.length) { + blocks.push({type: 'list', label: text('agent-operations'), rows: ops.slice(0, MAX_ROWS) + .map(op => [op.action, str(op.application), op.status, str(op.error)].filter(Boolean).join(' · '))}); + } + return {hood: text('read-agent', {name: str(result.name) ?? '—'}), blocks}; + } + case 'read_agent_instructions': + return {hood: text('read-agent-instructions'), blocks: typeof result === 'string' && result.trim() ? [{type: 'markdown', text: result}] : []}; + case 'read_agent_profiles': { + if (!isObject(result)) { + return {hood: text('read-agent-profiles'), blocks: generic(result, 'result')}; + } + const list = (key: string) => Array.isArray(result[key]) ? (result[key] as unknown[]).filter(isObject) : []; + const rows = [...list('agentProfiles').map(profile => [profile.name, profile.provisionType, profile.default ? '★' : undefined]), + ...list('appProfiles').map(profile => [profile.name, profile.appType, str(profile.templateVersion)])] + .slice(0, MAX_ROWS).map(row => row.filter(Boolean).map(String).join(' · ')); + if (Array.isArray(result.versions)) { + rows.push(...result.versions.map(String).slice(0, MAX_ROWS)); + } + return {hood: text('read-agent-profiles'), blocks: rows.length ? [{type: 'list', rows}] : generic(result, 'result')}; + } + case 'save_agent': + return {hood: text(str(values.agentId) ? 'update-agent' : 'create-agent', {name: str(values.name) ?? '—'}), blocks: generic(result, 'result')}; + case 'install_agent_application': + case 'run_agent_operation': + case 'save_agent_profile': + case 'save_agent_app_profile': + case 'run_agent_bulk_action': + return {hood: text(tool.replace(/_/g, '-')), blocks: generic(result, 'result')}; + case 'wait_agent_operation': { + if (!isObject(result)) { + return {hood: text('wait-agent-operation'), blocks: typeof result === 'string' && result.trim() ? [{type: 'markdown', text: result}] : []}; + } + const rows = facts(result, ['operationId']); + return {hood: text('wait-agent-operation'), blocks: rows.length ? [{type: 'facts', rows}] : []}; + } + case 'read_rule_chain_templates': { + if (!isObject(result)) { + return {hood: text('read-rule-chain-templates'), blocks: generic(result, 'result')}; + } + const templates = Array.isArray(result.templates) ? result.templates.filter(isObject) : []; + if (templates.length || !str(result.name)) { + const blocks: AiDetailBlock[] = []; + const roots = templates.filter(template => template.edgeTemplateRoot).map(template => String(template.name)); + const auto = templates.filter(template => template.autoAssignToNewEdges).map(template => String(template.name)); + if (roots.length) { + blocks.push({type: 'list', label: text('rule-chain-template-root'), rows: roots}); + } + if (auto.length) { + blocks.push({type: 'list', label: text('rule-chain-template-auto'), rows: auto.slice(0, MAX_ROWS)}); + } + const rows = templates.slice(0, MAX_ROWS).map(template => String(template.name)); + if (rows.length) { + blocks.push({type: 'list', rows}); + } + return {hood: text('read-rule-chain-templates'), blocks}; + } + const blocks: AiDetailBlock[] = []; + const edges = Array.isArray(result.assignedToEdges) ? result.assignedToEdges.map(String) : []; + if (edges.length) { + blocks.push({type: 'list', label: text('rule-chain-template-edges'), rows: edges.slice(0, MAX_ROWS)}); + } + const nodes = Array.isArray(result.nodes) ? result.nodes.map(String) : []; + if (nodes.length) { + blocks.push({type: 'list', label: text('rule-chain-template-nodes'), rows: nodes.slice(0, MAX_ROWS)}); + } + return {hood: text('read-rule-chain-template', {name: str(result.name) ?? '—'}), blocks}; + } + case 'set_rule_chain_template': + return {hood: text('set-rule-chain-template'), blocks: typeof result === 'string' && result.trim() ? [{type: 'markdown', text: result}] : []}; + case 'sync_edge': + return {hood: text('sync-edge'), blocks: []}; case 'save_ota_package': return {hood: text('save-ota-package', {name: [str(values.title), str(values.version)].filter(Boolean).join(' ') || '—'}), blocks: generic(result, 'result')}; case 'assign_ota_package': { diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts index 7cdac1a95d..0669b0960e 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts @@ -107,7 +107,7 @@ export class AiActionLineComponent { running = computed(() => this.more() > 0 ? this.translate.instant('ai-assistant.work.more', {words: this.runWords(), count: this.more()}) - : this.runWords()); + : this.action().progress ? `${this.runWords()} · ${this.action().progress}` : this.runWords()); outcome = computed(() => { const words = this.outcomeWords(); @@ -135,7 +135,9 @@ export class AiActionLineComponent { detail = computed(() => { const view = aiActionDetailView(this.action(), this.names()); const facts = this.facts(); - return facts.length ? {...view, blocks: [...view.blocks, {type: 'facts' as const, rows: facts}]} : view; + const reason = this.action().status === 'FAILURE' && this.outcomeText() && !view.blocks.length ? this.reason(this.action().result) : undefined; + const blocks = [...view.blocks, ...(reason ? [{type: 'text' as const, text: reason}] : []), ...(facts.length ? [{type: 'facts' as const, rows: facts}] : [])]; + return {...view, blocks}; }); records = computed(() => this.action().status === 'SUCCESS' ? this.action().affectedEntities ?? [] : []); diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-action.models.ts b/ui-ngx/src/app/modules/home/components/ai/ai-action.models.ts index 0dada449a3..303cb96cab 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-action.models.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-action.models.ts @@ -68,6 +68,24 @@ const TOOL_WORDS: Record = { read_versions: 'read-versions', read_gateway_status: 'read-gateway-status', read_ota: 'read-ota', + read_edges: 'read-edges', + read_edge_events: 'read-edge-events', + read_edge_instructions: 'read-edge-instructions', + save_edge: 'save-edge', + assign_to_edge: 'assign-to-edge', + sync_edge: 'sync-edge', + read_rule_chain_templates: 'read-rule-chain-templates', + set_rule_chain_template: 'set-rule-chain-template', + read_agents: 'read-agents', + read_agent_instructions: 'read-agent-instructions', + save_agent: 'save-agent', + install_agent_application: 'install-agent-application', + run_agent_operation: 'run-agent-operation', + read_agent_profiles: 'read-agent-profiles', + save_agent_profile: 'save-agent-profile', + save_agent_app_profile: 'save-agent-app-profile', + run_agent_bulk_action: 'run-agent-bulk-action', + wait_agent_operation: 'wait-agent-operation', read_white_labeling: 'read-white-labeling', read_website_brand: 'read-website-brand', save_white_labeling: 'save-white-labeling', @@ -185,6 +203,10 @@ const DELETED_TARGETS: Record = { ALARM: 'delete-alarm', ASSET: 'delete-asset', OTA_PACKAGE: 'delete-ota-package', + EDGE: 'delete-edge', + AGENT: 'delete-agent', + AGENT_PROFILE: 'delete-agent-profile', + AGENT_APP_PROFILE: 'delete-agent-app-profile', IMAGE: 'delete-image', ENTITY_VIEW: 'delete-entity-view', ASSET_PROFILE: 'delete-asset-profile', @@ -534,6 +556,11 @@ const ENTITY_KINDS: Record = { CONVERTER: {icon: 'transform', palette: 'path'}, CALCULATED_FIELD: {icon: 'functions', palette: 'path'}, RULE_CHAIN: {icon: 'account_tree', palette: 'chain'}, + EDGE_RULE_CHAIN: {icon: 'account_tree', palette: 'chain'}, + AGENT: {icon: 'memory', palette: 'device'}, + AGENT_APPLICATION: {icon: 'apps', palette: 'device'}, + AGENT_PROFILE: {icon: 'badge', palette: 'device'}, + AGENT_APP_PROFILE: {icon: 'inventory_2', palette: 'device'}, IOT_HUB: {icon: 'hub', palette: 'solution'}, ALARM_RULE: {icon: 'rule', palette: 'rule'}, ALARM: {icon: 'notification_important', palette: 'rule'}, diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts index ed935a3106..aac545a1ae 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts @@ -49,11 +49,18 @@ const VALUE_TOKENS: Record = { undo: ['none'], defaultDashboard: ['none'], homeDashboard: ['none'], - clears: ['yes', 'no'] + clears: ['yes', 'no'], + edgeTemplateRoot: ['yes'], + autoAssign: ['yes', 'no'], + removeVolumes: ['yes', 'no'], + default: ['yes'], + operation: ['restart', 'update', 'upgrade', 'delete', 'cancel', 'upgrade agent'] }; const CODE_FIELDS = new Set(['arguments', 'expression', 'output']); +const REVIEW_VERBS = new Set(['install', 'restart', 'update', 'upgrade', 'upgrade-agent', 'delete', 'cancel', 'sync']); + const IMAGE_FIELDS = new Set(['widget-image', 'scada-symbol']); const IMAGE_VALUE = /^(tb-image;|\/api\/images\/|data:image\/)/; @@ -187,6 +194,9 @@ export class AiApprovalCardComponent implements OnChanges { if (this.hubVersionId) { return 'ai-assistant.record.install'; } + if (this.review?.verb && REVIEW_VERBS.has(this.review.verb)) { + return 'ai-assistant.review.verb.' + this.review.verb; + } if (this.isDestructive) { return 'ai-assistant.review.delete'; } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss index 854af67bdc..cfa5fb1bb8 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss @@ -20,6 +20,10 @@ transition: none; } + &.restored { + transition: none; + } + &.open { transform: translateX(0); box-shadow: -1px 0 0 rgba(16, 24, 40, 0.06), -12px 0 32px rgba(16, 24, 40, 0.06); diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts index e6138e44a6..4179aefccd 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts @@ -25,6 +25,7 @@ import { AiChatComponent } from '@home/components/ai/ai-chat.component'; host: { '[class.open]': 'isOpen', '[class.suppressed]': 'panelService.suppressed()', + '[class.restored]': 'panelService.restored()', '[attr.inert]': 'isOpen ? null : ""', '[class.split]': 'split()', '(transitionend)': 'onSlideEnd($event)', @@ -119,6 +120,8 @@ export class AiAssistantPanelComponent { private static readonly WIDTH_KEY = 'tbAiPanelWidth'; + private static readonly APPLIED_WIDTH_KEY = 'tb-ai-panel-applied-width'; + private lastContextKey: string | null = null; private dockedEffect = effect(onCleanup => { @@ -172,6 +175,16 @@ export class AiAssistantPanelComponent { } this.wanted = stored || this.defaultWidth; this.panelWidth = Math.min(this.wanted, this.maxWidth); + let applied = 0; + try { + applied = Number(sessionStorage.getItem(AiAssistantPanelComponent.APPLIED_WIDTH_KEY)) || 0; + } catch { + applied = 0; + } + if (applied) { + this.width.set(applied); + document.documentElement.style.setProperty('--tb-ai-panel-w', applied + 'px'); + } setTimeout(() => this.fit()); } @@ -197,6 +210,11 @@ export class AiAssistantPanelComponent { const value = Math.round(Math.min(this.widest(), Math.max(this.minWidth, width))); this.width.set(value); document.documentElement.style.setProperty('--tb-ai-panel-w', value + 'px'); + try { + sessionStorage.setItem(AiAssistantPanelComponent.APPLIED_WIDTH_KEY, String(value)); + } catch { + return value; + } return value; } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html index d6ec9c00dc..fc521c250e 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html +++ b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html @@ -140,7 +140,9 @@ @if (msg.lead) {

{{ msg.lead }}

} - + @for (key of [decorationKey(msg)]; track key) { + + } @let madeHere = made[$index] ?? []; @for (shown of records[$index] ?? []; track $index) { diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts index 9dfef763f9..04983c1885 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts @@ -215,6 +215,11 @@ export class AiChatMessagesComponent implements OnChanges, OnDestroy { } } + decorationKey(message: ChatMessage): string { + const general = message as GeneralChatMessage; + return `${general.references?.length ?? 0}:${general.severities?.length ?? 0}:${general.readings?.length ?? 0}`; + } + decorateCode(answer: HTMLElement, message?: ChatMessage): void { decorateCodeBlocks(answer, this.translate, text => this.clipboard.copyFromContent(text)); decorateTables(answer); diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-chat.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-chat.component.ts index 1227fa595c..f3e7f5df9f 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-chat.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-chat.component.ts @@ -74,9 +74,9 @@ import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { AiChatTitleComponent } from '@home/components/ai/ai-chat-title.component'; import { AiPromptInputComponent } from '@home/components/ai/ai-prompt-input.component'; -export type AiChatVariant = 'page' | 'panel'; +const PROGRESS_TOOLS = new Set(['wait_agent_operation']); -const LIVE_EDITED_TYPES = new Set([EntityType.DASHBOARD, EntityType.REPORT_TEMPLATE, EntityType.WIDGET_TYPE, EntityType.WIDGETS_BUNDLE, EntityType.TB_RESOURCE]); +export type AiChatVariant = 'page' | 'panel'; @Component({ selector: 'tb-ai-chat', @@ -410,7 +410,6 @@ export class AiChatComponent implements OnInit, OnDestroy { private messageCancelled = false; private shownChatId: string | undefined; private replyingChatId: string | undefined; - private affectedEntities: EntityId[] = []; private appliedEffects = new Set(); private logScrollBottom: number | undefined; @@ -978,6 +977,9 @@ export class AiChatComponent implements OnInit, OnDestroy { this.appendDelta(event.data.text); break; case 'thinking': { + if (event.data?.headline && !event.data.tool && this.showProgress(event.data.headline)) { + break; + } const headline = this.thinkingHeadline(event.data); if (headline) { this.work.update(work => ({...(work ?? {moment: 'going-through-results' as AiWorkMoment, since: Date.now()}), headline})); @@ -1010,8 +1012,7 @@ export class AiChatComponent implements OnInit, OnDestroy { } } if (event.data.affectedEntities?.length) { - this.affectedEntities.push(...event.data.affectedEntities); - this.emitDashboards(event.data.affectedEntities); + this.emitUpdated(event.data.affectedEntities); } break; case 'toolStarted': @@ -1131,6 +1132,18 @@ export class AiChatComponent implements OnInit, OnDestroy { this.router.navigate(['/reporting/templates', created.id]); } + private showProgress(progress: string): boolean { + const running = [...this.messages()].reverse() + .find(message => message.from === 'ACTION' && message.data.status === 'RUNNING' && PROGRESS_TOOLS.has(message.data.tool)); + if (running?.from !== 'ACTION') { + return false; + } + const executionId = running.data.executionId; + this.messages.update(list => list.map(message => message.from === 'ACTION' && message.data.executionId === executionId + ? {from: 'ACTION', data: {...message.data, progress}} : message)); + return true; + } + private thinkingHeadline(data: {headline?: string; tool?: string; arguments?: unknown} | undefined): string | undefined { if (data?.tool) { const words = aiActionWords(data.tool, data.arguments); @@ -1195,10 +1208,9 @@ export class AiChatComponent implements OnInit, OnDestroy { this.router.navigate(['/resources/scada-symbols']); } - private emitDashboards(entities: EntityId[]): void { - const edited = entities.filter(entity => LIVE_EDITED_TYPES.has(entity.entityType as EntityType)); - if (edited.length) { - this.panelService.emitUpdatedData(edited); + private emitUpdated(entities: EntityId[]): void { + if (entities.length) { + this.panelService.emitUpdatedData(entities); } } @@ -1293,8 +1305,7 @@ export class AiChatComponent implements OnInit, OnDestroy { } } if (finished.affectedEntities?.length) { - this.affectedEntities.push(...finished.affectedEntities); - this.emitDashboards(finished.affectedEntities); + this.emitUpdated(finished.affectedEntities); } this.messages.update(list => list.map(message => message.from === 'ACTION' && message.data.executionId === finished.executionId ? {from: 'ACTION', data: {...message.data, status: finished.status, durationMs: finished.durationMs, result: finished.result, @@ -1401,11 +1412,6 @@ export class AiChatComponent implements OnInit, OnDestroy { this.stopping.set(false); this.work.set(undefined); this.stopRunningActions(); - const notYetReloaded = this.affectedEntities.filter(entity => !LIVE_EDITED_TYPES.has(entity.entityType as EntityType)); - this.affectedEntities = []; - if (notYetReloaded.length) { - this.panelService.emitUpdatedData(notYetReloaded); - } this.chats.setReplying(this.replyingChatId, false); this.replyingChatId = undefined; } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-references.ts b/ui-ngx/src/app/modules/home/components/ai/ai-references.ts index 9a46641c26..8502f3b378 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-references.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-references.ts @@ -56,6 +56,11 @@ function replaceIn(node: Text, pattern: RegExp, references: AiReference[]): void node.replaceWith(fragment); } +const REFERENCE_PAGES: Record = { + ALARM_RULE: '/alarms/alarm-rules', + EDGE_RULE_CHAIN: '/edgeManagement/templates/ruleChains' +}; + function chip(reference: AiReference): HTMLElement { const kind = aiEntityKind(reference.entityType); const code = document.createElement('code'); @@ -66,7 +71,7 @@ function chip(reference: AiReference): HTMLElement { icon.setAttribute('aria-hidden', 'true'); icon.textContent = kind.icon; code.append(icon, reference.name); - const base = reference.entityType === 'ALARM_RULE' ? '/alarms/alarm-rules' : baseDetailsPageByEntityType.get(reference.entityType as EntityType); + const base = REFERENCE_PAGES[reference.entityType] ?? baseDetailsPageByEntityType.get(reference.entityType as EntityType); if (!base || !reference.id) { return code; } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-welcome.models.ts b/ui-ngx/src/app/modules/home/components/ai/ai-welcome.models.ts index d1cae35431..14d80ce02d 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-welcome.models.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-welcome.models.ts @@ -66,6 +66,29 @@ const WELCOMES: Partial> = { [AiAssistantViewType.INTEGRATION]: {key: 'integration', entity: true, examples: ['connect']}, [AiAssistantViewType.CONVERTER_LIST]: {key: 'converters', examples: ['connect']}, [AiAssistantViewType.CONVERTER]: {key: 'converter', entity: true, examples: ['connect']}, + [AiAssistantViewType.EDGE_LIST]: {key: 'edges', examples: ['offline', 'create']}, + [AiAssistantViewType.EDGE]: {key: 'edge', entity: true, examples: ['status', 'assign', 'install']}, + [AiAssistantViewType.EDGE_GROUP_LIST]: {key: 'edge-groups', owned: true, examples: ['find']}, + [AiAssistantViewType.EDGE_GROUP]: {key: 'edge-group', entity: true, examples: ['status']}, + [AiAssistantViewType.EDGE_SCHEDULER]: {key: 'edge-scheduler', examples: ['assign']}, + [AiAssistantViewType.RULE_CHAIN_TEMPLATE_LIST]: {key: 'rule-chain-templates', examples: ['root', 'hub']}, + [AiAssistantViewType.RULE_CHAIN_TEMPLATE]: {key: 'rule-chain-template', entity: true, examples: ['edges', 'auto']}, + [AiAssistantViewType.INTEGRATION_TEMPLATE_LIST]: {key: 'integration-templates', examples: ['edges']}, + [AiAssistantViewType.INTEGRATION_TEMPLATE]: {key: 'integration-template', entity: true, examples: ['edges']}, + [AiAssistantViewType.CONVERTER_TEMPLATE_LIST]: {key: 'converter-templates', examples: ['explain']}, + [AiAssistantViewType.CONVERTER_TEMPLATE]: {key: 'converter-template', entity: true, examples: ['explain']}, + [AiAssistantViewType.AGENT_LIST]: {key: 'agents', examples: ['status', 'deploy']}, + [AiAssistantViewType.AGENT]: {key: 'agent', entity: true, examples: ['apps', 'edge', 'upgrade']}, + [AiAssistantViewType.AGENT_GROUP_LIST]: {key: 'agent-groups', owned: true, examples: ['find']}, + [AiAssistantViewType.AGENT_GROUP]: {key: 'agent-group', entity: true, examples: ['status']}, + [AiAssistantViewType.AGENT_APPLICATION_LIST]: {key: 'agent-applications', examples: ['status', 'install']}, + [AiAssistantViewType.AGENT_APPLICATION]: {key: 'agent-application', entity: true, examples: ['logs', 'restart']}, + [AiAssistantViewType.AGENT_EVENTS]: {key: 'agent-events', examples: ['failed']}, + [AiAssistantViewType.AGENT_PROFILE_LIST]: {key: 'agent-profiles', examples: ['create', 'default']}, + [AiAssistantViewType.AGENT_PROFILE]: {key: 'agent-profile', entity: true, examples: ['apps', 'bulk']}, + [AiAssistantViewType.AGENT_APP_PROFILE_LIST]: {key: 'agent-app-profiles', examples: ['edge', 'gateway']}, + [AiAssistantViewType.AGENT_APP_PROFILE]: {key: 'agent-app-profile', entity: true, examples: ['explain']}, + [AiAssistantViewType.AGENT_BULK_ACTION]: {key: 'agent-bulk-action', examples: ['progress']}, [AiAssistantViewType.NOTIFICATION_TEMPLATE_LIST]: {key: 'notifications'}, [AiAssistantViewType.NOTIFICATION_RULE_LIST]: {key: 'notifications'}, [AiAssistantViewType.NOTIFICATION_RECIPIENT_LIST]: {key: 'notifications'}, diff --git a/ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.resolver.ts b/ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.resolver.ts index 23e2c92a9e..15f6912b61 100644 --- a/ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/components/group/entity-groups-table-config.resolver.ts @@ -26,13 +26,16 @@ import { AiAssistantConfigService } from '@core/services/ai-assistant-config.ser import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { CustomerId } from '@shared/models/id/customer-id'; import { getCurrentAuthUser } from '@core/auth/auth.selectors'; +import { EdgeId } from '@shared/models/id/edge-id'; const GROUP_LIST_VIEWS = new Map([ [EntityType.ASSET, [AiAssistantViewType.ASSET_GROUP_LIST, AiAssistantViewType.ASSET_GROUP]], [EntityType.ENTITY_VIEW, [AiAssistantViewType.ENTITY_VIEW_GROUP_LIST, AiAssistantViewType.ENTITY_VIEW_GROUP]], [EntityType.DASHBOARD, [AiAssistantViewType.DASHBOARD_GROUP_LIST, AiAssistantViewType.DASHBOARD_GROUP]], [EntityType.CUSTOMER, [AiAssistantViewType.CUSTOMER_GROUP_LIST, AiAssistantViewType.CUSTOMER_GROUP]], - [EntityType.USER, [AiAssistantViewType.USER_GROUP_LIST, AiAssistantViewType.USER_GROUP]] + [EntityType.USER, [AiAssistantViewType.USER_GROUP_LIST, AiAssistantViewType.USER_GROUP]], + [EntityType.EDGE, [AiAssistantViewType.EDGE_GROUP_LIST, AiAssistantViewType.EDGE_GROUP]], + [EntityType.AGENT, [AiAssistantViewType.AGENT_GROUP_LIST, AiAssistantViewType.AGENT_GROUP]] ]); @Injectable() @@ -75,7 +78,7 @@ export class EntityGroupsTableConfigResolver { params ); - const owner = config.customerId && !config.edgeId ? new CustomerId(config.customerId) : undefined; + const owner = config.edgeId ? new EdgeId(config.edgeId) : config.customerId ? new CustomerId(config.customerId) : undefined; if (config.groupType === EntityType.DEVICE) { config.aiAssistantConfig = deviceAiAssistantConfig(this.store, this.userPermissionsService, this.translate, this.userPermissionsService.hasGenericPermission(Resource.DEVICE, Operation.WRITE), diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts index 860dc369a7..cfeca0072a 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { DateEntityTableColumn, @@ -27,10 +27,14 @@ import { AgentAppProfileWizardComponent, AgentAppProfileWizardData } from '@home/pages/agent/wizard/agent-app-profile-wizard.component'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; +import { AiAssistantViewType } from '@shared/models/ai-chat.models'; @Injectable() export class AgentAppProfilesTableConfigResolver { + private aiAssistantConfigService = inject(AiAssistantConfigService); + private readonly config: EntityTableConfig = new EntityTableConfig(); private templateCache = new Map(); @@ -79,6 +83,7 @@ export class AgentAppProfilesTableConfigResolver { this.config.entitiesDeleteEnabled = authUser.authority === Authority.TENANT_ADMIN; this.config.deleteEnabled = () => authUser.authority === Authority.TENANT_ADMIN; this.config.detailsReadonly = () => authUser.authority !== Authority.TENANT_ADMIN; + this.config.aiAssistantConfig = this.aiAssistantConfigService.tableConfig(AiAssistantViewType.AGENT_APP_PROFILE_LIST, AiAssistantViewType.AGENT_APP_PROFILE); return this.config; }) ); diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts index b801de63b5..ef7ecb0967 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { agentEntityUrl, @@ -51,10 +51,15 @@ import { AgentAppInstallWizardResult, isAgentAppUpgradeResult } from '@home/components/agent/wizard/agent-app-install-wizard.component'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; +import { AiAssistantViewType } from '@shared/models/ai-chat.models'; +import { AgentId } from '@shared/models/id/agent-id'; @Injectable() export class AgentApplicationsTableConfigResolver { + private aiAssistantConfigService = inject(AiAssistantConfigService); + private readonly config: EntityTableConfig = new EntityTableConfig(); private agentId: string; private agent: AgentInfo; @@ -108,6 +113,8 @@ export class AgentApplicationsTableConfigResolver { this.config.tableTitle = agent.name + ': ' + this.translate.instant('agent.applications'); this.config.backNavigationCommands = [agentEntityUrl(route, this.agentId)]; this.config.componentsData = { agentId: this.agentId, agent }; + this.config.aiAssistantConfig = this.aiAssistantConfigService.tableConfig(AiAssistantViewType.AGENT_APPLICATION_LIST, + AiAssistantViewType.AGENT_APPLICATION, new AgentId(this.agentId)); this.config.columns = this.configureColumns(); this.config.cellActionDescriptors = this.configureCellActions(); this.config.entitiesFetchFunction = pageLink => diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-group-config.factory.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-group-config.factory.ts index 6fb3c9a787..da9b357712 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-group-config.factory.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-group-config.factory.ts @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { Router, UrlTree } from '@angular/router'; import { Observable } from 'rxjs'; import { mergeMap } from 'rxjs/operators'; @@ -17,10 +17,14 @@ import { HomeDialogsService } from '@home/dialogs/home-dialogs.service'; import { AgentService } from '@core/http/agent.service'; import { AgentInfo } from '@shared/models/agent.models'; import { AgentComponent } from '@home/pages/agent/agent.component'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; +import { AiAssistantViewType } from '@shared/models/ai-chat.models'; @Injectable() export class AgentGroupConfigFactory implements EntityGroupStateConfigFactory { + private aiAssistantConfigService = inject(AiAssistantConfigService); + constructor(private groupConfigTableConfigService: GroupConfigTableConfigService, private translate: TranslateService, private homeDialogs: HomeDialogsService, @@ -32,6 +36,7 @@ export class AgentGroupConfigFactory implements EntityGroupStateConfigFactory(entityGroup, params); config.entityComponent = AgentComponent; + config.aiAssistantConfig = this.aiAssistantConfigService.tableConfig(AiAssistantViewType.AGENT_GROUP, AiAssistantViewType.AGENT, config.entityGroup.id); config.entityTitle = (agent) => agent ? agent.name : ''; config.deleteEntityTitle = agent => this.translate.instant('agent.delete-agent-title', { agentName: agent.name }); diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-profiles-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-profiles-table-config.resolver.ts index 4d7caa6862..cf39d07899 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-profiles-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-profiles-table-config.resolver.ts @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { checkBoxCell, @@ -30,10 +30,14 @@ import { import { AgentProfileCreateDialogService } from '@home/pages/agent/agent-profile-create-dialog.service'; import { DialogService } from '@core/services/dialog.service'; import { of } from 'rxjs'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; +import { AiAssistantViewType } from '@shared/models/ai-chat.models'; @Injectable() export class AgentProfilesTableConfigResolver { + private aiAssistantConfigService = inject(AiAssistantConfigService); + private readonly config: EntityTableConfig = new EntityTableConfig(); constructor(private store: Store, @@ -112,6 +116,7 @@ export class AgentProfilesTableConfigResolver { this.config.deleteEnabled = (profile) => authUser.authority === Authority.TENANT_ADMIN && profile && !profile.default; this.config.entitySelectionEnabled = (profile) => profile && !profile.default; this.config.detailsReadonly = () => authUser.authority !== Authority.TENANT_ADMIN; + this.config.aiAssistantConfig = this.aiAssistantConfigService.tableConfig(AiAssistantViewType.AGENT_PROFILE_LIST, AiAssistantViewType.AGENT_PROFILE); return this.config; }) ); diff --git a/ui-ngx/src/app/modules/home/pages/agent/agents-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/agent/agents-table-config.resolver.ts index 1f429674d1..5379cd1e74 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agents-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agents-table-config.resolver.ts @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { agentEntityUrl, currentAgentRouteSnapshot } from '@home/pages/agent/util/agent-route-params'; import { @@ -54,10 +54,14 @@ import { resolveGroupParams } from '@shared/models/entity-group.models'; import { AllEntitiesTableConfigService } from '@home/components/entity/all-entities-table-config.service'; import { GroupEntityTabsComponent } from '@home/components/group/group-entity-tabs.component'; import { AgentAutoProvisionDialogService } from '@home/components/agent/dialog/agent-auto-provision-dialog.service'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; +import { AiAssistantViewType } from '@shared/models/ai-chat.models'; @Injectable() export class AgentsTableConfigResolver { + private aiAssistantConfigService = inject(AiAssistantConfigService); + private agentErrorEvents = new Map(); constructor(private allEntitiesTableConfigService: AllEntitiesTableConfigService, @@ -109,6 +113,7 @@ export class AgentsTableConfigResolver { config.entitiesDeleteEnabled = config.componentsData.agentScope === 'tenant'; config.deleteEnabled = () => config.componentsData.agentScope === 'tenant'; config.onDestroy = () => this.agentErrorEvents.clear(); + config.aiAssistantConfig = this.aiAssistantConfigService.tableConfig(AiAssistantViewType.AGENT_LIST, AiAssistantViewType.AGENT); return this.allEntitiesTableConfigService.prepareConfiguration(config); }) ); diff --git a/ui-ngx/src/app/modules/home/pages/converter/converters-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/converter/converters-table-config.resolver.ts index 30aa50a781..21dd956121 100644 --- a/ui-ngx/src/app/modules/home/pages/converter/converters-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/converter/converters-table-config.resolver.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BUSL-1.1 import { DestroyRef, inject, Injectable } from '@angular/core'; -import { AiAssistantConfigService, isEdgeScope } from '@core/services/ai-assistant-config.service'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { @@ -139,8 +139,9 @@ export class ConvertersTableConfigResolver { this.config.entitiesFetchFunction = this.configureEntityFunctions(this.config.componentsData.converterScope); defaultEntityTablePermissions(this.userPermissionsService, this.config); - this.config.aiAssistantConfig = isEdgeScope(this.config.componentsData.converterScope) ? null : - this.aiAssistantConfigService.tableConfig(AiAssistantViewType.CONVERTER_LIST, AiAssistantViewType.CONVERTER); + this.config.aiAssistantConfig = this.config.componentsData.converterScope === 'edges' + ? this.aiAssistantConfigService.tableConfig(AiAssistantViewType.CONVERTER_TEMPLATE_LIST, AiAssistantViewType.CONVERTER_TEMPLATE) + : this.aiAssistantConfigService.tableConfig(AiAssistantViewType.CONVERTER_LIST, AiAssistantViewType.CONVERTER); return this.config; } diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-group-config.factory.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-group-config.factory.ts index 5547238815..69a9f27af7 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge-group-config.factory.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge-group-config.factory.ts @@ -8,7 +8,7 @@ import { EntityGroupStateInfo, GroupEntityTableConfig } from '@home/models/group/group-entities-table-config.models'; -import { Inject, Injectable } from '@angular/core'; +import { Inject, Injectable, inject } from '@angular/core'; import { EntityType } from '@shared/models/entity-type.models'; import { mergeMap, tap } from 'rxjs/operators'; import { BroadcastService } from '@core/services/broadcast.service'; @@ -35,10 +35,14 @@ import { EdgeInstructionsDialogComponent, EdgeInstructionsDialogData } from '@home/pages/edge/edge-instructions-dialog.component'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; +import { AiAssistantViewType } from '@shared/models/ai-chat.models'; @Injectable() export class EdgeGroupConfigFactory implements EntityGroupStateConfigFactory { + private aiAssistantConfigService = inject(AiAssistantConfigService); + constructor(private groupConfigTableConfigService: GroupConfigTableConfigService, private userPermissionsService: UserPermissionsService, private store: Store, @@ -58,6 +62,7 @@ export class EdgeGroupConfigFactory implements EntityGroupStateConfigFactory edge ? diff --git a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts index b0bcf69ce9..66f09ed6f0 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors // SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { @@ -54,10 +54,14 @@ import { AgentAutoProvisionDialogComponent } from '@home/components/agent/dialog/agent-auto-provision-dialog.component'; import { AgentApplicationType } from '@shared/models/agent.models'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; +import { AiAssistantViewType } from '@shared/models/ai-chat.models'; @Injectable() export class EdgesTableConfigResolver { + private aiAssistantConfigService = inject(AiAssistantConfigService); + constructor(private allEntitiesTableConfigService: AllEntitiesTableConfigService, private userPermissionsService: UserPermissionsService, private store: Store, @@ -102,6 +106,7 @@ export class EdgesTableConfigResolver { config.groupActionDescriptors = this.configureGroupActions(config); config.addActionDescriptors = this.configureAddActions(config); config.addEntity = () => { this.addEdge(config); return of(null); }; + config.aiAssistantConfig = this.aiAssistantConfigService.tableConfig(AiAssistantViewType.EDGE_LIST, AiAssistantViewType.EDGE); return this.allEntitiesTableConfigService.prepareConfiguration(config); }) ); diff --git a/ui-ngx/src/app/modules/home/pages/integration/integrations-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/integration/integrations-table-config.resolver.ts index eafb0d7459..e03867999e 100644 --- a/ui-ngx/src/app/modules/home/pages/integration/integrations-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/integration/integrations-table-config.resolver.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BUSL-1.1 import { DestroyRef, inject, Injectable } from '@angular/core'; -import { AiAssistantConfigService, isEdgeScope } from '@core/services/ai-assistant-config.service'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; @@ -23,6 +23,7 @@ import { MatDialog } from '@angular/material/dialog'; import { IntegrationsTableConfig } from '@home/pages/integration/integrations-table-config'; import { PageLink } from '@shared/models/page/page-link'; import { EntityDebugSettingsService } from '@home/components/entity/debug/entity-debug-settings.service'; +import { EdgeId } from '@shared/models/id/edge-id'; @Injectable() export class IntegrationsTableConfigResolver { @@ -44,8 +45,13 @@ export class IntegrationsTableConfigResolver { resolve(route: ActivatedRouteSnapshot): EntityTableConfig { const config = this.resolveIntegrationsTableConfig(resolveIntegrationParams(route)); - config.aiAssistantConfig = isEdgeScope(config.componentsData.integrationScope) ? null : - this.aiAssistantConfigService.tableConfig(AiAssistantViewType.INTEGRATION_LIST, AiAssistantViewType.INTEGRATION); + const scope = config.componentsData.integrationScope; + config.aiAssistantConfig = scope === 'edges' + ? this.aiAssistantConfigService.tableConfig(AiAssistantViewType.INTEGRATION_TEMPLATE_LIST, AiAssistantViewType.INTEGRATION_TEMPLATE) + : scope === 'edge' + ? this.aiAssistantConfigService.tableConfig(AiAssistantViewType.INTEGRATION_TEMPLATE_LIST, AiAssistantViewType.INTEGRATION_TEMPLATE, + new EdgeId(config.componentsData.edgeId)) + : this.aiAssistantConfigService.tableConfig(AiAssistantViewType.INTEGRATION_LIST, AiAssistantViewType.INTEGRATION); return config; } diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts index b081c41ee2..502d430802 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { inject, Injectable } from '@angular/core'; -import { AiAssistantConfigService, isEdgeScope } from '@core/services/ai-assistant-config.service'; +import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { @@ -23,6 +23,7 @@ import { CustomTranslatePipe } from '@shared/pipe/custom-translate.pipe'; import { UserPermissionsService } from '@core/http/user-permissions.service'; import { RuleChainsTableConfig } from '@home/pages/rulechain/rulechains-table-config'; import { IotHubActionsService } from '@home/components/iot-hub/iot-hub-actions.service'; +import { EdgeId } from '@shared/models/id/edge-id'; @Injectable() export class RuleChainsTableConfigResolver { @@ -46,8 +47,13 @@ export class RuleChainsTableConfigResolver { resolve(route: ActivatedRouteSnapshot): EntityTableConfig { const config = this.resolveRuleChainsTableConfig(route); - config.aiAssistantConfig = isEdgeScope(config.componentsData.ruleChainScope) ? null : - this.aiAssistantConfigService.tableConfig(AiAssistantViewType.RULE_CHAIN_LIST, AiAssistantViewType.RULE_CHAIN); + const scope = config.componentsData.ruleChainScope; + config.aiAssistantConfig = scope === 'edges' + ? this.aiAssistantConfigService.tableConfig(AiAssistantViewType.RULE_CHAIN_TEMPLATE_LIST, AiAssistantViewType.RULE_CHAIN_TEMPLATE) + : scope === 'edge' + ? this.aiAssistantConfigService.tableConfig(AiAssistantViewType.RULE_CHAIN_TEMPLATE_LIST, AiAssistantViewType.RULE_CHAIN_TEMPLATE, + new EdgeId(config.componentsData.edgeId)) + : this.aiAssistantConfigService.tableConfig(AiAssistantViewType.RULE_CHAIN_LIST, AiAssistantViewType.RULE_CHAIN); return config; } diff --git a/ui-ngx/src/app/shared/models/ai-chat.models.ts b/ui-ngx/src/app/shared/models/ai-chat.models.ts index 2256523c06..94edd432ad 100644 --- a/ui-ngx/src/app/shared/models/ai-chat.models.ts +++ b/ui-ngx/src/app/shared/models/ai-chat.models.ts @@ -106,6 +106,7 @@ export interface AiReviewField { export interface AiApprovalReview { entityType: string; name: string; + verb?: string; detail?: string; target?: string; fields: AiReviewField[]; @@ -215,6 +216,7 @@ export interface AiAction { result?: string; affectedEntities?: Array; edited?: boolean; + progress?: string; } export interface ApprovalResult { @@ -306,6 +308,29 @@ export enum AiAssistantViewType { INTEGRATION = 'INTEGRATION', CONVERTER_LIST = 'CONVERTER_LIST', CONVERTER = 'CONVERTER', + EDGE_LIST = 'EDGE_LIST', + EDGE = 'EDGE', + EDGE_GROUP_LIST = 'EDGE_GROUP_LIST', + EDGE_GROUP = 'EDGE_GROUP', + EDGE_SCHEDULER = 'EDGE_SCHEDULER', + RULE_CHAIN_TEMPLATE_LIST = 'RULE_CHAIN_TEMPLATE_LIST', + RULE_CHAIN_TEMPLATE = 'RULE_CHAIN_TEMPLATE', + INTEGRATION_TEMPLATE_LIST = 'INTEGRATION_TEMPLATE_LIST', + INTEGRATION_TEMPLATE = 'INTEGRATION_TEMPLATE', + CONVERTER_TEMPLATE_LIST = 'CONVERTER_TEMPLATE_LIST', + CONVERTER_TEMPLATE = 'CONVERTER_TEMPLATE', + AGENT_LIST = 'AGENT_LIST', + AGENT = 'AGENT', + AGENT_GROUP_LIST = 'AGENT_GROUP_LIST', + AGENT_GROUP = 'AGENT_GROUP', + AGENT_APPLICATION_LIST = 'AGENT_APPLICATION_LIST', + AGENT_APPLICATION = 'AGENT_APPLICATION', + AGENT_EVENTS = 'AGENT_EVENTS', + AGENT_PROFILE_LIST = 'AGENT_PROFILE_LIST', + AGENT_PROFILE = 'AGENT_PROFILE', + AGENT_APP_PROFILE_LIST = 'AGENT_APP_PROFILE_LIST', + AGENT_APP_PROFILE = 'AGENT_APP_PROFILE', + AGENT_BULK_ACTION = 'AGENT_BULK_ACTION', NOTIFICATION_TEMPLATE_LIST = 'NOTIFICATION_TEMPLATE_LIST', NOTIFICATION_RULE_LIST = 'NOTIFICATION_RULE_LIST', NOTIFICATION_RECIPIENT_LIST = 'NOTIFICATION_RECIPIENT_LIST', @@ -392,7 +417,10 @@ const AI_PAGE_VIEWS: Array<[string, AiAssistantViewType]> = [ ]; const AI_PAGE_VIEW_PATTERNS: Array<[RegExp, AiAssistantViewType]> = [ - [/^\/resources\/scada-symbols\/(system|tenant)\/[^/]+$/, AiAssistantViewType.SCADA_SYMBOL] + [/^\/resources\/scada-symbols\/(system|tenant)\/[^/]+$/, AiAssistantViewType.SCADA_SYMBOL], + [/^\/edgeManagement\/.*\/[0-9a-f-]{36}\/scheduler$/, AiAssistantViewType.EDGE_SCHEDULER], + [/^\/edgeManagement\/agents\/.*\/[0-9a-f-]{36}\/events$/, AiAssistantViewType.AGENT_EVENTS], + [/^\/edgeManagement\/profiles\/.*\/bulk\/[0-9a-f-]{36}$/, AiAssistantViewType.AGENT_BULK_ACTION] ]; const AI_TITLED_VIEWS = new Set([AiAssistantViewType.PAGE, ...AI_PAGE_VIEWS.map(([, type]) => type), diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index fcc7bbf4e2..047b748844 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -889,6 +889,39 @@ "gateway-connectors": "Connectors", "read-ota": "{ count, plural, =1 {Checked the update of one device} other {Checked the update of # devices} }", "read-ota-packages": "Read the OTA packages", + "read-edges": "Read the edges", + "read-edge": "Read the edge {{name}}", + "edge-assigned": "Assigned to the edge", + "read-edge-events": "Read the edge's downlinks", + "read-edge-install-instructions": "Read the edge install instructions", + "read-edge-upgrade-instructions": "Read the edge upgrade instructions", + "create-edge": "Create the edge {{name}}", + "update-edge": "Update the edge", + "assign-to-edge": "Change what the edge receives", + "edge-missing-rule-chains": "Rule chains the edge is missing", + "sync-edge": "Sync the edge", + "read-rule-chain-templates": "Read the edge rule chains", + "read-rule-chain-template": "Read the edge rule chain {{name}}", + "rule-chain-template-root": "Root rule chain of new edges", + "rule-chain-template-auto": "Assigned to new edges", + "rule-chain-template-edges": "Assigned to edges", + "rule-chain-template-nodes": "Rule nodes", + "set-rule-chain-template": "Change how the rule chain reaches new edges", + "read-agents": "Read the agents", + "read-agent": "Read {{name}}", + "agent-applications": "Applications", + "agent-units": "Units", + "agent-operations": "Recent operations", + "read-agent-instructions": "Read the agent install command", + "read-agent-profiles": "Read the agent profiles", + "create-agent": "Create the agent {{name}}", + "update-agent": "Update the agent", + "install-agent-application": "Install an application on the agent", + "run-agent-operation": "Run an operation on the agent", + "save-agent-profile": "Save the agent profile", + "save-agent-app-profile": "Save the application profile", + "run-agent-bulk-action": "Run a bulk action", + "wait-agent-operation": "Followed the agent operation", "read-white-labeling": "Read the white labeling", "read-website-brand": "Read the brand of {{site}}", "website-colors": "Colors", @@ -1441,6 +1474,94 @@ "run": "Checking the OTA updates", "done": "Checked the OTA updates" }, + "read-edges": { + "run": "Checking the edges", + "done": "Checked the edges" + }, + "read-edge-events": { + "run": "Reading the edge's downlinks", + "done": "Read the edge's downlinks" + }, + "read-edge-instructions": { + "run": "Getting the edge instructions", + "done": "Got the edge instructions" + }, + "save-edge": { + "run": "Saving the edge", + "done": "Saved the edge" + }, + "assign-to-edge": { + "run": "Changing what the edge receives", + "done": "Changed what the edge receives" + }, + "sync-edge": { + "run": "Syncing the edge", + "done": "Started the edge sync" + }, + "delete-edge": { + "run": "Deleting the edge", + "done": "Deleted the edge" + }, + "read-rule-chain-templates": { + "run": "Reading the edge rule chains", + "done": "Read the edge rule chains" + }, + "set-rule-chain-template": { + "run": "Updating the edge rule chain", + "done": "Updated the edge rule chain" + }, + "read-agents": { + "run": "Checking the agents", + "done": "Checked the agents" + }, + "read-agent-instructions": { + "run": "Getting the agent command", + "done": "Got the agent command" + }, + "save-agent": { + "run": "Saving the agent", + "done": "Saved the agent" + }, + "install-agent-application": { + "run": "Installing the application", + "done": "Started the install" + }, + "run-agent-operation": { + "run": "Starting the operation", + "done": "Started the operation" + }, + "read-agent-profiles": { + "run": "Reading the agent profiles", + "done": "Read the agent profiles" + }, + "save-agent-profile": { + "run": "Saving the agent profile", + "done": "Saved the agent profile" + }, + "save-agent-app-profile": { + "run": "Saving the application profile", + "done": "Saved the application profile" + }, + "run-agent-bulk-action": { + "run": "Starting the bulk action", + "done": "Started the bulk action" + }, + "wait-agent-operation": { + "run": "Waiting for the agent", + "done": "The agent finished" + }, + "delete-agent": { + "run": "Deleting the agent", + "done": "Deleted the agent" + }, + "delete-agent-profile": { + "run": "Deleting the agent profile", + "done": "Deleted the agent profile" + }, + "delete-agent-app-profile": { + "run": "Deleting the application profile", + "done": "Deleted the application profile" + }, "read-white-labeling": { "run": "Reading the white labeling", "done": "Read the white labeling" @@ -2018,6 +2139,16 @@ "rename-save": "Save (Enter)", "rename-discard": "Discard (Esc)", "review": { + "verb": { + "install": "Install", + "restart": "Restart", + "update": "Update", + "upgrade": "Upgrade", + "upgrade-agent": "Upgrade the agent", + "delete": "Delete", + "cancel": "Cancel the operation", + "sync": "Sync" + }, "head": { "pending": "Needs your review", "approved": "Approved", @@ -2038,6 +2169,23 @@ "ask-again": "Ask again", "ask-again-message": "Ask me again for the same change.", "field": { + "agent": "Agent", + "install": "Install", + "runs": "Runs", + "operation": "Operation", + "application": "Application", + "applications": "Applications", + "removeVolumes": "Delete its data", + "provisionType": "Provisioning", + "appProfiles": "Application profiles", + "default": "Default profile", + "variant": "Variant", + "edgeTemplateRoot": "Root of new edges", + "autoAssign": "Assigned to new edges", + "cloudEndpoint": "Cloud endpoint", + "assign": "Assign", + "unassign": "Unassign", + "rootRuleChain": "Root rule chain", "source": "Source", "appTitle": "Title", "platformName": "Platform name", @@ -2272,6 +2420,18 @@ "scope": "Scope" }, "value": { + "removeVolumes-yes": "Yes, for good", + "removeVolumes-no": "No, keep it", + "default-yes": "Yes", + "operation-restart": "Restart", + "operation-update": "Update to the profile", + "operation-upgrade": "Upgrade", + "operation-delete": "Delete", + "operation-cancel": "Cancel the running operation", + "operation-upgrade agent": "Upgrade the agent", + "edgeTemplateRoot-yes": "Yes", + "autoAssign-yes": "Yes", + "autoAssign-no": "No", "undo-none": "No: it is deleted for good", "defaultDashboard-none": "None: the current one is cleared", "homeDashboard-none": "None: the current one is cleared", @@ -2543,6 +2703,325 @@ }, "welcome": { "placeholder": "Ask anything or describe what to set up...", + "edges": { + "title": "Ask about your edges", + "title-customer": "Ask about this customer's edges", + "line": "Check which edges are connected, add one, or set up what each edge receives.", + "suggestion": "Which of my edges are offline?", + "example": { + "offline": { + "label": "Offline edges", + "message": "Which of my edges are offline, and since when?" + }, + "create": { + "label": "Add an edge", + "message": "Add a new edge and tell me how to install it with Docker." + } + } + }, + "edge": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this edge", + "line": "Its connection, what is assigned to it, and how to install or upgrade it.", + "suggestion": "Is this edge connected, and is anything waiting to reach it?", + "example": { + "status": { + "label": "Connection", + "message": "Is this edge connected, and are any downlinks failing?" + }, + "assign": { + "label": "What it receives", + "message": "What is assigned to this edge, and is anything missing?" + }, + "install": { + "label": "Install it", + "message": "How do I install this edge with Docker?" + } + } + }, + "edge-groups": { + "title": "Ask about your edge groups", + "title-customer": "Ask about this customer's edge groups", + "line": "Group edges, share them with customers, and check them together.", + "suggestion": "Which edge groups have offline edges?", + "example": { + "find": { + "label": "Offline edges", + "message": "Which edge groups have offline edges?" + } + } + }, + "edge-group": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this edge group", + "line": "Check its edges together.", + "suggestion": "Are all edges in this group connected?", + "example": { + "status": { + "label": "Connection", + "message": "Are all edges in this group connected?" + } + } + }, + "edge-scheduler": { + "title": "Ask about this edge's scheduler events", + "line": "Which scheduled events run on this edge.", + "suggestion": "Which scheduler events are assigned to this edge?", + "example": { + "assign": { + "label": "Assign an event", + "message": "Assign one of my scheduler events to this edge." + } + } + }, + "rule-chain-templates": { + "title": "Ask about your edge rule chains", + "line": "Add edge rule chains from IoT Hub, and choose which new edges get them.", + "suggestion": "Which rule chain does a new edge start with?", + "example": { + "root": { + "label": "New edges", + "message": "Which rule chains does a new edge get?" + }, + "hub": { + "label": "From IoT Hub", + "message": "Find an edge rule chain on IoT Hub for my use case." + } + } + }, + "rule-chain-template": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this edge rule chain", + "line": "Whether new edges get it, and which edges use it.", + "suggestion": "Which edges use this rule chain?", + "example": { + "edges": { + "label": "Edges using it", + "message": "Which edges use this rule chain?" + }, + "auto": { + "label": "New edges", + "message": "Assign this rule chain to every new edge." + } + } + }, + "integration-templates": { + "title": "Ask about your edge integrations", + "line": "Integrations that run on edges.", + "suggestion": "Which edges run my integration templates?", + "example": { + "edges": { + "label": "Where they run", + "message": "Which edges run my integration templates?" + } + } + }, + "integration-template": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this edge integration", + "line": "Which edges run it.", + "suggestion": "Which edges run this integration?", + "example": { + "edges": { + "label": "Where it runs", + "message": "Which edges run this integration?" + } + } + }, + "converter-templates": { + "title": "Ask about your edge converters", + "line": "Converters used by integrations on edges.", + "suggestion": "Which edge integrations use these converters?", + "example": { + "explain": { + "label": "Explain", + "message": "What do my edge converters do?" + } + } + }, + "converter-template": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this edge converter", + "line": "What it converts and where it is used.", + "suggestion": "What does this converter do?", + "example": { + "explain": { + "label": "Explain", + "message": "What does this converter do?" + } + } + }, + "agents": { + "title": "Ask about your agents", + "title-customer": "Ask about this customer's agents", + "line": "Agents run edges, gateways and other applications on your hosts.", + "suggestion": "Which agents are offline or have failing applications?", + "example": { + "status": { + "label": "Health", + "message": "Which agents are offline or have failing applications?" + }, + "deploy": { + "label": "Add an agent", + "message": "Add an agent and tell me how to install it on a Linux host." + } + } + }, + "agent": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this agent", + "line": "Its applications, their health, and upgrades.", + "suggestion": "Are all applications on this agent running?", + "example": { + "apps": { + "label": "Applications", + "message": "Are all applications on this agent running?" + }, + "edge": { + "label": "Run an edge", + "message": "Install an edge on this agent." + }, + "upgrade": { + "label": "Upgrade", + "message": "Is an upgrade available for this agent?" + } + } + }, + "agent-groups": { + "title": "Ask about your agent groups", + "title-customer": "Ask about this customer's agent groups", + "line": "Group agents and check them together.", + "suggestion": "Which agent groups have offline agents?", + "example": { + "find": { + "label": "Offline agents", + "message": "Which agent groups have offline agents?" + } + } + }, + "agent-group": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this agent group", + "line": "Check its agents together.", + "suggestion": "Are all agents in this group online?", + "example": { + "status": { + "label": "Health", + "message": "Are all agents in this group online?" + } + } + }, + "agent-applications": { + "title": "Ask about this agent's applications", + "line": "Install, restart, update or upgrade the applications it runs.", + "suggestion": "Are all applications on this agent running?", + "example": { + "status": { + "label": "Health", + "message": "Are all applications on this agent running?" + }, + "install": { + "label": "Install", + "message": "Install a gateway on this agent." + } + } + }, + "agent-application": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this application", + "line": "Its units, logs and recent operations.", + "suggestion": "Why did this application fail?", + "example": { + "logs": { + "label": "Why it failed", + "message": "Why did this application fail? Check its logs." + }, + "restart": { + "label": "Restart", + "message": "Restart this application." + } + } + }, + "agent-events": { + "title": "Ask about this agent's events", + "line": "Operations the agent ran and how they ended.", + "suggestion": "Which operations failed on this agent?", + "example": { + "failed": { + "label": "Failures", + "message": "Which operations failed on this agent, and why?" + } + } + }, + "agent-profiles": { + "title": "Ask about your agent profiles", + "line": "How agents provision, and which applications they install.", + "suggestion": "Which agent profile do new agents use?", + "example": { + "create": { + "label": "Add a profile", + "message": "Create an agent profile that installs an edge on every new agent." + }, + "default": { + "label": "Default", + "message": "Which agent profile do new agents use?" + } + } + }, + "agent-profile": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this agent profile", + "line": "Its applications, its agents and bulk updates.", + "suggestion": "Update the applications on every agent of this profile.", + "example": { + "apps": { + "label": "Applications", + "message": "Which applications does this profile install?" + }, + "bulk": { + "label": "Update all", + "message": "Update the applications on every agent of this profile." + } + } + }, + "agent-app-profiles": { + "title": "Ask about your application profiles", + "line": "Ready-made Edge, Gateway and other applications for your agents.", + "suggestion": "Create an Edge application profile.", + "example": { + "edge": { + "label": "Edge profile", + "message": "Create an Edge application profile." + }, + "gateway": { + "label": "Gateway profile", + "message": "Create a Gateway application profile." + } + } + }, + "agent-app-profile": { + "title": "Ask about {{name}}", + "title-unnamed": "Ask about this application profile", + "line": "What it installs and which agent profiles use it.", + "suggestion": "What does this application profile install?", + "example": { + "explain": { + "label": "Explain", + "message": "What does this application profile install, and where is it used?" + } + } + }, + "agent-bulk-action": { + "title": "Ask about this bulk action", + "line": "Its progress on each agent.", + "suggestion": "How is this bulk action going?", + "example": { + "progress": { + "label": "Progress", + "message": "How is this bulk action going, and which agents failed?" + } + } + }, "assets": { "title": "Ask about your assets", "line": "Their telemetry and alarms, or a dashboard to watch them.",