From 59cfe99431128b2fd0564f08528fd099a2444729 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 2 Dec 2026 15:47:50 +0200 Subject: [PATCH] AI chat fixes found in QA: attribute approval heads, narrow docked composer, docked panel space, uninstall view - The approval card for an attribute change names the attribute scope ("Delete server attributes", "Update shared attributes") instead of the device. - At narrow widths the docked composer row fits when the credits warning shows: the Auto-approve text and the credits text next to an upgrade button give way, and the credits text can shrink. - The docked panel never reserves its space or opens on pages that hide it (Home, AI Assistant), so the AI Assistant page always uses the full width. - After an uninstall the solution panel stays on the Solution view with Install instead of opening the dashboards step in edit mode. --- .../app/core/services/ai-assistant-panel.service.ts | 6 ++++++ .../components/ai/ai-approval-card.component.ts | 7 +++++++ .../home/components/ai/ai-credits.component.scss | 13 +++++++++++++ .../ai/solution/solution-chat.component.ts | 2 +- ui-ngx/src/app/modules/home/home.component.html | 2 +- ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 + ui-ngx/src/theme/ai-theme.scss | 7 +++++++ 7 files changed, 36 insertions(+), 2 deletions(-) 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 e0d3028f40..4d5c631ab1 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 @@ -215,6 +215,9 @@ export class AiAssistantPanelService implements OnDestroy { } toggle(): void { + if (this._suppressed() && !this._open()) { + return; + } this._restored.set(false); this._open.update(open => !open); } @@ -341,6 +344,9 @@ export class AiAssistantPanelService implements OnDestroy { } openPanel(): void { + if (this._suppressed()) { + return; + } this._restored.set(false); this._open.set(true); } 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 5906317f70..99eff53c56 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 @@ -55,6 +55,8 @@ const MAX_FIELDS = 5; const DETAIL_TOKENS = new Set(['server-attributes', 'shared-attributes']); +const ATTRIBUTE_TOOLS = new Set(['save_attributes', 'delete_attributes']); + const VALUE_TOKENS: Record = { undo: ['none'], defaultDashboard: ['none'], @@ -195,6 +197,11 @@ function aiChangeHead(translate: TranslateService, data: ToolExecutionRequested) if (!HEAD_VERBS.has(verb)) { return translate.instant(label); } + if (DETAIL_TOKENS.has(review.detail) || ATTRIBUTE_TOOLS.has(data.tool)) { + const kind = DETAIL_TOKENS.has(review.detail) ? translate.instant('ai-assistant.review.detail.' + review.detail) + : translate.instant('ai-assistant.review.kind.attributes'); + return translate.instant('ai-assistant.review.head-change.' + verb, {kind}); + } const type = review.detail === 'alarm-rule' ? 'ALARM_RULE' : review.entityType; const key = 'ai-assistant.review.kind.' + type; const phrase = translate.instant(key); diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss index 7fb233ca15..3c772e1f21 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss +++ b/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss @@ -1,12 +1,25 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 +:host { + display: inline-flex; + min-width: 0; +} + .cred { display: inline-flex; align-items: center; gap: 8px; + min-width: 0; + + > :not(.cred-line) { + flex-shrink: 0; + } } .cred-line { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; font: 400 var(--chat-meta)/var(--chat-meta-lh) var(--tb-font); color: var(--tb-ink-76); white-space: nowrap; diff --git a/ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.ts b/ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.ts index 1218acd6d8..c515c850b4 100644 --- a/ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.ts @@ -1214,7 +1214,7 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe this.aiSolutions.update(this.solutionId, {installed: false}); this.uninstalledAt.set(Date.now()); if (this.creatorStep() === 'result') { - this.back(); + this.pickedView.set({view: 'solution', phase: this.phase()}); } }); } diff --git a/ui-ngx/src/app/modules/home/home.component.html b/ui-ngx/src/app/modules/home/home.component.html index 1d76d5d396..e4a2d3177a 100644 --- a/ui-ngx/src/app/modules/home/home.component.html +++ b/ui-ngx/src/app/modules/home/home.component.html @@ -58,7 +58,7 @@ -
+
@if ((homeService.hideMainToolbar$ | async) === false) {