Browse Source

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.
pull/16869/head
Igor Kulikov 2 days ago
parent
commit
59cfe99431
  1. 6
      ui-ngx/src/app/core/services/ai-assistant-panel.service.ts
  2. 7
      ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts
  3. 13
      ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss
  4. 2
      ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.ts
  5. 2
      ui-ngx/src/app/modules/home/home.component.html
  6. 1
      ui-ngx/src/assets/locale/locale.constant-en_US.json
  7. 7
      ui-ngx/src/theme/ai-theme.scss

6
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);
}

7
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<string, string[]> = {
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);

13
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;

2
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()});
}
});
}

2
ui-ngx/src/app/modules/home/home.component.html

@ -58,7 +58,7 @@
</mat-toolbar>
</mat-sidenav>
<mat-sidenav-content class="tb-site-content" [class.tb-force-fullscreen]="forceFullscreen">
<div class="tb-site-main flex flex-col" role="main" style="height: 100%;" [class.openAiAssistant]="aiPanelLoaded() && panelService.open()">
<div class="tb-site-main flex flex-col" role="main" style="height: 100%;" [class.openAiAssistant]="aiPanelLoaded() && panelService.open() && !panelService.suppressed()">
@if ((homeService.hideMainToolbar$ | async) === false) {
<mat-toolbar color="tb-primary" class="tb-primary-toolbar tb-bottom-border flex flex-row">
<button mat-icon-button id="main"

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

@ -3074,6 +3074,7 @@
"NOTIFICATION_PREFERENCES": "Notification preferences"
},
"kind": {
"attributes": "attributes",
"ADMIN_SETTINGS": "the admin settings",
"AGENT": "an agent",
"AGENT_APPLICATION": "an application",

7
ui-ngx/src/theme/ai-theme.scss

@ -2199,6 +2199,13 @@ code.k-ent[data-pal="solution"] .k-ent-ic { color: var(--entity-solution-fg); }
}
}
@container k-chat (max-width: 400px) {
.tb-ai-composer .composer-foot:has(.cred.near, .cred.over) .composer-auto .label,
.tb-ai-composer .cred:has(.cred-topup) .cred-line {
display: none;
}
}
@container k-chat (max-width: 560px) {
tb-ai-action-detail.k-detail table.k-hist {
:is(th, td) {

Loading…
Cancel
Save