Browse Source

Merge pull request #16869 from thingsboard/feature/ai-chat

AI chat: Generate dashboard with AI in the chat, docked chat head, tooltips and QA fixes
pull/16870/head
Vladyslav Prykhodko 2 days ago
committed by GitHub
parent
commit
9251074533
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultAlarmQueryRepository.java
  2. 36
      dao/src/test/java/org/thingsboard/server/dao/service/AlarmServiceTest.java
  3. 4
      ui-ngx/src/app/core/http/ai-chat.service.ts
  4. 58
      ui-ngx/src/app/core/services/ai-assistant-panel.service.ts
  5. 2
      ui-ngx/src/app/modules/home/components/ai/ai-action-detail.component.html
  6. 9
      ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts
  7. 1
      ui-ngx/src/app/modules/home/components/ai/ai-action.models.ts
  8. 9
      ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts
  9. 2
      ui-ngx/src/app/modules/home/components/ai/ai-artifact-pane.component.html
  10. 30
      ui-ngx/src/app/modules/home/components/ai/ai-artifact-pane.component.ts
  11. 5
      ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss
  12. 40
      ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts
  13. 4
      ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.html
  14. 2
      ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html
  15. 4
      ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.scss
  16. 6
      ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts
  17. 5
      ui-ngx/src/app/modules/home/components/ai/ai-chat-title.component.html
  18. 6
      ui-ngx/src/app/modules/home/components/ai/ai-chat-title.component.scss
  19. 24
      ui-ngx/src/app/modules/home/components/ai/ai-chat-title.component.ts
  20. 64
      ui-ngx/src/app/modules/home/components/ai/ai-chat.component.html
  21. 1
      ui-ngx/src/app/modules/home/components/ai/ai-chat.component.scss
  22. 51
      ui-ngx/src/app/modules/home/components/ai/ai-chat.component.ts
  23. 8
      ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.html
  24. 7
      ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.ts
  25. 12
      ui-ngx/src/app/modules/home/components/ai/ai-core.module.ts
  26. 13
      ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss
  27. 71
      ui-ngx/src/app/modules/home/components/ai/ai-dashboard-generation.service.ts
  28. 15
      ui-ngx/src/app/modules/home/components/ai/ai-loading-modal.component.html
  29. 34
      ui-ngx/src/app/modules/home/components/ai/ai-loading-modal.component.scss
  30. 61
      ui-ngx/src/app/modules/home/components/ai/ai-loading-modal.component.ts
  31. 6
      ui-ngx/src/app/modules/home/components/ai/ai-number-field.component.html
  32. 4
      ui-ngx/src/app/modules/home/components/ai/ai-number-field.component.ts
  33. 4
      ui-ngx/src/app/modules/home/components/ai/ai-plan.component.html
  34. 2
      ui-ngx/src/app/modules/home/components/ai/ai-plan.component.ts
  35. 2
      ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.html
  36. 62
      ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.ts
  37. 36
      ui-ngx/src/app/modules/home/components/ai/ai-question.component.html
  38. 16
      ui-ngx/src/app/modules/home/components/ai/ai-question.component.ts
  39. 2
      ui-ngx/src/app/modules/home/components/ai/ai-record-card.component.ts
  40. 4
      ui-ngx/src/app/modules/home/components/ai/ai-record.component.ts
  41. 4
      ui-ngx/src/app/modules/home/components/ai/ai-secret-field.component.html
  42. 1
      ui-ngx/src/app/modules/home/components/ai/ai-secret-field.component.ts
  43. 2
      ui-ngx/src/app/modules/home/components/ai/ai-started-from.component.ts
  44. 12
      ui-ngx/src/app/modules/home/components/ai/ai-text.ts
  45. 70
      ui-ngx/src/app/modules/home/components/ai/ai-tooltip.ts
  46. 22
      ui-ngx/src/app/modules/home/components/ai/ai.models.ts
  47. 12
      ui-ngx/src/app/modules/home/components/ai/solution/pane/solution-installed.component.html
  48. 10
      ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.html
  49. 10
      ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.scss
  50. 200
      ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.ts
  51. 9
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts
  52. 9
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts
  53. 2
      ui-ngx/src/app/modules/home/home.component.html
  54. 3
      ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant.component.html
  55. 4
      ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant.component.ts
  56. 1
      ui-ngx/src/app/modules/home/pages/ai-assistant/cli/ai-cli-guide.component.scss
  57. 20
      ui-ngx/src/app/modules/home/pages/device/device-check-connectivity-dialog.component.ts
  58. 7
      ui-ngx/src/app/modules/home/pages/device/device-group-config.factory.ts
  59. 4
      ui-ngx/src/app/modules/home/pages/device/device.component.ts
  60. 7
      ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts
  61. 11
      ui-ngx/src/app/modules/tour/welcome-invitation.component.scss
  62. 7
      ui-ngx/src/assets/locale/locale.constant-ar_AE.json
  63. 7
      ui-ngx/src/assets/locale/locale.constant-ca_ES.json
  64. 7
      ui-ngx/src/assets/locale/locale.constant-cs_CZ.json
  65. 7
      ui-ngx/src/assets/locale/locale.constant-da_DK.json
  66. 7
      ui-ngx/src/assets/locale/locale.constant-de_DE.json
  67. 7
      ui-ngx/src/assets/locale/locale.constant-el_GR.json
  68. 38
      ui-ngx/src/assets/locale/locale.constant-en_US.json
  69. 7
      ui-ngx/src/assets/locale/locale.constant-es_ES.json
  70. 7
      ui-ngx/src/assets/locale/locale.constant-fr_FR.json
  71. 7
      ui-ngx/src/assets/locale/locale.constant-hi_IN.json
  72. 7
      ui-ngx/src/assets/locale/locale.constant-it_IT.json
  73. 7
      ui-ngx/src/assets/locale/locale.constant-ja_JP.json
  74. 7
      ui-ngx/src/assets/locale/locale.constant-ka_GE.json
  75. 7
      ui-ngx/src/assets/locale/locale.constant-ko_KR.json
  76. 7
      ui-ngx/src/assets/locale/locale.constant-lt_LT.json
  77. 7
      ui-ngx/src/assets/locale/locale.constant-lv_LV.json
  78. 7
      ui-ngx/src/assets/locale/locale.constant-nl_BE.json
  79. 7
      ui-ngx/src/assets/locale/locale.constant-nl_NL.json
  80. 7
      ui-ngx/src/assets/locale/locale.constant-no_NO.json
  81. 7
      ui-ngx/src/assets/locale/locale.constant-pl_PL.json
  82. 7
      ui-ngx/src/assets/locale/locale.constant-pt_BR.json
  83. 7
      ui-ngx/src/assets/locale/locale.constant-ro_RO.json
  84. 7
      ui-ngx/src/assets/locale/locale.constant-sl_SI.json
  85. 7
      ui-ngx/src/assets/locale/locale.constant-tr_TR.json
  86. 7
      ui-ngx/src/assets/locale/locale.constant-uk_UA.json
  87. 7
      ui-ngx/src/assets/locale/locale.constant-zh_CN.json
  88. 7
      ui-ngx/src/assets/locale/locale.constant-zh_TW.json
  89. BIN
      ui-ngx/src/assets/solution-creator/building-animated.webp
  90. BIN
      ui-ngx/src/assets/solution-creator/catch-animated.webp
  91. BIN
      ui-ngx/src/assets/solution-creator/dashboard-animated.webp
  92. BIN
      ui-ngx/src/assets/solution-creator/forest-animated.webp
  93. BIN
      ui-ngx/src/assets/solution-creator/parachute-animated.webp
  94. BIN
      ui-ngx/src/assets/solution-creator/rocket-animated.webp
  95. 101
      ui-ngx/src/theme/ai-theme.scss

6
dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultAlarmQueryRepository.java

@ -46,6 +46,9 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository {
private static final Map<String, String> alarmFieldColumnMap = new HashMap<>();
private static final String SEVERITY_RANK = "case a." + ModelConstants.ALARM_SEVERITY_PROPERTY
+ " when 'CRITICAL' then 0 when 'MAJOR' then 1 when 'MINOR' then 2 when 'WARNING' then 3 when 'INDETERMINATE' then 4 else 5 end";
private static final Set<String> ALARM_TABLE_SORT_COLUMNS = Set.of(ModelConstants.CREATED_TIME_PROPERTY, ModelConstants.ALARM_ACK_TS_PROPERTY,
ModelConstants.ALARM_CLEAR_TS_PROPERTY, ModelConstants.ALARM_ASSIGN_TS_PROPERTY, ModelConstants.ALARM_END_TS_PROPERTY,
ModelConstants.ALARM_START_TS_PROPERTY, ModelConstants.ALARM_ACKNOWLEDGED_PROPERTY, ModelConstants.ALARM_CLEARED_PROPERTY,
@ -211,7 +214,8 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository {
if ("status".equalsIgnoreCase(sortOrderKey)) {
selectPart.append(", a.status as status ");
}
sortPart.append(alarmFieldColumnMap.getOrDefault(sortOrderKey, sortOrderKey))
String sortColumn = alarmFieldColumnMap.getOrDefault(sortOrderKey, sortOrderKey);
sortPart.append(ModelConstants.ALARM_SEVERITY_PROPERTY.equals(sortColumn) ? SEVERITY_RANK : sortColumn)
.append(" ").append(sortOrder.getDirection().name());
if (ownerScoped) {
sortPart.append(", a.created_time desc, a.id desc");

36
dao/src/test/java/org/thingsboard/server/dao/service/AlarmServiceTest.java

@ -800,6 +800,42 @@ public class AlarmServiceTest extends AbstractServiceTest {
Assert.assertTrue(firstPage.hasNext());
}
@Test
public void testSortAlarmDataBySeverityPriority() {
Device device = new Device();
device.setName("TestSeverityDevice");
device.setType("default");
device.setTenantId(tenantId);
device = deviceService.saveDevice(device);
long ts = System.currentTimeMillis();
List<AlarmId> ids = new ArrayList<>();
for (AlarmSeverity severity : List.of(AlarmSeverity.INDETERMINATE, AlarmSeverity.CRITICAL, AlarmSeverity.WARNING, AlarmSeverity.MAJOR, AlarmSeverity.MINOR)) {
ids.add(alarmService.createAlarm(AlarmCreateOrUpdateActiveRequest.builder()
.tenantId(tenantId)
.originator(device.getId())
.type("Severity " + severity)
.severity(severity)
.startTs(ts).build()).getAlarm().getId());
}
List<AlarmId> byPriority = List.of(ids.get(1), ids.get(3), ids.get(4), ids.get(2), ids.get(0));
AlarmDataPageLink pageLink = new AlarmDataPageLink();
pageLink.setPage(0);
pageLink.setPageSize(10);
pageLink.setSortOrder(new EntityDataSortOrder(new EntityKey(EntityKeyType.ALARM_FIELD, "severity"), EntityDataSortOrder.Direction.ASC));
AlarmDataQuery ownerQuery = new AlarmDataQuery(null, pageLink, null, null, null, Collections.emptyList());
Assert.assertEquals(byPriority, alarmService.findAlarmDataByQuery(tenantId, null, mergedUserPermissions, ownerQuery)
.getData().stream().map(AlarmData::getId).toList());
Assert.assertEquals(byPriority, alarmService.findAlarmDataByQueryForEntities(tenantId, mergedUserPermissions, toQuery(pageLink), List.of(device.getId()))
.getData().stream().map(AlarmData::getId).toList());
pageLink.setSortOrder(new EntityDataSortOrder(new EntityKey(EntityKeyType.ALARM_FIELD, "severity"), EntityDataSortOrder.Direction.DESC));
Assert.assertEquals(byPriority.reversed(), alarmService.findAlarmDataByQuery(tenantId, null, mergedUserPermissions, ownerQuery)
.getData().stream().map(AlarmData::getId).toList());
}
private AlarmDataQuery toQuery(AlarmDataPageLink pageLink) {
return toQuery(pageLink, Collections.emptyList());
}

4
ui-ngx/src/app/core/http/ai-chat.service.ts

@ -50,10 +50,6 @@ export class AiChatService {
return this.http.get<Array<ChatMessage>>(`/api/ai/chats/${chatId}/messages`, defaultHttpOptionsFromConfig(config))
}
public generateDashboard(deviceId: string, timeseriesKeys?: string[], config?: RequestConfig): Observable<string> {
return this.http.post<string>(`/api/ai/devices/${deviceId}/dashboard`, { timeseriesKeys }, defaultHttpOptionsFromConfig(config));
}
public resolveToolApproval(result: ApprovalResult, config?: RequestConfig): Observable<ToolApprovalResult> {
return this.http.post<ToolApprovalResult>('/api/ai/tools/resolve-approval', result, defaultHttpOptionsFromConfig(config))
}

58
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);
}
@ -317,6 +320,37 @@ export class AiAssistantPanelService implements OnDestroy {
}
});
private static readonly STARTED_KEY = 'tb-ai-panel-started';
private static readonly STARTED_MAX = 20;
private _startedByContext = signal<Record<string, string[]>>(AiAssistantPanelService.readStarted());
private static readStarted(): Record<string, string[]> {
try {
const stored = JSON.parse(AiAssistantPanelService.readSession(AiAssistantPanelService.STARTED_KEY) ?? '{}');
return stored && typeof stored === 'object' ? stored : {};
} catch {
return {};
}
}
noteStartedHere(chatId: string): void {
const key = this.contextKey();
if (!key) {
return;
}
this._startedByContext.update(started => {
const next = {...started, [key]: [chatId, ...(started[key] ?? []).filter(id => id !== chatId)].slice(0, AiAssistantPanelService.STARTED_MAX)};
AiAssistantPanelService.writeSession(AiAssistantPanelService.STARTED_KEY, JSON.stringify(next));
return next;
});
}
chatsStartedHere(): string[] {
const key = this.contextKey();
return key ? this._startedByContext()[key] ?? [] : [];
}
setLastChatId(id: string | undefined): void {
const key = this.contextKey();
if (!key) {
@ -341,10 +375,34 @@ export class AiAssistantPanelService implements OnDestroy {
}
openPanel(): void {
if (this._suppressed()) {
return;
}
this._restored.set(false);
this._open.set(true);
}
private _composed = signal<{text: string; fresh: boolean} | null>(null);
readonly composed = this._composed.asReadonly();
compose(text: string): void {
if (this._suppressed()) {
return;
}
this._composed.set({text, fresh: !this._open()});
this.openPanel();
}
composesFresh(): boolean {
return !!this._composed()?.fresh;
}
takeComposed(): {text: string; fresh: boolean} | null {
const composed = this._composed();
this._composed.set(null);
return composed;
}
setEnabled(enabled: boolean): void {
this._enabled.set(enabled);
if (enabled) {

2
ui-ngx/src/app/modules/home/components/ai/ai-action-detail.component.html

@ -142,7 +142,7 @@
}
}
@if (plainRows(block.rows).length) {
<dl class="k-fields k-detail-facts">
<dl class="k-fields k-detail-facts" [class.capped]="!changeRows(block.rows).length">
@for (fact of plainRows(block.rows); track $index) {
<dt>{{ label(fact) }}</dt>
<dd [class.mono]="fact.mono">

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

@ -127,7 +127,7 @@ export interface AiStepView {
const ASKED_FOR: Record<string, string> = {
'search-named': 'named', 'search-typed': 'typed', 'search-text': 'text', 'search-related-from': 'related-from',
'search-related-to': 'related-to', 'search-alarms-of': 'alarms-of', 'read-attributes-scope': 'attributes-scope',
'search-related-to': 'related-to', 'read-attributes-scope': 'attributes-scope',
'search-alarms': 'alarms', 'search-alarms-on': 'alarms-on', 'search-alarms-filter-on': 'alarms-filter-on', 'search-alarms-window': 'alarms-window',
'search-alarms-filter-window': 'alarms-filter-window', 'search-alarms-on-window': 'alarms-on-window', 'search-alarms-filter-on-window': 'alarms-filter-on-window',
'read-history': 'history', 'read-history-keys': 'history-keys', 'read-latest-keys': 'latest-keys', 'iot-hub-query': 'query',
@ -1295,6 +1295,10 @@ function describe(tool: string, values: Values, result: unknown, names: AiDetail
};
case 'create_dashboard':
return {hood: text('create-dashboard', {name: str(values.title) ?? '—'}), blocks: []};
case 'generate_device_dashboard': {
const keys = Array.isArray(values.keys) ? values.keys.map(String) : [];
return {hood: text('generate-device-dashboard', {entity: of(values.deviceId, 'DEVICE')}), blocks: keys.length ? [{type: 'keys', keys}] : []};
}
case 'update_dashboard':
return {hood: text('update-dashboard', {entity: dashboard}), blocks: changes(values, ['dashboardId'], names)};
case 'read_dashboard_overview':
@ -2360,6 +2364,9 @@ function namesOf(message: {from: string; data?: any; references?: Array<{id: str
case 'create_dashboard':
put(created, values.title, 'DASHBOARD');
break;
case 'generate_device_dashboard':
put(created, undefined, 'DASHBOARD');
break;
case 'save_device':
put(created ?? savedObject(values).id, savedObject(values).name, 'DEVICE');
break;

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

@ -40,6 +40,7 @@ const TOOL_WORDS: Record<string, string> = {
test_converter: 'test-converter',
read_converter_library: 'read-converter-library',
create_dashboard: 'create-dashboard',
generate_device_dashboard: 'generate-device-dashboard',
update_dashboard: 'update-dashboard',
add_dashboard_state: 'add-dashboard-state',
update_dashboard_state: 'update-dashboard-state',

9
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'],
@ -72,7 +74,7 @@ const CODE_FIELDS = new Set(['arguments', 'expression', 'output']);
const HEAD_VERBS = new Set(['create', 'update', 'delete', 'install', 'acknowledge', 'clear', 'assign', 'unassign']);
const REVIEW_VERBS = new Set(['install', 'restart', 'update', 'upgrade', 'upgrade-agent', 'delete', 'cancel', 'sync', 'acknowledge', 'clear', 'assign', 'unassign']);
const IMAGE_FIELDS = new Set(['widget-image', 'scada-symbol']);
const IMAGE_FIELDS = new Set(['widget-image', 'scada-symbol', 'dashboard-image']);
const BLOCK_FIELDS = new Set(['script']);
@ -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);

2
ui-ngx/src/app/modules/home/components/ai/ai-artifact-pane.component.html

@ -6,7 +6,7 @@
-->
<div class="art-pane-edge" role="separator" tabindex="0" aria-orientation="vertical"
[attr.aria-label]="'ai-assistant.artifact.resize' | translate"
[matTooltip]="'ai-assistant.artifact.resize-hint' | translate" matTooltipPosition="left" matTooltipShowDelay="600"
[matTooltip]="'ai-assistant.artifact.resize-hint' | translate" matTooltipPosition="left"
(pointerdown)="startResize($event)" (dblclick)="resetWidth()" (keydown)="onEdgeKey($event)"></div>
<div class="art-pane-head">
<button type="button" class="art-ib art-pane-close" (click)="closed.emit()"

30
ui-ngx/src/app/modules/home/components/ai/ai-artifact-pane.component.ts

@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { readStored, writeStored } from '@core/local-storage/stored';
import { AfterViewInit, Component, ElementRef, EventEmitter, inject, input, Output, signal, ViewChild } from '@angular/core';
import { AfterViewInit, Component, DestroyRef, ElementRef, EventEmitter, inject, input, Output, signal, ViewChild } from '@angular/core';
const PANE_MIN = 360;
const CHAT_MIN = 340;
const WIDTH_KEY = 'tbSolutionPaneWidth';
const ESCAPE_OWNERS = ['mat-mdc-dialog-container', 'mat-mdc-menu-panel', 'mat-mdc-select-panel', 'mat-mdc-autocomplete-panel']
.map(owner => '.cdk-overlay-container .' + owner).join(', ');
@Component({
selector: 'tb-ai-artifact-pane',
@ -16,7 +18,8 @@ const WIDTH_KEY = 'tbSolutionPaneWidth';
'[class.scrolled]': 'scrolled()',
'[class.more]': 'more()',
'[style.flex-basis]': 'width() ? width() + "px" : null',
'(keydown.escape)': 'onEscape($event)'
'(keydown.escape)': 'onEscape($event)',
'(document:keydown.escape)': 'onDocumentEscape($event)'
}
})
export class AiArtifactPaneComponent implements AfterViewInit {
@ -32,9 +35,13 @@ export class AiArtifactPaneComponent implements AfterViewInit {
more = signal(false);
private host = inject(ElementRef<HTMLElement>);
private destroyRef = inject(DestroyRef);
ngAfterViewInit(): void {
setTimeout(() => this.refreshEdges(), 50);
const columns = (this.host.nativeElement as HTMLElement).parentElement;
columns?.addEventListener('keydown', this.onColumnsEscape);
this.destroyRef.onDestroy(() => columns?.removeEventListener('keydown', this.onColumnsEscape));
}
refreshEdges(): void {
@ -53,6 +60,25 @@ export class AiArtifactPaneComponent implements AfterViewInit {
this.closed.emit();
}
onDocumentEscape(event: KeyboardEvent): void {
if (event.target === document.body || event.target === document.documentElement) {
this.closeOnEscape(event);
}
}
private onColumnsEscape = (event: KeyboardEvent): void => {
if (event.key === 'Escape' && !(this.host.nativeElement as HTMLElement).contains(event.target as Node)) {
this.closeOnEscape(event);
}
};
private closeOnEscape(event: KeyboardEvent): void {
if (event.defaultPrevented || document.querySelector(ESCAPE_OWNERS)) {
return;
}
this.closed.emit();
}
startResize(event: PointerEvent): void {
event.preventDefault();
const edge = event.target as HTMLElement;

5
ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss

@ -92,3 +92,8 @@
}
}
}
:host(.closing) > :not(.tb-ai-grip) {
opacity: .4;
transition: opacity .2s ease;
}

40
ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { AI_TOOLTIP_PROVIDERS } from '@home/components/ai/ai-tooltip';
import { Component, computed, effect, ElementRef, inject, NgZone, signal, untracked, ViewChild } from '@angular/core';
import { MatTooltip } from '@angular/material/tooltip';
import { AiAssistantPanelService } from '@core/services/ai-assistant-panel.service';
@ -23,7 +24,8 @@ import { AiAssistantContextService } from '@home/components/ai/ai-assistant-cont
'(window:resize)': 'fit()',
'(click)': 'onClick($event)',
'(keydown.escape)': '$event.stopPropagation()'
}
},
providers: AI_TOOLTIP_PROVIDERS
})
export class AiAssistantPanelComponent {
@ -37,6 +39,10 @@ export class AiAssistantPanelComponent {
private static readonly PAGE_REFLOW_MS = 50;
private static readonly COMPOSE_DELAY_MS = 60;
private static readonly CLOSE_PAST = 72;
resizing = signal(false);
get isOpen() { return this.panelService.open(); }
@ -96,6 +102,11 @@ export class AiAssistantPanelComponent {
private openEffect = effect(() => {
if (this.panelService.open()) {
untracked(() => {
if (this.panelService.composesFresh()) {
this.chatId.set(undefined);
this.chats.load().subscribe();
return;
}
const carried = this.panelService.hasCarriedChat();
if (!carried) {
this.dropChatFromOtherContext();
@ -114,6 +125,18 @@ export class AiAssistantPanelComponent {
}
});
private composeEffect = effect(() => {
if (this.panelService.composed() && this.panelService.open()) {
untracked(() => {
const composed = this.panelService.takeComposed();
if (composed.fresh) {
this.chatId.set(undefined);
}
setTimeout(() => this.chat?.composeText(composed.text), AiAssistantPanelComponent.COMPOSE_DELAY_MS);
});
}
});
private contextSwitchEffect = effect(() => {
const key = this.panelService.contextKey();
if (this.panelService.open() && this.lastContextKey !== null && key !== null && key !== this.lastContextKey) {
@ -211,6 +234,7 @@ export class AiAssistantPanelComponent {
this.room.set(host.parentElement?.clientWidth ?? window.innerWidth);
const widest = this.widest();
let current = startWidth;
let closing = false;
let frame = 0;
let pageTimer: ReturnType<typeof setTimeout> | undefined;
let pageAt = 0;
@ -230,7 +254,13 @@ export class AiAssistantPanelComponent {
document.body.classList.add('tb-ai-resizing');
this.zone.runOutsideAngular(() => {
const move = (e: PointerEvent) => {
current = Math.round(Math.min(widest, Math.max(this.minWidth, startWidth + (startX - e.clientX))));
const wanted = startWidth + (startX - e.clientX);
const past = wanted < this.minWidth - AiAssistantPanelComponent.CLOSE_PAST;
if (past !== closing) {
closing = past;
host.classList.toggle('closing', past);
}
current = Math.round(Math.min(widest, Math.max(this.minWidth, wanted)));
if (!frame) {
frame = requestAnimationFrame(paint);
}
@ -242,9 +272,15 @@ export class AiAssistantPanelComponent {
cancelAnimationFrame(frame);
clearTimeout(pageTimer);
document.body.classList.remove('tb-ai-resizing');
host.classList.remove('closing');
host.style.width = '';
this.zone.run(() => {
this.resizing.set(false);
if (closing) {
this.setWidth(startWidth);
this.close();
return;
}
this.setWidth(current, current !== startWidth);
});
};

4
ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.html

@ -6,7 +6,7 @@
-->
<div class="k-files">
@for (item of shown; track item.resource.id) {
<button type="button" class="k-file" [class.pic]="item.image" [matTooltip]="item.resource.name" matTooltipPosition="above" (click)="open(item)">
<button type="button" class="k-file" [class.pic]="item.image" [matTooltip]="item.resource.name" aiTipIfCut matTooltipPosition="above" (click)="open(item)">
@if (item.image) {
<span class="k-file-pic" aria-hidden="true">
@if (item.url$ | async; as url) {
@ -17,7 +17,7 @@
<mat-icon class="tb-mat-18" aria-hidden="true">{{ item.icon }}</mat-icon>
}
<span class="k-file-text">
<b><span class="art-name">{{ fileName(item.resource.name).base }}<span class="art-ext">{{ fileName(item.resource.name).ext }}</span></span></b>
<b><span class="art-name tb-ai-cut">{{ fileName(item.resource.name).base }}<span class="art-ext">{{ fileName(item.resource.name).ext }}</span></span></b>
<small>@if (!item.image && item.extension) { {{ item.extension }} · }{{ factOf(item) ?? (item.resource.size | fileSize) }}</small>
</span>
</button>

2
ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html

@ -93,7 +93,7 @@
} @else if (msg.from === 'ACTION' && plans[$index]; as plan) {
<div class="ai plan" [attr.data-dock]="$index">
<tb-ai-plan [steps]="plan.steps" [progress]="plan.progress" [gate]="plan.gate" [replacedAfter]="plan.replacedAfter" [autoApprove]="autoApprove"
(run)="runPlan.emit({run: $event, steps: plan.steps})" (change)="changePlan.emit()"></tb-ai-plan>
(run)="runPlan.emit({run: $event, steps: plan.steps})" (changeRequested)="changePlan.emit()"></tb-ai-plan>
</div>
} @else if (msg.from === 'ACTION' && handOvers[$index]; as card) {
<div class="ai hand" [attr.data-dock]="$index">

4
ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.scss

@ -561,6 +561,10 @@
padding: 0;
background: none;
box-shadow: none;
font-weight: 400;
}
td:first-child code.k-ent {
font-weight: 500;
}

6
ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts

@ -508,6 +508,8 @@ export class AiChatMessagesComponent implements OnChanges, OnDestroy {
this.runningLead = running.length ? running[0] : -1;
this.runningCount = running.length;
this.findReadGroups();
const last = this.messages[this.messages.length - 1];
this.waitApproval = last?.from === 'APPROVAL' && !this.autoApprove && !this.isAnswered(last as ApprovalChatMessage);
if (changes.messages.firstChange) {
if (this.initialScroll === 'bottom') {
this.pinToBottom();
@ -521,10 +523,6 @@ export class AiChatMessagesComponent implements OnChanges, OnDestroy {
const prevLastMsg = prevMsgs?.[prevMsgs.length - 1];
const msgs = changes.messages.currentValue as ChatMessage[];
const lastMsg = msgs[msgs.length - 1];
// In auto-approve we are not blocked on the user, so the assistant keeps working: the
// thinking indicator stays visible (waitApproval false), and the view follows the stream of
// auto-generated cards only while the reader is near the bottom.
this.waitApproval = lastMsg?.from === 'APPROVAL' && !this.autoApprove && !this.isAnswered(lastMsg as ApprovalChatMessage);
if (this.autoApprove) {
if (wasNearBottom) {
setTimeout(() => this.scrollToBottom('auto'), 0);

5
ui-ngx/src/app/modules/home/components/ai/ai-chat-title.component.html

@ -24,10 +24,7 @@
} @else {
<span class="ai-chat-name-wrap" [class.static]="!renamable()">
<button #chatName type="button" class="ai-chat-name" [class.clipped]="nameClipped()" [class.compact]="compact()"
[matTooltip]="nameClipped() ? name : renamable() ? ('ai-assistant.double-click-to-rename' | translate) : ''"
[matTooltipDisabled]="!nameClipped() && !renamable()"
matTooltipPosition="after" matTooltipPositionAtOrigin matTooltipClass="tb-ai-cursor-tooltip" matTooltipShowDelay="500"
(mouseenter)="nameClipped.set(chatName.scrollWidth > chatName.clientWidth + 1)"
[matTooltip]="name" [matTooltipDisabled]="!nameClipped()" matTooltipPosition="below"
(keydown.enter)="startRename()" (keydown.f2)="startRename()" (dblclick)="startRename()">{{ name }}</button>
@if (renamable()) {
<button type="button" class="ai-chat-name-pen" [attr.aria-label]="'action.rename' | translate"

6
ui-ngx/src/app/modules/home/components/ai/ai-chat-title.component.scss

@ -142,3 +142,9 @@
.ai-ib {
@include ai-icon-button;
}
@container k-head (max-width: 399px) {
.ai-chat-status > span:last-child {
display: none;
}
}

24
ui-ngx/src/app/modules/home/components/ai/ai-chat-title.component.ts

@ -1,6 +1,6 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { Component, ElementRef, EventEmitter, inject, input, Output, signal } from '@angular/core';
import { afterNextRender, Component, DestroyRef, effect, ElementRef, EventEmitter, inject, input, Output, signal } from '@angular/core';
import { ChatLevel } from '@shared/models/ai-chat.models';
@Component({
@ -25,6 +25,28 @@ export class AiChatTitleComponent {
renaming = signal(false);
nameClipped = signal(false);
constructor() {
const head = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(() => this.measure()) : null;
afterNextRender(() => {
const parent = this.host.nativeElement.parentElement;
if (parent) {
head?.observe(parent);
}
this.measure();
});
effect(() => {
this.title();
this.renaming();
setTimeout(() => this.measure());
});
inject(DestroyRef).onDestroy(() => head?.disconnect());
}
measure(): void {
const name = this.host.nativeElement.querySelector<HTMLElement>('.ai-chat-name');
this.nameClipped.set(!!name && name.scrollWidth > name.clientWidth + 1);
}
startRename(): void {
if (!this.title() || !this.renamable()) {
return;

64
ui-ngx/src/app/modules/home/components/ai/ai-chat.component.html

@ -12,7 +12,7 @@
@if (variant() === 'panel') {
<tb-ai-mark size="32"></tb-ai-mark>
}
<tb-ai-chat-title [title]="chat()?.title" [placeholder]="historyLoading() ? '' : ((showGetStarted() ? 'ai-assistant.get-started.title' : 'ai-assistant.new-chat') | translate)" [level]="level()"
<tb-ai-chat-title [title]="shownTitle()" [placeholder]="historyLoading() ? '' : ((showGetStarted() ? 'ai-assistant.get-started.title' : 'ai-assistant.new-chat') | translate)" [level]="level()"
[statusTip]="statusTip()" [compact]="variant() === 'panel'" (renamed)="rename($event)"></tb-ai-chat-title>
<div class="ai-chat-actions">
@if (chatFiles().length && !titleRef?.renaming()) {
@ -26,15 +26,23 @@
}
@if (variant() === 'panel') {
@if (!titleRef?.renaming()) {
@if (chat()) {
<button type="button" class="ai-ib ai-new-chat" (click)="newChat()"
[matTooltip]="'ai-assistant.new-chat' | translate" matTooltipPosition="above" [attr.aria-label]="'ai-assistant.new-chat' | translate">
<mat-icon fontSet="material-icons-round">add</mat-icon>
</button>
}
<button type="button" class="ai-ib more" [matMenuTriggerFor]="panelMenu"
[matTooltip]="'ai-assistant.chats-menu' | translate" matTooltipPosition="above" [attr.aria-label]="'ai-assistant.chats-menu' | translate">
[matTooltip]="'action.more' | translate" matTooltipPosition="above" [attr.aria-label]="'action.more' | translate">
<mat-icon>more_vert</mat-icon>
</button>
<button type="button" class="ai-ib" (click)="toggleFullscreen()"
[matTooltip]="(fullscreen() ? 'fullscreen.exit' : 'ai-assistant.open-full-screen') | translate" matTooltipPosition="above"
[attr.aria-label]="(fullscreen() ? 'fullscreen.exit' : 'ai-assistant.open-full-screen') | translate">
<mat-icon fontSet="material-icons-round">{{ fullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>
</button>
@if (fullscreen() || !headNarrow()) {
<button type="button" class="ai-ib" (click)="toggleFullscreen()"
[matTooltip]="(fullscreen() ? 'fullscreen.exit' : 'ai-assistant.open-full-screen') | translate" matTooltipPosition="above"
[attr.aria-label]="(fullscreen() ? 'fullscreen.exit' : 'ai-assistant.open-full-screen') | translate">
<mat-icon fontSet="material-icons-round">{{ fullscreen() ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>
</button>
}
@if (!fullscreen()) {
<button type="button" class="ai-ib" (click)="closed.emit()"
[matTooltip]="'action.close' | translate" matTooltipPosition="above" [attr.aria-label]="'action.close' | translate">
@ -263,9 +271,9 @@
@if (shownFile(); as file) {
@if (fileOpen()) {
<tb-ai-artifact-pane [class.art-dark]="fileDark(file)" [dark]="fileCode(file)" (closed)="fileOpen.set(false)">
<h2 artHead class="art-title" [matTooltip]="file.name" matTooltipPosition="below" [matTooltipShowDelay]="600">
<h2 artHead class="art-title" [matTooltip]="file.name" aiTipIfCut matTooltipPosition="below">
<mat-icon class="tb-mat-20" aria-hidden="true">{{ fileMark(file) }}</mat-icon>
<span class="art-name">{{ fileName(file.name).base }}<span class="art-ext">{{ fileName(file.name).ext }}</span></span>
<span class="art-name tb-ai-cut">{{ fileName(file.name).base }}<span class="art-ext">{{ fileName(file.name).ext }}</span></span>
</h2>
<div artHead class="art-head-r">
@if (!file.previewed) {
@ -399,14 +407,10 @@
</div>
<mat-menu #panelMenu="matMenu" xPosition="before" class="tb-ai-chat-menu">
@if (chat()) {
<button mat-menu-item (click)="startRename()">
<mat-icon fontSet="material-icons-round">edit</mat-icon>
<span>{{ 'action.rename' | translate }}</span>
</button>
<button mat-menu-item (click)="newChat()">
<mat-icon fontSet="material-icons-round">add</mat-icon>
<span>{{ 'ai-assistant.new-chat' | translate }}</span>
@if (!fullscreen() && headNarrow()) {
<button mat-menu-item (click)="toggleFullscreen()">
<mat-icon fontSet="material-icons-round">fullscreen</mat-icon>
<span>{{ 'ai-assistant.open-full-screen' | translate }}</span>
</button>
}
@if (docked() && (split() || splitAvailable())) {
@ -415,9 +419,23 @@
<span>{{ (split() ? 'ai-assistant.back-to-panel' : 'ai-assistant.split-view') | translate }}</span>
</button>
}
@if (recentChats().length) {
<div class="tb-ai-menu-h">{{ 'ai-assistant.recent-chats' | translate }}</div>
@for (other of recentChats(); track other.id) {
@if (chat()) {
<button mat-menu-item (click)="startRename()">
<mat-icon fontSet="material-icons-round">edit</mat-icon>
<span>{{ 'action.rename' | translate }}</span>
</button>
<button mat-menu-item (click)="togglePinned()">
<mat-icon fontSet="material-icons-round">push_pin</mat-icon>
<span>{{ (chat()?.pinned ? 'ai-assistant.unpin' : 'ai-assistant.pin') | translate }}</span>
</button>
<button mat-menu-item class="danger" (click)="deleteChat()">
<mat-icon fontSet="material-icons-round">delete_outline</mat-icon>
<span>{{ 'action.delete' | translate }}</span>
</button>
}
@for (group of otherChats(); track group.label) {
<div class="tb-ai-menu-h">{{ group.label | translate }}</div>
@for (other of group.chats; track other.id) {
<button mat-menu-item class="chat" (click)="chatId.set(other.id)">
<mat-icon fontSet="material-icons-round">chat_bubble_outline</mat-icon>
<span class="tb-ai-menu-chat">
@ -433,12 +451,6 @@
<mat-icon fontSet="material-icons-round">forum</mat-icon>
<span>{{ 'ai-assistant.all-chats' | translate }}</span>
</button>
@if (chat()) {
<button mat-menu-item class="danger" (click)="deleteChat()">
<mat-icon fontSet="material-icons-round">delete_outline</mat-icon>
<span>{{ 'action.delete' | translate }}</span>
</button>
}
</mat-menu>
<mat-menu #chatMenu="matMenu" xPosition="before" class="tb-ai-chat-menu">

1
ui-ngx/src/app/modules/home/components/ai/ai-chat.component.scss

@ -23,6 +23,7 @@
.ai-chat-head {
position: relative;
container: k-head / inline-size;
flex: none;
display: flex;
align-items: center;

51
ui-ngx/src/app/modules/home/components/ai/ai-chat.component.ts

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { AI_TOOLTIP_PROVIDERS } from '@home/components/ai/ai-tooltip';
import { aiCreditsLimitOf, AiCreditsLimitType } from '@home/components/ai/ai-credits.models';
import { aiClientOs, aiPageView, isAiTitledView } from '@shared/models/ai-chat.models';
import { getDefaultTimezone } from '@shared/models/time/time.models';
@ -46,6 +47,7 @@ import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { environment as env } from '@env/environment';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { isNotEmptyStr, parseHttpErrorMessage } from '@core/utils';
import { aiChatNameOf } from '@home/components/ai/ai-text';
import { ActionChatMessage, AiStartedFrom, ApprovalChatMessage, ChatMessage, GeneralChatMessage } from '@shared/models/solution-creator.models';
import {
AiAssistantPromptExample,
@ -110,14 +112,19 @@ interface AiRefusal {
'[class.split]': 'split() && docked()',
'[class.v-page]': '!docked()',
'[class.v-panel]': 'docked()'
}
},
providers: AI_TOOLTIP_PROVIDERS
})
export class AiChatComponent implements OnInit, OnDestroy {
private static readonly RESUME_ATTEMPTS = 4;
private static readonly RESUME_DELAY_MS = 2000;
private static readonly NOTICE_MS = 6000;
private static readonly RECENT_CHATS = 5;
private static readonly MENU_CHATS = 4;
private static readonly NEW_CHAT_TITLE = 'New chat';
private static readonly NARROW_HEAD = 500;
@ViewChild(AiPromptInputComponent) promptInput: AiPromptInputComponent;
@ViewChild(AiChatTitleComponent) titleRef: AiChatTitleComponent;
@ -167,10 +174,29 @@ export class AiChatComponent implements OnInit, OnDestroy {
{key: 'datasheet', icon: 'attach_file', file: true}
];
recentChats = computed(() => this.chats.chats()
.filter(chat => chat.id !== this.chatId())
.sort((a, b) => b.createdTime - a.createdTime)
.slice(0, AiChatComponent.RECENT_CHATS));
otherChats = computed<{label: string; chats: ChatInfo[]}[]>(() => {
const others = this.chats.chats()
.filter(chat => chat.id !== this.chatId())
.sort((a, b) => (b.updatedTime ?? b.createdTime) - (a.updatedTime ?? a.createdTime));
const startedHere = new Set(this.panelService.chatsStartedHere());
const here = others.filter(chat => startedHere.has(chat.id)).slice(0, AiChatComponent.MENU_CHATS - 1);
const recent = others.filter(chat => !startedHere.has(chat.id)).slice(0, Math.max(1, AiChatComponent.MENU_CHATS - here.length));
return [
...(here.length ? [{label: 'ai-assistant.on-this-page', chats: here}] : []),
...(recent.length ? [{label: 'ai-assistant.recent-chats', chats: recent}] : [])
];
});
headNarrow = signal(false);
shownTitle = computed(() => {
const title = this.chat()?.title;
if (title && title !== AiChatComponent.NEW_CHAT_TITLE) {
return title;
}
const first = this.messages().find(message => message.from === 'USER') as GeneralChatMessage | undefined;
return typeof first?.content === 'string' && first.content.trim() ? aiChatNameOf(first.content) : title;
});
fullscreen = signal<boolean>(false);
@ -549,6 +575,14 @@ export class AiChatComponent implements OnInit, OnDestroy {
});
ngOnInit(): void {
if (typeof ResizeObserver !== 'undefined') {
const head = new ResizeObserver(() => {
const width = this.hostElement.querySelector('.ai-chat-head')?.clientWidth ?? 0;
this.headNarrow.set(width > 0 && width < AiChatComponent.NARROW_HEAD);
});
head.observe(this.hostElement);
this.destroyRef.onDestroy(() => head.disconnect());
}
this.loadChat$.pipe(
switchMap(id => this.aiChat.getChatMessages(id, {ignoreLoading: true, ignoreErrors: true}).pipe(
catchError(err => {
@ -1054,8 +1088,11 @@ export class AiChatComponent implements OnInit, OnDestroy {
this.messageCancelled = false;
const startOrContinue$ = this.chatId()
? of(null)
: this.chats.create('New chat', this.newChatAutoApprove()).pipe(
: this.chats.create(AiChatComponent.NEW_CHAT_TITLE, this.newChatAutoApprove()).pipe(
tap(chat => {
if (this.variant() === 'panel') {
this.panelService.noteStartedHere(chat.id);
}
this.freshChatId = chat.id;
this.shownChatId = chat.id;
this.chatId.set(chat.id);

8
ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.html

@ -7,12 +7,12 @@
<div class="k-colours" role="radiogroup" [attr.aria-label]="question().question">
@for (option of question().options; track option.label) {
<button type="button" role="radio" class="k-colour" [attr.aria-checked]="value() === option.label"
[disabled]="disabled()" (click)="pick(option.label)">
(click)="pick(option.label)">
<span class="k-sw" [style.background]="colorOf(option.label)" aria-hidden="true"></span>
<span class="k-colour-t"><b>{{ option.hint || colorOf(option.label)?.toUpperCase() }}</b>@if (option.hint) {<small>{{ colorOf(option.label)?.toUpperCase() }}</small>}</span>
</button>
}
<button type="button" role="radio" class="k-colour" [attr.aria-checked]="other()" [disabled]="disabled()" (click)="openHex()">
<button type="button" role="radio" class="k-colour" [attr.aria-checked]="other()" (click)="openHex()">
@if (hex(); as color) {
<span class="k-sw" [style.background]="color" aria-hidden="true"></span>
<span class="k-colour-t"><b>{{ 'ai-assistant.question.other-color-short' | translate }}</b><small>{{ color }}</small></span>
@ -27,11 +27,11 @@
<span class="k-hexf-f">
<span class="k-hexf-hash" aria-hidden="true">#</span>
<input #hexInput class="k-hex-in" type="text" maxlength="7" placeholder="00897B" spellcheck="false" autocomplete="off"
[value]="digits()" [disabled]="disabled()" [attr.aria-invalid]="wrong() || null"
[value]="digits()" [attr.aria-invalid]="wrong() || null"
[attr.aria-label]="'ai-assistant.question.hex-label' | translate: {question: question().question, label: ('ai-assistant.question.other-color-short' | translate)}"
(input)="typeHex(hexInput)" (blur)="checkHex(hexInput)" (keydown.enter)="hexEnter($event, hexInput)">
<span class="k-hexf-pick">
<button mat-icon-button type="button" [disabled]="disabled()"
<button mat-icon-button type="button"
[matTooltip]="'ai-assistant.question.pick-color' | translate" matTooltipPosition="above"
[attr.aria-label]="'ai-assistant.question.pick-color' | translate"
(click)="openPicker(picker, hexInput)"><mat-icon>colorize</mat-icon></button>

7
ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.ts

@ -22,7 +22,6 @@ export class AiColorFieldComponent {
question = input.required<AiQuestion>();
value = model('');
disabled = input(false);
enter = output<Event>();
private elementRef: ElementRef<HTMLElement> = inject(ElementRef);
@ -40,9 +39,6 @@ export class AiColorFieldComponent {
}
openHex(): void {
if (this.disabled()) {
return;
}
if (!this.other()) {
this.value.set('#');
}
@ -76,9 +72,6 @@ export class AiColorFieldComponent {
}
openPicker(picker: HTMLInputElement, field: HTMLInputElement): void {
if (this.disabled()) {
return;
}
picker.value = aiHexOf(field.value) ?? '#000000';
try {
picker.showPicker();

12
ui-ngx/src/app/modules/home/components/ai/ai-core.module.ts

@ -10,8 +10,8 @@ import { AiTipDirective } from '@home/components/ai/ai-tip.directive';
import { AiFadeInImageDirective } from '@home/components/ai/ai-fade-in-image.directive';
import { AiSpinComponent } from '@home/components/ai/ai-spin.component';
import { AiSevMarkComponent } from '@home/components/ai/ai-sev-mark.component';
import { AiLoadingModalComponent } from '@home/components/ai/ai-loading-modal.component';
import { AiNoTelemetryModalComponent } from '@home/components/ai/ai-no-telemetry-modal.component';
import { AiTipIfCutDirective, AiTooltipChainDirective } from '@home/components/ai/ai-tooltip';
@NgModule({
declarations: [
@ -22,12 +22,13 @@ import { AiNoTelemetryModalComponent } from '@home/components/ai/ai-no-telemetry
AiFadeInImageDirective,
AiSpinComponent,
AiSevMarkComponent,
AiLoadingModalComponent,
AiNoTelemetryModalComponent
],
imports: [
CommonModule,
SharedModule
SharedModule,
AiTooltipChainDirective,
AiTipIfCutDirective
],
exports: [
AiAssistantButtonComponent,
@ -37,8 +38,9 @@ import { AiNoTelemetryModalComponent } from '@home/components/ai/ai-no-telemetry
AiFadeInImageDirective,
AiSpinComponent,
AiSevMarkComponent,
AiLoadingModalComponent,
AiNoTelemetryModalComponent
AiNoTelemetryModalComponent,
AiTooltipChainDirective,
AiTipIfCutDirective
]
})
export class AiCoreModule {}

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;

71
ui-ngx/src/app/modules/home/components/ai/ai-dashboard-generation.service.ts

@ -1,11 +1,9 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { DestroyRef, Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
import { createDefaultEntityDataPageLink, singleEntityFilterFromDeviceId } from '@shared/models/query/query.models';
import { AiLoadingModalComponent, AiLoadingModalData } from '@home/components/ai/ai-loading-modal.component';
import { dashboardGenerateImage, generateDashboardSteps } from '@home/components/ai/ai.models';
import { finalize } from 'rxjs/operators';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { map } from 'rxjs/operators';
import { forkJoin, of } from 'rxjs';
import {
AiNoTelemetryModalComponent,
AiNoTelemetryModalData
@ -13,21 +11,20 @@ import {
import { Operation } from '@shared/models/security.models';
import { EntityType } from '@shared/models/entity-type.models';
import { EntityService } from '@core/http/entity.service';
import { DeviceService } from '@core/http/device.service';
import { AiAssistantPanelService } from '@core/services/ai-assistant-panel.service';
import { MatDialog } from '@angular/material/dialog';
import { AiChatService } from '@core/http/ai-chat.service';
import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DomSanitizer } from '@angular/platform-browser';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { UserPermissionsService } from '@core/http/user-permissions.service';
import { EntityGroupInfo } from '@shared/models/entity-group.models';
interface GenerateDashboardOptions {
deviceId: string;
destroyRef?: DestroyRef;
noTelemetry: AiNoTelemetryModalData;
beforeOpen?: () => void;
deviceName?: string;
keys?: string[];
checkTelemetry?: boolean;
noTelemetry?: AiNoTelemetryModalData;
beforeCompose?: () => void;
}
interface AllowDashboardGenerateOptions {
@ -41,47 +38,29 @@ interface AllowDashboardGenerateOptions {
export class AiDashboardGenerationService {
constructor(private entityService: EntityService,
private deviceService: DeviceService,
private dialog: MatDialog,
private aiChatService: AiChatService,
private router: Router,
private panelService: AiAssistantPanelService,
private translate: TranslateService,
private sanitizer: DomSanitizer,
private store: Store<AppState>,
private userPermissionsService: UserPermissionsService) {
}
generateWithTelemetryCheck(opts: GenerateDashboardOptions): void {
this.entityService.findEntityKeysByQueryV2({
askInChat(opts: GenerateDashboardOptions): void {
const telemetry$ = opts.checkTelemetry === false ? of(true) : this.entityService.findEntityKeysByQueryV2({
entityFilter: singleEntityFilterFromDeviceId(opts.deviceId),
pageLink: createDefaultEntityDataPageLink(1),
}, true, false).subscribe((res) => {
opts.beforeOpen?.();
if (res.timeseries.length) {
this.generate(opts.deviceId, opts.destroyRef);
} else {
this.openNoTelemetryModal(opts.noTelemetry);
}, true, false).pipe(map(res => res.timeseries.length > 0));
const name$ = opts.deviceName ? of(opts.deviceName) : this.deviceService.getDevice(opts.deviceId, {ignoreLoading: true}).pipe(map(device => device.name));
forkJoin([telemetry$, name$]).subscribe(([hasTelemetry, name]) => {
if (!hasTelemetry) {
this.openNoTelemetryModal(opts.noTelemetry ?? {});
return;
}
});
}
generate(deviceId: string, destroyRef?: DestroyRef, timeseriesKeys: string[] = []): void {
const dialogRef = this.dialog.open(AiLoadingModalComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {
messages: generateDashboardSteps,
estimateWaitTime: 60000,
image: dashboardGenerateImage
} as AiLoadingModalData
});
let request$ = this.aiChatService.generateDashboard(deviceId, timeseriesKeys).pipe(
finalize(() => dialogRef.close())
);
if (destroyRef) {
request$ = request$.pipe(takeUntilDestroyed(destroyRef));
}
request$.subscribe({
next: (response) => this.router.navigate(['/dashboards', response])
opts.beforeCompose?.();
const keys = (opts.keys ?? []).filter(Boolean);
this.panelService.compose(keys.length
? this.translate.instant('ai-assistant.ask.device-dashboard-keys', {name, keys: keys.join(', ')})
: this.translate.instant('ai-assistant.ask.device-dashboard', {name}));
});
}

15
ui-ngx/src/app/modules/home/components/ai/ai-loading-modal.component.html

@ -1,15 +0,0 @@
<!--
SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
SPDX-License-Identifier: BUSL-1.1
-->
<div class="tb-generated flex flex-col items-center justify-center">
<div class="panel flex max-w-full flex-col items-center gap-6 rounded-lg p-10">
<img [src]="data?.image || generateImage" alt="Loading">
<div class="flex flex-col items-center gap-1">
<span class="msg text-xl font-semibold" [class.text-changed]="statusMessageChanged">{{ statusMessage | translate }}</span>
<span class="info">{{ 'solution-creator.estimate-wait-time' | translate: {time: (data.estimateWaitTime | milliSecondsToTimeString:true : true)} }}</span>
</div>
</div>
</div>

34
ui-ngx/src/app/modules/home/components/ai/ai-loading-modal.component.scss

@ -1,34 +0,0 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
.tb-generated {
z-index: 3;
.panel {
box-shadow: 0 6px 12px 0 rgba(0, 0, 0, 0.04), 0 12px 32px 0 rgba(0, 0, 0, 0.08);
background-color: #fff;
width: 500px;
}
img {
width: 200px;
}
.info {
white-space: pre-line;
text-align: center;
line-height: 1.5;
letter-spacing: 0.15px;
}
.msg.text-changed {
animation: fadeInSlideUp 0.5s ease-out forwards;
}
@keyframes fadeInSlideUp {
0% {
opacity: 0;
transform: translateY(15px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
}

61
ui-ngx/src/app/modules/home/components/ai/ai-loading-modal.component.ts

@ -1,61 +0,0 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { Component, DestroyRef, Inject, OnInit, ViewEncapsulation } from '@angular/core';
import { DialogComponent } from '@shared/components/dialog.component';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { from, of } from 'rxjs';
import { concatMap, delay } from 'rxjs/operators';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { generatedStateImages } from '@home/components/ai/ai.models';
export interface AiLoadingModalData {
messages: Array<{text: string; delay: number}>;
estimateWaitTime: number;
image?: string;
}
@Component({
selector: 'tb-ai-loading-modal',
templateUrl: './ai-loading-modal.component.html',
styleUrl: './ai-loading-modal.component.scss',
encapsulation: ViewEncapsulation.None,
standalone: false,
host: {
style: 'width: 100%; height: 100%; min-height: 100%; display: flex; overflow: hidden;'
}
})
export class AiLoadingModalComponent extends DialogComponent<AiLoadingModalComponent> implements OnInit {
generateImage: string = generatedStateImages[Math.floor(Math.random() * generatedStateImages.length)];
statusMessage: string = '';
statusMessageChanged = false;
constructor(protected store: Store<AppState>,
protected router: Router,
@Inject(MAT_DIALOG_DATA) public data: AiLoadingModalData,
public dialogRef: MatDialogRef<AiLoadingModalComponent>,
private destroyRef: DestroyRef) {
super(store, router, dialogRef);
}
ngOnInit() {
this.initGenerateState();
}
private initGenerateState(): void {
from(this.data.messages).pipe(
concatMap(message => of(message).pipe(delay(message.delay))),
takeUntilDestroyed(this.destroyRef)
).subscribe((msg) => {
this.statusMessageChanged = true;
this.statusMessage = msg.text;
setTimeout(() => {
this.statusMessageChanged = false;
}, 500);
});
}
}

6
ui-ngx/src/app/modules/home/components/ai/ai-number-field.component.html

@ -5,16 +5,16 @@
-->
<div class="k-numf" [class.s]="size() === 's'" [class.m]="size() === 'm'" [class.l]="size() === 'l'">
<button mat-icon-button type="button" [disabled]="disabled()" [attr.aria-label]="'ai-assistant.question.lower' | translate: {step: step()}"
<button mat-icon-button type="button" [attr.aria-label]="'ai-assistant.question.lower' | translate: {step: step()}"
(click)="stepBy(numInput, -1)"><mat-icon>remove</mat-icon></button>
<input #numInput class="k-num-in" type="text" inputmode="decimal" spellcheck="false" [disabled]="disabled()"
<input #numInput class="k-num-in" type="text" inputmode="decimal" spellcheck="false"
[value]="value()" [attr.aria-invalid]="wrong() || null" [attr.aria-label]="question().question + (question().number?.unit ? ' · ' + question().number.unit : '')"
(input)="typed(numInput)" (blur)="settle()" (keydown.arrowup)="$event.preventDefault(); stepBy(numInput, 1)"
(keydown.arrowdown)="$event.preventDefault(); stepBy(numInput, -1)" (keydown.enter)="onEnter($event)">
@if (question().number?.unit) {
<span class="k-unit">{{ question().number.unit }}</span>
}
<button mat-icon-button type="button" [disabled]="disabled()" [attr.aria-label]="'ai-assistant.question.higher' | translate: {step: step()}"
<button mat-icon-button type="button" [attr.aria-label]="'ai-assistant.question.higher' | translate: {step: step()}"
(click)="stepBy(numInput, 1)"><mat-icon>add</mat-icon></button>
</div>
@if (wrong()) {

4
ui-ngx/src/app/modules/home/components/ai/ai-number-field.component.ts

@ -15,7 +15,6 @@ export class AiNumberFieldComponent {
question = input.required<AiQuestion>();
value = model('');
disabled = input(false);
enter = output<Event>();
private translate = inject(TranslateService);
@ -31,9 +30,6 @@ export class AiNumberFieldComponent {
}
stepBy(field: HTMLInputElement, direction: number): void {
if (this.disabled()) {
return;
}
const current = aiReadNumber(field.value, this.locale());
const base = isNaN(current) ? (this.question().number?.suggested ?? 0) : current;
const decimals = Math.max(aiStepDecimals(this.step()), isNaN(current) ? 0 : aiStepDecimals(current));

4
ui-ngx/src/app/modules/home/components/ai/ai-plan.component.html

@ -22,7 +22,7 @@
<span class="k-plan-count">{{ gate() || !progress() ? ('ai-assistant.plan.steps' | translate: {count: counted()}) : ('ai-assistant.plan.done-of' | translate: {done: done(), count: counted()}) }}</span>
<span class="tb-spacer"></span>
@if (gate()) {
<button type="button" class="k-iconbtn" (click)="change.emit()" [matTooltip]="'ai-assistant.plan.change' | translate"
<button type="button" class="k-iconbtn" (click)="changeRequested.emit()" [matTooltip]="'ai-assistant.plan.change' | translate"
matTooltipPosition="above" [attr.aria-label]="'ai-assistant.plan.change' | translate">
<mat-icon class="tb-mat-18" aria-hidden="true">edit</mat-icon>
</button>
@ -47,7 +47,7 @@
<button mat-flat-button type="button" (click)="start(true)" [matTooltip]="'ai-assistant.plan.run-auto-tip' | translate" matTooltipPosition="above">
<mat-icon>bolt</mat-icon>{{ 'ai-assistant.plan.run-auto' | translate }}
</button>
<button mat-stroked-button type="button" (click)="start(false)" [matTooltip]="'ai-assistant.plan.run-tip' | translate" matTooltipPosition="above">
<button mat-stroked-button type="button" (click)="start(false)">
<mat-icon>play_arrow</mat-icon>{{ 'ai-assistant.plan.run-step-by-step' | translate }}
</button>
} @else {

2
ui-ngx/src/app/modules/home/components/ai/ai-plan.component.ts

@ -30,7 +30,7 @@ export class AiPlanComponent {
open = this.fold.open;
@Output() run = new EventEmitter<AiPlanRun>();
@Output() change = new EventEmitter<void>();
@Output() changeRequested = new EventEmitter<void>();
private cleared = signal<ReadonlySet<number>>(new Set());

2
ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.html

@ -53,7 +53,7 @@
<div class="composer-row">
<span class="composer-chevron" aria-hidden="true"></span>
@if (suggestion && !hasText()) {
<div class="composer-ghost" aria-hidden="true"><span>{{ suggestion }}</span><kbd>Tab</kbd></div>
<div class="composer-ghost" [class.tight]="ghostTight()" aria-hidden="true">@if (ghostTight()) {<span>{{ suggestion }}</span><kbd>Tab</kbd>} @else {<span>{{ ghostHead() }}<span class="composer-ghost-end">{{ ghostLast() }}<kbd>Tab</kbd></span></span>}</div>
<span id="composer-suggestion" class="tb-ai-sr-only">{{ 'ai-assistant.suggestion-sr' | translate: {text: suggestion} }}</span>
}
<textarea #textarea

62
ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.ts

@ -23,6 +23,7 @@ import {
import { FormControl } from '@angular/forms';
import { toSignal } from '@angular/core/rxjs-interop';
import { Subscription } from 'rxjs';
import { take } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { MatDialog } from '@angular/material/dialog';
import { AiShortcutsDialogComponent } from '@home/components/ai/ai-shortcuts-dialog.component';
@ -80,6 +81,8 @@ export class AiPromptInputComponent implements OnChanges, AfterViewInit, OnDestr
@Input() suggestion: string | null = null;
ghostTight = signal(false);
@Input() quote: AiLinesQuote | null = null;
@Output() quoteRemoved = new EventEmitter<void>();
@ -176,6 +179,9 @@ export class AiPromptInputComponent implements OnChanges, AfterViewInit, OnDestr
if (changes.dropZone) {
this.listenForDrops(this.dropZone ?? this.host.nativeElement);
}
if (changes.suggestion) {
setTimeout(() => this.fitGhost());
}
}
ngAfterViewInit(): void {
@ -258,18 +264,39 @@ export class AiPromptInputComponent implements OnChanges, AfterViewInit, OnDestr
this.clearAttachments(true);
}
restoreAttachments(resources: AiResourceInfo[]): void {
const kept = untracked(() => this.attachments());
const missing = (resources ?? []).filter(resource => !kept.some(attachment => attachment.resource?.id === resource.id));
for (const resource of missing) {
const kind = aiAttachmentKind(resource.mediaType, resource.name);
const key = guid();
this.attachments.update(list => [...list, {
key, name: resource.name, size: resource.size, icon: kind.icon, kind: kind.label, status: 'ready', progress: 100, resource
}]);
if (resource.mediaType?.startsWith('image/')) {
this.aiResourceService.getUrl(resource.id).pipe(take(1)).subscribe({
next: previewUrl => this.patch(key, {previewUrl}),
error: () => {}
});
}
}
}
focus(): void {
this.textarea?.nativeElement.focus();
}
setValue(value: string): void {
setValue(value: string, showStart = false): void {
this.message.setValue(value);
this.hasText.set(!!value);
setTimeout(() => {
const field = this.textarea?.nativeElement;
field?.focus();
field?.focus({preventScroll: showStart});
field?.setSelectionRange(field.value.length, field.value.length);
this.resize();
if (field && showStart) {
field.scrollTop = 0;
}
});
}
@ -423,6 +450,37 @@ export class AiPromptInputComponent implements OnChanges, AfterViewInit, OnDestr
const cap = this.docked ? Math.min(160, Math.round(innerHeight * 0.3)) : Math.min(this.pinned ? 240 : 220, Math.round(innerHeight * 0.4));
field.style.height = 'auto';
field.style.height = Math.min(field.scrollHeight, cap) + 'px';
this.fitGhost();
}
ghostHead(): string {
const text = this.suggestion ?? '';
const space = text.lastIndexOf(' ');
return space < 0 ? '' : text.slice(0, space + 1);
}
ghostLast(): string {
const text = this.suggestion ?? '';
return text.slice(text.lastIndexOf(' ') + 1);
}
private fitGhost(): void {
const ghost = this.host.nativeElement.querySelector<HTMLElement>('.composer-ghost');
const words = ghost?.firstElementChild as HTMLElement | null;
const key = ghost?.querySelector<HTMLElement>('kbd');
if (!ghost || !words || !key) {
this.ghostTight.set(false);
return;
}
ghost.classList.remove('tight');
const wrap = ghost.style.whiteSpace;
ghost.style.whiteSpace = 'nowrap';
const keyWidth = key.getBoundingClientRect().width + parseFloat(getComputedStyle(key).marginLeft || '0');
const wordsWidth = words.getBoundingClientRect().width - (words.contains(key) ? keyWidth : 0);
ghost.style.whiteSpace = wrap;
const tight = wordsWidth <= ghost.clientWidth && wordsWidth + keyWidth > ghost.clientWidth;
ghost.classList.toggle('tight', tight);
this.ghostTight.set(tight);
}
private clearText(): void {

36
ui-ngx/src/app/modules/home/components/ai/ai-question.component.html

@ -30,11 +30,11 @@
</section>
}
<div class="k-actions">
<button mat-flat-button type="button" color="primary" [disabled]="disabled() || !allReady()" (click)="finish()">
<button mat-flat-button type="button" color="primary" [disabled]="!allReady()" (click)="finish()">
<mat-icon>check</mat-icon>{{ 'ai-assistant.question.done' | translate }}
</button>
<span class="tb-spacer"></span>
<button mat-button type="button" [disabled]="disabled()" (click)="skipAll()">{{ 'ai-assistant.question.skip' | translate }}</button>
<button mat-button type="button" (click)="skipAll()">{{ 'ai-assistant.question.skip' | translate }}</button>
</div>
</div>
} @else if (current(); as question) {
@ -56,11 +56,11 @@
<mat-icon>arrow_back</mat-icon>{{ 'action.back' | translate }}
</button>
}
<button mat-flat-button type="button" color="primary" [disabled]="disabled() || !ready(question)" (click)="next()">
<button mat-flat-button type="button" color="primary" [disabled]="!ready(question)" (click)="next()">
<mat-icon>{{ last() ? 'check' : 'arrow_forward' }}</mat-icon>{{ (last() ? 'ai-assistant.question.done' : 'ai-assistant.question.next') | translate }}
</button>
<span class="tb-spacer"></span>
<button mat-button type="button" [disabled]="disabled()" (click)="skipAll()">{{ 'ai-assistant.question.skip' | translate }}</button>
<button mat-button type="button" (click)="skipAll()">{{ 'ai-assistant.question.skip' | translate }}</button>
</div>
</div>
}
@ -78,15 +78,15 @@
<div class="k-ask-a">
@switch (kind(step)) {
@case ('color') {
<tb-ai-color-field [question]="step" [value]="colorValue(step)" [disabled]="disabled()"
<tb-ai-color-field [question]="step" [value]="colorValue(step)"
(valueChange)="setColor(step, $event)" (enter)="onEnter($event)"></tb-ai-color-field>
}
@case ('secret') {
<tb-ai-secret-field [question]="step" [value]="otherText(step)" [disabled]="disabled()"
<tb-ai-secret-field [question]="step" [value]="otherText(step)"
(valueChange)="setTyped(step, $event)" (enter)="onEnter($event)"></tb-ai-secret-field>
}
@case ('number') {
<tb-ai-number-field [question]="step" [value]="otherText(step)" [disabled]="disabled()"
<tb-ai-number-field [question]="step" [value]="otherText(step)"
(valueChange)="setTyped(step, $event)" (enter)="onEnter($event)"></tb-ai-number-field>
}
@case ('text') {
@ -94,7 +94,7 @@
<div class="k-optcard other free" (click)="$any($event.currentTarget).querySelector('.k-opt-input')?.focus()">
<span class="k-optbody">
<b>{{ otherLabel(step) }}</b>
<textarea #freeArea class="k-opt-input" rows="1" spellcheck="false" [disabled]="disabled()"
<textarea #freeArea class="k-opt-input" rows="1" spellcheck="false"
[value]="otherText(step)" [placeholder]="step.other?.placeholder || ('ai-assistant.question.type-answer' | translate)"
[attr.aria-label]="step.question" (input)="type(step, freeArea)" (keydown.enter)="onEnter($event)"></textarea>
</span>
@ -106,7 +106,7 @@
[style.--n]="step.options.length">
@for (option of step.options; track option.label) {
<button type="button" role="checkbox" class="k-optcard multi" [attr.aria-checked]="isChosen(step, option.label)"
[disabled]="disabled()" (click)="toggle(step, option.label)">
(click)="toggle(step, option.label)">
<span class="k-optdot"><mat-icon aria-hidden="true">check</mat-icon></span>
<span class="k-optbody"><b>@if (colorOf(option.label); as color) {<span class="k-swatch" [style.background]="color" aria-hidden="true"></span>}{{ option.label }}</b>@if (option.hint) {<span>{{ option.hint }}</span>}</span>
</button>
@ -115,7 +115,7 @@
<span class="k-optdot"><mat-icon aria-hidden="true">check</mat-icon></span>
<span class="k-optbody">
<b>{{ otherLabel(step) }}</b>
<textarea #multiArea class="k-opt-input" rows="1" spellcheck="false" [disabled]="disabled()"
<textarea #multiArea class="k-opt-input" rows="1" spellcheck="false"
[value]="otherText(step)" [placeholder]="step.other?.placeholder || ('ai-assistant.question.other-hint' | translate)"
[attr.aria-label]="step.question + ' · ' + otherLabel(step)"
(input)="type(step, multiArea)" (keydown.enter)="onEnter($event)"></textarea>
@ -128,11 +128,11 @@
@for (option of step.options; track option.label) {
<button type="button" role="radio" class="ob-chip" [attr.aria-checked]="!isOther(step) && valueOf(step) === option.label"
[attr.aria-pressed]="!isOther(step) && valueOf(step) === option.label"
[disabled]="disabled()" (click)="pick(step, option.label)">{{ option.label }}</button>
(click)="pick(step, option.label)">{{ option.label }}</button>
}
<button #dayChip type="button" role="radio" class="ob-chip" aria-haspopup="dialog" [attr.aria-expanded]="dayOpen() === step.id"
[attr.aria-checked]="isOther(step) && !!otherText(step)" [attr.aria-pressed]="isOther(step) && !!otherText(step)"
[disabled]="disabled()" (click)="openDay(step, dayChip)">
(click)="openDay(step, dayChip)">
<mat-icon aria-hidden="true">calendar_today</mat-icon>{{ isOther(step) && otherText(step) ? otherText(step) : otherLabel(step) + '…' }}
</button>
</div>
@ -142,16 +142,16 @@
@for (option of step.options; track option.label) {
<button type="button" role="radio" class="ob-chip" [attr.aria-checked]="!isOther(step) && valueOf(step) === option.label"
[attr.aria-pressed]="!isOther(step) && valueOf(step) === option.label"
[disabled]="disabled()" (click)="pick(step, option.label)">{{ option.label }}</button>
(click)="pick(step, option.label)">{{ option.label }}</button>
}
<button type="button" role="radio" class="ob-chip" [attr.aria-checked]="isOther(step)" [attr.aria-pressed]="isOther(step)"
[disabled]="disabled()" (click)="pickOther(step)">{{ step.other?.label ? step.other.label + '…' : ('ai-assistant.question.other-chip' | translate) }}</button>
(click)="pickOther(step)">{{ step.other?.label ? step.other.label + '…' : ('ai-assistant.question.other-chip' | translate) }}</button>
</div>
@if (isOther(step) && step.number) {
<tb-ai-number-field [question]="step" [value]="otherText(step)" [disabled]="disabled()"
<tb-ai-number-field [question]="step" [value]="otherText(step)"
(valueChange)="setTyped(step, $event)" (enter)="onEnter($event)"></tb-ai-number-field>
} @else if (isOther(step)) {
<textarea #rowArea class="k-opt-input k-other-area" rows="1" spellcheck="false" [disabled]="disabled()"
<textarea #rowArea class="k-opt-input k-other-area" rows="1" spellcheck="false"
[value]="otherText(step)" [placeholder]="step.other?.placeholder || ('ai-assistant.question.other-hint' | translate)"
[attr.aria-label]="step.question + ' · ' + otherLabel(step)"
(input)="type(step, rowArea)" (keydown.enter)="onEnter($event)"></textarea>
@ -164,7 +164,7 @@
[style.--n]="step.options.length">
@for (option of step.options; track option.label) {
<button type="button" role="radio" class="k-optcard" [attr.aria-checked]="!isOther(step) && valueOf(step) === option.label"
[disabled]="disabled()" (click)="pick(step, option.label)">
(click)="pick(step, option.label)">
<span class="k-optdot"></span>
<span class="k-optbody"><b>{{ option.label }}</b>@if (option.hint) {<span>{{ option.hint }}</span>}</span>
</button>
@ -173,7 +173,7 @@
<span class="k-optdot"></span>
<span class="k-optbody">
<b>{{ otherLabel(step) }}</b>
<textarea #otherArea class="k-opt-input" rows="1" spellcheck="false" [disabled]="disabled()"
<textarea #otherArea class="k-opt-input" rows="1" spellcheck="false"
[value]="otherText(step)"
[placeholder]="step.other?.placeholder || ('ai-assistant.question.other-hint' | translate)"
[attr.aria-label]="step.question + ' · ' + otherLabel(step)"

16
ui-ngx/src/app/modules/home/components/ai/ai-question.component.ts

@ -74,7 +74,6 @@ export class AiQuestionComponent {
questions = input.required<AiQuestion[]>();
answered = input<AiQuestionAnswer[] | null>(null);
disabled = input(false);
time = input<number | undefined>(undefined);
@Output() done = new EventEmitter<AiQuestionAnswer[]>();
@ -164,9 +163,6 @@ export class AiQuestionComponent {
}
openDay(question: AiQuestion, chip: HTMLElement): void {
if (this.disabled()) {
return;
}
if (this.popoverService.hasPopover(chip)) {
this.popoverService.hidePopover(chip);
return;
@ -227,7 +223,7 @@ export class AiQuestionComponent {
allReady = computed(() => this.questions().every(question => this.ready(question)));
finish(): void {
if (!this.disabled() && this.questions().every(question => this.ready(question))) {
if (this.questions().every(question => this.ready(question))) {
this.done.emit(this.answers());
}
}
@ -265,7 +261,7 @@ export class AiQuestionComponent {
next(): void {
const question = this.current();
if (!question || !this.ready(question) || this.disabled()) {
if (!question || !this.ready(question)) {
return;
}
if (this.last()) {
@ -282,11 +278,9 @@ export class AiQuestionComponent {
}
skipAll(): void {
if (!this.disabled()) {
this.skip.emit(this.questions().map(question => this.given(question)
? {question, answer: this.answerOf(question), secret: !!question.secret && !question.options?.length}
: {question, answer: this.defaultOf(question)}));
}
this.skip.emit(this.questions().map(question => this.given(question)
? {question, answer: this.answerOf(question), secret: !!question.secret && !question.options?.length}
: {question, answer: this.defaultOf(question)}));
}
onEnter(event: Event): void {

2
ui-ngx/src/app/modules/home/components/ai/ai-record-card.component.ts

@ -81,7 +81,7 @@ export function aiWidgetThumb(): string {
</div>
<span class="tb-rec-side">
@if (rec.hub) {
<span class="tb-ai-state hub" [matTooltip]="'ai-assistant.detail.on-iot-hub' | translate" matTooltipPosition="above">
<span class="tb-ai-state hub">
<mat-icon class="tb-mat-16" aria-hidden="true">hub</mat-icon>IoT Hub
</span>
} @else if (rec.alarm; as current) {

4
ui-ngx/src/app/modules/home/components/ai/ai-record.component.ts

@ -11,9 +11,9 @@ export { AiRecordState } from '@home/components/ai/ai-record.models';
template: `
<span class="tb-rec-tile"><tb-icon aria-hidden="true">{{ kind().icon }}</tb-icon></span>
@if (url()) {
<a class="tb-rec-name" [routerLink]="url()" [matTooltip]="name()" matTooltipPosition="above" [matTooltipShowDelay]="600">{{ name() }}</a>
<a class="tb-rec-name" [routerLink]="url()" [matTooltip]="name()" aiTipIfCut matTooltipPosition="above">{{ name() }}</a>
} @else {
<span class="tb-rec-name" [matTooltip]="name()" matTooltipPosition="above" [matTooltipShowDelay]="600">{{ name() }}</span>
<span class="tb-rec-name" [matTooltip]="name()" aiTipIfCut matTooltipPosition="above">{{ name() }}</span>
}
@if (badge(); as label) {
<span class="tb-rec-badge" [attr.data-badge]="label.toLowerCase()">{{ label }}</span>

4
ui-ngx/src/app/modules/home/components/ai/ai-secret-field.component.html

@ -7,9 +7,9 @@
<div class="k-secret">
<span class="k-secret-f">
<input #secretInput class="k-opt-input" [type]="shown() ? 'text' : 'password'" autocomplete="new-password" spellcheck="false"
[disabled]="disabled()" [value]="value()" [placeholder]="question().other?.placeholder || ('ai-assistant.question.type-secret' | translate)"
[value]="value()" [placeholder]="question().other?.placeholder || ('ai-assistant.question.type-secret' | translate)"
[attr.aria-label]="question().question" (input)="value.set(secretInput.value)" (keydown.enter)="enter.emit($event)">
<button mat-icon-button type="button" class="k-show" [disabled]="disabled()"
<button mat-icon-button type="button" class="k-show"
[attr.aria-label]="(shown() ? 'ai-assistant.question.hide' : 'ai-assistant.question.show') | translate"
[matTooltip]="(shown() ? 'ai-assistant.question.hide' : 'ai-assistant.question.show') | translate"
(click)="toggle(secretInput)">

1
ui-ngx/src/app/modules/home/components/ai/ai-secret-field.component.ts

@ -13,7 +13,6 @@ export class AiSecretFieldComponent {
question = input.required<AiQuestion>();
value = model('');
disabled = input(false);
enter = output<Event>();
readonly shown = signal(false);

2
ui-ngx/src/app/modules/home/components/ai/ai-started-from.component.ts

@ -56,7 +56,7 @@ const LIST_PAGES: Record<string, {entityType: string; url: string}> = {
@if (page(); as current) {
<span>{{ 'ai-assistant.started-from' | translate }}</span>
@if (current.url) {
<a class="tb-chiplink" [routerLink]="current.url" [matTooltip]="'ai-assistant.open-page' | translate: {name: current.name}" matTooltipPosition="above">
<a class="tb-chiplink" [routerLink]="current.url">
<code class="k-ent" [attr.data-pal]="kind().palette"><tb-icon class="k-ent-ic" aria-hidden="true">{{ kind().icon }}</tb-icon>{{ current.name }}<mat-icon class="tb-chip-go" aria-hidden="true">chevron_right</mat-icon></code>
</a>
} @else {

12
ui-ngx/src/app/modules/home/components/ai/ai-text.ts

@ -16,3 +16,15 @@ export function aiLocale(lang: string | undefined): string | undefined {
export function aiClockText(time: number | undefined, lang: string | undefined): string {
return new Date(time ?? Date.now()).toLocaleTimeString(aiLocale(lang), {hour: '2-digit', minute: '2-digit', hourCycle: 'h23'});
}
const CHAT_NAME_MAX = 44;
const CHAT_NAME_MIN_CUT = 20;
export function aiChatNameOf(prompt: string): string {
const first = prompt.replace(/[*_`#>]/g, '').trim().split(/[.:\n]/)[0].trim();
if (first.length <= CHAT_NAME_MAX) {
return first;
}
const space = first.lastIndexOf(' ', CHAT_NAME_MAX);
return first.slice(0, space > CHAT_NAME_MIN_CUT ? space : CHAT_NAME_MAX).replace(/[,;·\s]+$/, '') + '…';
}

70
ui-ngx/src/app/modules/home/components/ai/ai-tooltip.ts

@ -0,0 +1,70 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { Directive, ElementRef, HostListener, inject, Provider } from '@angular/core';
import { MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltip, MatTooltipDefaultOptions } from '@angular/material/tooltip';
export const AI_TOOLTIP_OPTIONS: MatTooltipDefaultOptions = {
showDelay: 500,
hideDelay: 0,
touchendHideDelay: 1500,
disableTooltipInteractivity: true,
tooltipClass: 'tb-ai-tip'
};
export const AI_TOOLTIP_PROVIDERS: Provider[] = [{provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: AI_TOOLTIP_OPTIONS}];
const NEXT_AT_ONCE_MS = 400;
let lastTipAt = 0;
@Directive({
selector: '[matTooltip]',
standalone: true
})
export class AiTooltipChainDirective {
private tooltip = inject(MatTooltip, {self: true});
private host = inject<ElementRef<HTMLElement>>(ElementRef);
@HostListener('mouseenter')
onEnter(): void {
if (this.inChat()) {
this.tooltip.showDelay = Date.now() - lastTipAt < NEXT_AT_ONCE_MS ? 0 : AI_TOOLTIP_OPTIONS.showDelay;
}
}
@HostListener('mouseleave')
onLeave(): void {
if (this.inChat() && this.tooltip._isTooltipVisible()) {
lastTipAt = Date.now();
}
}
@HostListener('focus')
onFocus(): void {
if (this.inChat()) {
this.tooltip.showDelay = this.host.nativeElement.matches(':focus-visible') ? 0 : AI_TOOLTIP_OPTIONS.showDelay;
}
}
private inChat(): boolean {
return (this.tooltip.tooltipClass as string | string[]) === AI_TOOLTIP_OPTIONS.tooltipClass;
}
}
@Directive({
selector: '[aiTipIfCut]',
standalone: true
})
export class AiTipIfCutDirective {
private tooltip = inject(MatTooltip, {self: true});
private host = inject<ElementRef<HTMLElement>>(ElementRef);
@HostListener('mouseenter')
@HostListener('focus')
check(): void {
const element = this.host.nativeElement.querySelector<HTMLElement>('.tb-ai-cut') ?? this.host.nativeElement;
this.tooltip.disabled = element.scrollWidth <= element.clientWidth + 1;
}
}

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

@ -1,22 +0,0 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
export const generatedStateImages: string[] = [
'/assets/solution-creator/building-animated.webp',
'/assets/solution-creator/catch-animated.webp',
'/assets/solution-creator/dashboard-animated.webp',
'/assets/solution-creator/forest-animated.webp',
'/assets/solution-creator/parachute-animated.webp',
'/assets/solution-creator/rocket-animated.webp'
];
export const dashboardGenerateImage = '/assets/solution-creator/dashboard-animated.webp';
export const generateDashboardSteps = [
{ text: 'solution-creator.step-reading-device-data', delay: 0 },
{ text: 'solution-creator.step-analyzing-telemetry-attributes', delay: 2000 },
{ text: 'solution-creator.step-selecting-widgets', delay: 10000 },
{ text: 'solution-creator.step-configuring-titles-units-ranges', delay: 15000 },
{ text: 'solution-creator.step-designing-layout', delay: 25000 },
{ text: 'solution-creator.step-arranging-widgets', delay: 35000 },
{ text: 'solution-creator.step-loading-adding-finishing-touches', delay: 45000 },
]

12
ui-ngx/src/app/modules/home/components/ai/solution/pane/solution-installed.component.html

@ -30,8 +30,7 @@
<div class="sol-sec-head">
<h3>
@if (section.link) {
<a class="sol-sec-link" [routerLink]="section.link" matTooltipPosition="above" matTooltipShowDelay="600"
[matTooltip]="'solution-creator.pane.open-list' | translate: {name: (section.title | translate)}">
<a class="sol-sec-link" [routerLink]="section.link">
{{ section.title | translate }}<mat-icon aria-hidden="true">open_in_new</mat-icon>
</a>
} @else {
@ -45,8 +44,7 @@
<tr [class.waiting]="row.progress === 'wait'">
<td class="wrap sol-installed-name">
@if (link(row.type, row); as url) {
<a class="sol-name sol-ent" [attr.data-pal]="row.palette" [routerLink]="url" matTooltipPosition="above" matTooltipShowDelay="600"
[matTooltip]="'solution-creator.pane.open-list' | translate: {name: row.primary.additionalData?.name}">
<a class="sol-name sol-ent" [attr.data-pal]="row.palette" [routerLink]="url">
<tb-icon aria-hidden="true">{{ row.icon }}</tb-icon><b>{{ row.primary.additionalData?.name }}</b>
</a>
} @else {
@ -61,14 +59,12 @@
<td class="act">
<span class="sol-acts">
@if (link(row.type, row); as url) {
<a mat-button class="sol-act" [routerLink]="url" matTooltipPosition="above" matTooltipShowDelay="600"
[matTooltip]="'solution-creator.pane.open-name' | translate: {name: row.primary.additionalData?.name}">
<a mat-button class="sol-act" [routerLink]="url">
<mat-icon>open_in_new</mat-icon>{{ 'solution-creator.pane.open' | translate }}
</a>
}
@if (canViewAs(row)) {
<button mat-button type="button" class="sol-act" (click)="viewAs(row)" matTooltipPosition="above" matTooltipShowDelay="600"
[matTooltip]="'solution-creator.pane.view-as-user' | translate: {name: dashboardUser(row)}">
<button mat-button type="button" class="sol-act" (click)="viewAs(row)">
<mat-icon>person</mat-icon>{{ 'solution-creator.pane.view-as' | translate }}
</button>
}

10
ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.html

@ -39,6 +39,10 @@
<p class="sol-lead">{{ 'solution-creator.what-it-becomes' | translate }}</p>
@if (creditsOut(); as limitType) {
<tb-ai-credits-out class="sol-hero-credits" [limitType]="limitType" (dismissed)="creditsOut.set(null)"></tb-ai-credits-out>
} @else if (notice(); as current) {
<div [class]="'k-notice sol-hero-notice ' + (current.kind === 'block' ? 'blocking' : current.kind)" [attr.role]="current.kind === 'block' ? 'alert' : 'status'">
<mat-icon aria-hidden="true">{{ current.icon }}</mat-icon><span>{{ current.text }}</span>
</div>
}
<tb-ai-prompt-input class="sol-hero-input"
[placeholder]="activePlaceholder() | translate"
@ -48,7 +52,7 @@
</tb-ai-prompt-input>
<div class="sol-examples">
@for (ex of solutionExamples; track ex.key) {
<button type="button" class="ob-chip" [matTooltip]="'solution-creator.example-tip' | translate" matTooltipPosition="below"
<button type="button" class="ob-chip"
(click)="fillExample(ex.key)">
<mat-icon aria-hidden="true">{{ ex.icon }}</mat-icon>{{ ex.labelKey | translate }}
</button>
@ -199,7 +203,6 @@
@for (view of views(); track view.id) {
<button type="button" [attr.aria-pressed]="currentView() === view.id" [class.working]="view.state === 'working' && currentView() !== view.id"
[disabled]="view.state === 'next'" (click)="pickView(view.id)"
[matTooltip]="('solution-creator.pane.view-' + view.id) | translate" matTooltipPosition="below"
[attr.aria-label]="('solution-creator.pane.view-' + view.id) | translate">
@if (view.state === 'working' && currentView() !== view.id) {
<tb-ai-spin [kind]="view.id === 'solution' ? 'install' : 'gen'"></tb-ai-spin>
@ -243,8 +246,7 @@
</div>
}
@if (jsonAvailable()) {
<button artHead type="button" class="sol-tool" [class.on]="json()" [attr.aria-pressed]="json()" (click)="toggleJson()"
[matTooltip]="'solution-creator.pane.json-tip' | translate" matTooltipPosition="below">
<button artHead type="button" class="sol-tool" [class.on]="json()" [attr.aria-pressed]="json()" (click)="toggleJson()">
<mat-icon aria-hidden="true">data_object</mat-icon><span>JSON</span>
</button>
}

10
ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.scss

@ -194,6 +194,16 @@ tb-ai-chat-title:has(.ai-chat-status) + .sol-head-actions {
}
}
.sol-hero-notice {
align-self: stretch;
margin: 24px 0 8px;
text-align: left;
+ .sol-hero-input {
margin-top: 0;
}
}
.sol-examples {
display: flex;
flex-wrap: wrap;

200
ui-ngx/src/app/modules/home/components/ai/solution/solution-chat.component.ts

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { AI_TOOLTIP_PROVIDERS } from '@home/components/ai/ai-tooltip';
import { aiCreditsLimitOf, AiCreditsLimitType } from '@home/components/ai/ai-credits.models';
import { AiCardAction } from '@home/components/ai/ai-card-actions.component';
import { AiNotice } from '@shared/models/ai-chat.models';
@ -48,10 +49,11 @@ import {
SolutionStepStatus
} from '@shared/models/solution-creator.models';
import { AiPromptInputComponent } from '@home/components/ai/ai-prompt-input.component';
import { AiPromptMessage } from '@shared/models/ai-chat.models';
import { AiPromptMessage, AiResourceInfo } from '@shared/models/ai-chat.models';
import { SolutionsCreatorService } from '@core/http/solutions-creator.service';
import {
catchError,
defaultIfEmpty,
filter,
finalize,
map,
@ -94,12 +96,16 @@ function formatCredits(credits: number): string {
return String(credits);
}
const isVisibleMessage = (msg: ChatMessage): boolean =>
msg.from === 'AI' || (msg.from === 'USER' && !/^<[a-z-]+\/>$/.test(((msg as GeneralChatMessage).content ?? '').trim()));
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'tb-solution-chat',
templateUrl: './solution-chat.component.html',
styleUrls: ['./solution-chat.component.scss'],
standalone: false
standalone: false,
providers: AI_TOOLTIP_PROVIDERS
})
export class SolutionChatComponent extends PageComponent implements OnInit, OnDestroy {
@ -628,6 +634,7 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
);
activePlaceholder = computed(() => this.isInitialEmpty()
|| (this.creatorStep() === 'chat' && this.solutionStep() === SolutionStep.INITIAL_CONFIGURATION && !this.isReadyStep() && !this.pendingQuestions().length)
? 'solution-creator.describe-solution-you-want'
: this.pendingQuestions().length ? 'solution-creator.type-the-answer'
: this.creatorStep() === 'result' ? 'solution-creator.ask-about-solution' : 'solution-creator.say-what-to-change');
@ -758,7 +765,9 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
switchMap(data => {
if (data.solutionId && data.solutionId !== NEW_SOLUTION_ID) {
this.opening.set(true);
return this.solutionCreator.getSolutionById(data.solutionId, {ignoreLoading: true, ignoreErrors: true}).pipe(
const listed$ = this.aiSolutions.loaded() ? of(null) : this.aiSolutions.load().pipe(catchError(() => of(null)));
return forkJoin([this.solutionCreator.getSolutionById(data.solutionId, {ignoreLoading: true, ignoreErrors: true}), listed$]).pipe(
map(([solution]) => solution),
catchError(err => {
this.opening.set(false);
this.creatorStep.set('chat');
@ -867,11 +876,16 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
private restorePrompt(msg: string): void {
const messages = this.messages();
const last = messages.map(message => message.from).lastIndexOf('USER');
let resources: AiResourceInfo[] = [];
if (last >= 0 && (messages[last] as GeneralChatMessage).content === msg) {
resources = (messages[last] as GeneralChatMessage).resources ?? [];
this.messages.set([...messages.slice(0, last), ...messages.slice(last + 1)]);
this.messageSteps = this.messageSteps.slice(0, -1);
}
setTimeout(() => this.promptInput?.setValue(msg));
setTimeout(() => {
this.promptInput?.setValue(msg);
this.promptInput?.restoreAttachments(resources);
});
}
private discardFreshSolution(msg: string): boolean {
@ -956,87 +970,96 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
fillExample(key: string): void {
const example = this.solutionExamples.find(ex => ex.key === key);
if (example) {
this.promptInput?.setValue(example.message);
this.promptInput?.setValue(example.message, true);
}
}
nextStep() {
if(this.solutionInfo.states[this.solutionStep()]?.status === SolutionStepStatus.READY) {
if (this.solutionStep() === SolutionStep.INITIAL_CONFIGURATION) {
const dashboardState = this.solutionInfo.states[SolutionStep.DASHBOARDS_CONFIGURATION];
const notStarted = !dashboardState || (!dashboardState.messages?.length && dashboardState.status !== SolutionStepStatus.READY);
if (notStarted) {
this.solutionInfo.states[SolutionStep.DASHBOARDS_CONFIGURATION] = {
messages: [],
status: SolutionStepStatus.IN_PROGRESS,
chatId: dashboardState?.chatId ?? null
}
this.solutionStep.set(SolutionStep.DASHBOARDS_CONFIGURATION);
this.updatedCurrentMsg();
this.sendDashboardConfigurationMsg('<start/>');
} else if (dashboardState.pendingChanges?.length) {
this.solutionStep.set(SolutionStep.DASHBOARDS_CONFIGURATION);
this.updatedCurrentMsg();
this.sendDashboardConfigurationMsg('<sync/>');
} else {
this.solutionStep.set(SolutionStep.DASHBOARDS_CONFIGURATION);
this.updatedCurrentMsg();
const toDashboards = this.solutionStep() === SolutionStep.INITIAL_CONFIGURATION || this.currentView() === 'overview';
if (toDashboards && this.solutionInfo.states[SolutionStep.INITIAL_CONFIGURATION]?.status !== SolutionStepStatus.READY) {
return;
}
if (!toDashboards && this.solutionInfo.states[SolutionStep.DASHBOARDS_CONFIGURATION]?.status !== SolutionStepStatus.READY) {
if (this.solutionInfo.states[SolutionStep.DASHBOARDS_CONFIGURATION]?.pendingChanges?.length) {
this.sendDashboardConfigurationMsg('<sync/>');
}
return;
}
this.pickedView.set(null);
if (toDashboards) {
const dashboardState = this.solutionInfo.states[SolutionStep.DASHBOARDS_CONFIGURATION];
const notStarted = !dashboardState || (!dashboardState.messages?.length && dashboardState.status !== SolutionStepStatus.READY);
if (notStarted) {
this.solutionInfo.states[SolutionStep.DASHBOARDS_CONFIGURATION] = {
messages: [],
status: SolutionStepStatus.IN_PROGRESS,
chatId: dashboardState?.chatId ?? null
}
} else if (this.solutionStep() === SolutionStep.DASHBOARDS_CONFIGURATION) {
if (this.solutionInfo.metadata?.built) {
this.creatorStep.set('result');
} else {
this.installProgress.set(null);
this.makeStartedAt.set(Date.now());
this.installOnly.set(false);
SolutionChatComponent.markMaking(this.solutionId, true);
const dialogRef = this.initGenerateState('create');
const uninstallOrContinue$ = !this.solutionInfo.metadata?.installed
? of(null)
: this.solutionCreator.uninstallSolution(this.solutionId, {ignoreLoading: true, ignoreErrors: true});
uninstallOrContinue$.pipe(
switchMap(() => this.withProgress(this.solutionCreator.createSolution(this.solutionId, {
ignoreLoading: true,
ignoreErrors: true
}))),
tap(() => this.creatorStep.set('result')),
switchMap((solution) =>
this.installWithProgress()
.pipe(map((installData) => {
if (!solution.metadata) {
solution.metadata = {} as SolutionMetadata;
}
solution.metadata.installed = true;
if (!solution.metadata.installResult) {
solution.metadata.installResult = {} as SolutionInstallResult;
}
Object.assign(solution.metadata.installResult, installData);
return solution;
}))
),
takeUntil(this.cancelPending$),
finalize(() => {
this.isGenerating.set(false);
dialogRef.close();
})
)
.subscribe({
next: (value) => {
SolutionChatComponent.markMaking(value.id, false);
this.solutionInfo = value;
this.aiSolutions.upsert(value);
this.showInstalled();
},
error: (err) => {
if (err?.status !== 0 && !SolutionChatComponent.unloading) {
SolutionChatComponent.markMaking(this.solutionId, false);
this.solutionStep.set(SolutionStep.DASHBOARDS_CONFIGURATION);
this.updatedCurrentMsg();
this.sendDashboardConfigurationMsg('<start/>');
} else if (dashboardState.pendingChanges?.length) {
this.solutionStep.set(SolutionStep.DASHBOARDS_CONFIGURATION);
this.updatedCurrentMsg();
this.sendDashboardConfigurationMsg('<sync/>');
} else {
this.solutionStep.set(SolutionStep.DASHBOARDS_CONFIGURATION);
this.updatedCurrentMsg();
}
} else {
if (this.solutionInfo.metadata?.built) {
this.creatorStep.set('result');
} else {
this.installProgress.set(null);
this.makeStartedAt.set(Date.now());
this.installOnly.set(false);
SolutionChatComponent.markMaking(this.solutionId, true);
const dialogRef = this.initGenerateState('create');
const uninstallOrContinue$ = !this.solutionInfo.metadata?.installed
? of(null)
: this.solutionCreator.uninstallSolution(this.solutionId, {ignoreLoading: true, ignoreErrors: true});
uninstallOrContinue$.pipe(
switchMap(() => this.withProgress(this.solutionCreator.createSolution(this.solutionId, {
ignoreLoading: true,
ignoreErrors: true
}))),
tap(() => this.creatorStep.set('result')),
switchMap((solution) =>
this.installWithProgress()
.pipe(map((installData) => {
if (!solution.metadata) {
solution.metadata = {} as SolutionMetadata;
}
if (!this.wasStopped(err, () => this.nextStep(), 'build') && !this.noticeFor(err)) {
this.reportFailure(err);
solution.metadata.installed = true;
if (!solution.metadata.installResult) {
solution.metadata.installResult = {} as SolutionInstallResult;
}
Object.assign(solution.metadata.installResult, installData);
return solution;
}))
),
takeUntil(this.cancelPending$),
finalize(() => {
this.isGenerating.set(false);
dialogRef.close();
})
)
.subscribe({
next: (value) => {
SolutionChatComponent.markMaking(value.id, false);
this.solutionInfo = value;
this.aiSolutions.upsert(value);
this.showInstalled();
},
error: (err) => {
if (err?.status !== 0 && !SolutionChatComponent.unloading) {
SolutionChatComponent.markMaking(this.solutionId, false);
}
});
}
if (!this.wasStopped(err, () => this.nextStep(), 'build') && !this.noticeFor(err)) {
this.reportFailure(err);
}
}
});
}
}
}
@ -1193,7 +1216,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()});
}
});
}
@ -1246,8 +1269,10 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
this.solutionCreator.updateSolutionData(this.solutionId, 'solutionDescriptor', descriptor, {ignoreLoading: true}).pipe(
takeUntil(this.cancelPending$)
).subscribe(value => {
this.solutionInfo = value;
});
this.solutionInfo = value;
this.aiSolutions.upsert(value);
this.updatedCurrentMsg();
});
}
updatedDashboardOverview(dashboards: DashboardsOverview[]) {
@ -1255,6 +1280,8 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
takeUntil(this.cancelPending$)
).subscribe(value => {
this.solutionInfo = value;
this.aiSolutions.upsert(value);
this.updatedCurrentMsg();
});
}
@ -1419,8 +1446,7 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
const steps = this.solutionStep() === SolutionStep.DASHBOARDS_CONFIGURATION
? [SolutionStep.INITIAL_CONFIGURATION, SolutionStep.DASHBOARDS_CONFIGURATION]
: [SolutionStep.INITIAL_CONFIGURATION];
const visible = (msg: ChatMessage) => msg.from === 'AI' || (msg.from === 'USER' && !/^<[a-z-]+\/>$/.test(((msg as GeneralChatMessage).content ?? '').trim()));
const tagged = steps.flatMap(step => (this.solutionInfo.states[step]?.messages ?? []).filter(visible).map(message => ({message, step})));
const tagged = steps.flatMap(step => (this.solutionInfo.states[step]?.messages ?? []).filter(isVisibleMessage).map(message => ({message, step})));
this.messageSteps = tagged.map(item => item.step);
this.messages.set(tagged.map(item => item.message));
const stepState = this.solutionInfo.states[this.solutionStep()];
@ -1663,14 +1689,17 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
this.aiSolutions.load()
]).pipe(catchError(() => EMPTY))),
take(1),
defaultIfEmpty(null),
takeUntil(this.cancelPending$),
takeUntilDestroyed(this.destroyRef)
).subscribe(([solution]) => {
).subscribe(result => {
if (this.solutionId !== solutionId) {
return;
}
this.notice.set(null);
const received = (solution.states?.[step]?.messages ?? []).filter(message => message.from === 'USER').length >= sent;
const solution = result?.[0];
const received = !!solution && (solution.states?.[step]?.messages ?? [])
.filter(message => message.from === 'USER' && isVisibleMessage(message)).length >= sent;
if (!received) {
this.restorePrompt(msg);
this.setNotice('warn', 'wifi_off', 'connection-failed');
@ -1689,6 +1718,9 @@ export class SolutionChatComponent extends PageComponent implements OnInit, OnDe
private stepAwaitingReply(solution: SolutionCreatorInfo | undefined, step: SolutionStep): boolean {
const state = solution?.states?.[step];
const last = state?.messages?.at(-1) as GeneralChatMessage | undefined;
if (state && state.status !== SolutionStepStatus.READY && this.aiSolutions.find(solution.id)?.status === 'RUNNING') {
return true;
}
if (state && !last && state.status !== SolutionStepStatus.READY) {
return !this.aiSolutions.loaded() || this.aiSolutions.find(solution.id)?.status === 'RUNNING';
}

9
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts

@ -6,7 +6,6 @@ import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
DestroyRef,
ElementRef,
Injector,
Input,
@ -216,7 +215,6 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI
private elementRef: ElementRef,
private fb: FormBuilder,
private timeService: TimeService,
private destroyRef: DestroyRef,
private aiDashboardGenerationService: AiDashboardGenerationService) {
super(store);
this.isSysAdmin = getCurrentAuthUser(this.store).authority === Authority.SYS_ADMIN;
@ -677,8 +675,11 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI
generateDashboard($event: Event) {
$event.stopPropagation();
const selectedTimeseries = this.dataSource.selection.selected.map(telemetry => telemetry.key);
this.aiDashboardGenerationService.generate(this.entityIdValue.id, this.destroyRef, selectedTimeseries);
this.aiDashboardGenerationService.askInChat({
deviceId: this.entityIdValue.id,
keys: this.dataSource.selection.selected.map(telemetry => telemetry.key),
checkTelemetry: false
});
}
isAllowedDashboardGenerate(): boolean {

9
ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.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 { ChangeDetectorRef, Component, DestroyRef, Inject, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
@ -429,7 +429,6 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
protected router: Router,
protected dialogRef: MatDialogRef<TbDeviceInstallDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DeviceInstallDialogData,
private destroyRef: DestroyRef,
private cdr: ChangeDetectorRef,
private deviceProfileService: DeviceProfileService,
private deviceService: DeviceService,
@ -832,10 +831,10 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
if (!deviceId) {
return;
}
this.aiDashboardGenerationService.generateWithTelemetryCheck({
this.aiDashboardGenerationService.askInChat({
deviceId,
destroyRef: this.destroyRef,
noTelemetry: { hideSendTelemetry: true }
noTelemetry: { hideSendTelemetry: true },
beforeCompose: () => this.done()
});
}

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"

3
ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant.component.html

@ -66,8 +66,7 @@
[class.attn]="needsAttention(chat)"
[attr.aria-current]="isActive(chat) ? 'page' : null"
(click)="selectRow(chat)" (keydown.enter)="selectRow(chat)">
<span class="ai-row-title" [matTooltip]="'ai-assistant.double-click-to-rename' | translate" matTooltipPosition="after"
matTooltipPositionAtOrigin matTooltipClass="tb-ai-cursor-tooltip" matTooltipShowDelay="500"
<span class="ai-row-title"
(dblclick)="$event.stopPropagation(); startRename(chat)">
@if (chat.solution) {
<mat-icon class="ai-row-ic" fontSet="material-icons-round" aria-hidden="true">layers</mat-icon>

4
ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant.component.ts

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { AI_TOOLTIP_PROVIDERS } from '@home/components/ai/ai-tooltip';
import { TourService } from '@core/services/tour.service';
import { AiAssistantPanelService } from '@core/services/ai-assistant-panel.service';
import { AiChatService } from '@core/http/ai-chat.service';
@ -61,7 +62,8 @@ export interface AiChatsGroup {
host: {
'data-ai': '',
'[class.rail-open]': 'railOpen()'
}
},
providers: AI_TOOLTIP_PROVIDERS
})
export class AiAssistantComponent implements OnInit, OnDestroy {

1
ui-ngx/src/app/modules/home/pages/ai-assistant/cli/ai-cli-guide.component.scss

@ -83,6 +83,7 @@ $hero-bg: #1b252c;
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
overflow-anchor: none;
padding: 0 20px;
text-align: left;
}

20
ui-ngx/src/app/modules/home/pages/device/device-check-connectivity-dialog.component.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 { Component, DestroyRef, Inject, NgZone, OnDestroy, OnInit } from '@angular/core';
import { Component, Inject, NgZone, OnDestroy, OnInit } from '@angular/core';
import { DialogComponent } from '@shared/components/dialog.component';
import { select, Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
@ -87,7 +87,6 @@ export class DeviceCheckConnectivityDialogComponent extends
private telemetryWsService: TelemetryWebsocketService,
private wl: WhiteLabelingService,
private zone: NgZone,
private destroyRef: DestroyRef,
private aiDashboardGenerationService: AiDashboardGenerationService) {
super(store, router, dialogRef);
@ -215,17 +214,16 @@ export class DeviceCheckConnectivityDialogComponent extends
generateDashboard($event: Event) {
$event.stopPropagation();
if (!this.data.afterAdd) {
this.aiDashboardGenerationService.generateWithTelemetryCheck({
deviceId: this.data.deviceId.id,
destroyRef: this.destroyRef,
noTelemetry: { hideSendTelemetry: true }
});
} else if (!this.latestTelemetry.length) {
if (this.data.afterAdd && !this.latestTelemetry.length) {
this.aiDashboardGenerationService.openNoTelemetryModal({ hideSendTelemetry: true });
} else {
this.aiDashboardGenerationService.generate(this.data.deviceId.id, this.destroyRef);
return;
}
this.aiDashboardGenerationService.askInChat({
deviceId: this.data.deviceId.id,
checkTelemetry: !this.data.afterAdd,
noTelemetry: { hideSendTelemetry: true },
beforeCompose: () => this.dialogRef.close(null)
});
}
isAllowedDashboardGenerate(): boolean {

7
ui-ngx/src/app/modules/home/pages/device/device-group-config.factory.ts

@ -10,7 +10,7 @@ import {
EntityGroupStateInfo,
GroupEntityTableConfig
} from '@home/models/group/group-entities-table-config.models';
import { DestroyRef, Inject, Injectable } from '@angular/core';
import { Inject, Injectable } from '@angular/core';
import { EntityType } from '@shared/models/entity-type.models';
import { DeviceComponent } from '@home/pages/device/device.component';
import { map, mergeMap, take, tap } from 'rxjs/operators';
@ -65,7 +65,6 @@ export class DeviceGroupConfigFactory implements EntityGroupStateConfigFactory<D
private wl: WhiteLabelingService,
private iotHubActions: IotHubActionsService,
@Inject(WINDOW) private window: Window,
private destroyRef: DestroyRef,
private aiDashboardGenerationService: AiDashboardGenerationService) {
}
@ -311,9 +310,9 @@ export class DeviceGroupConfigFactory implements EntityGroupStateConfigFactory<D
generateDashboard($event: Event, device: ShortEntityView) {
$event.stopPropagation();
this.aiDashboardGenerationService.generateWithTelemetryCheck({
this.aiDashboardGenerationService.askInChat({
deviceId: device.id.id,
destroyRef: this.destroyRef,
deviceName: device.name,
noTelemetry: { checkConnectivity: () => this.checkConnectivity($event, device.id) }
});
}

4
ui-ngx/src/app/modules/home/pages/device/device.component.ts

@ -188,9 +188,9 @@ export class DeviceComponent extends GroupEntityComponent<DeviceInfo> {
generateDashboard($event: Event) {
$event.stopPropagation();
this.aiDashboardGenerationService.generateWithTelemetryCheck({
this.aiDashboardGenerationService.askInChat({
deviceId: this.entity.id.id,
destroyRef: this.destroyRef,
deviceName: this.entity.name,
noTelemetry: { checkConnectivity: () => this.onEntityAction($event, 'checkConnectivity') }
});
}

7
ui-ngx/src/app/modules/home/pages/device/devices-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 { DestroyRef, Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
import {
CellActionDescriptor,
@ -91,7 +91,6 @@ export class DevicesTableConfigResolver {
private router: Router,
private dialog: MatDialog,
private wl: WhiteLabelingService,
private destroyRef: DestroyRef,
private iotHubActions: IotHubActionsService,
private aiDashboardGenerationService: AiDashboardGenerationService) {
}
@ -453,9 +452,9 @@ export class DevicesTableConfigResolver {
generateDashboard($event: Event, device: DeviceInfo) {
$event.stopPropagation();
this.aiDashboardGenerationService.generateWithTelemetryCheck({
this.aiDashboardGenerationService.askInChat({
deviceId: device.id.id,
destroyRef: this.destroyRef,
deviceName: device.name,
noTelemetry: { checkConnectivity: () => this.checkConnectivity($event, device.id) }
});
}

11
ui-ngx/src/app/modules/tour/welcome-invitation.component.scss

@ -22,6 +22,17 @@
}
}
@media (min-width: 641px) and (max-height: 640px) {
.tb-invite-panel {
max-height: calc(100dvh - 16px) !important;
.tb-invite {
max-height: calc(100dvh - 16px);
overflow-y: auto;
}
}
}
@media (max-width: 640px) {
.tb-invite-panel {
width: 100vw;

7
ui-ngx/src/assets/locale/locale.constant-ar_AE.json

@ -11376,14 +11376,7 @@
"info": "معلومات",
"main-dashboard": "لوحة المعلومات الرئيسية",
"view-as": "عرض بصفة {{ name }}",
"estimate-wait-time": "وقت الانتظار المقدّر ~{{ time }}",
"condition": "الشرط",
"step-reading-device-data": "جارٍ قراءة بيانات الجهاز…",
"step-analyzing-telemetry-attributes": "جارٍ تحليل القياس عن بُعد والسمات…",
"step-selecting-widgets": "جارٍ اختيار الأدوات المناسبة لبياناتك…",
"step-configuring-titles-units-ranges": "جارٍ تكوين العناوين والوحدات والمديات…",
"step-designing-layout": "جارٍ تصميم التخطيط…",
"step-arranging-widgets": "جارٍ ترتيب الأدوات على لوحة المعلومات…",
"generate-dashboard": "توليد لوحة المعلومات",
"generate-dashboard-with-ai": "توليد لوحة المعلومات بالذكاء الاصطناعي",
"no-telemetry-title": "لم يتم العثور على بيانات القياس عن بُعد",

7
ui-ngx/src/assets/locale/locale.constant-ca_ES.json

@ -11376,14 +11376,7 @@
"info": "Informació",
"main-dashboard": "Tauler principal",
"view-as": "Visualitza com a {{ name }}",
"estimate-wait-time": "El temps d'espera estimat és de ~{{ time }}",
"condition": "Condició",
"step-reading-device-data": "S'estan llegint les dades del dispositiu…",
"step-analyzing-telemetry-attributes": "S'estan analitzant la telemetria i els atributs…",
"step-selecting-widgets": "S'estan seleccionant ginys per a les vostres dades…",
"step-configuring-titles-units-ranges": "S'estan configurant els títols, les unitats i els intervals…",
"step-designing-layout": "S'està dissenyant la disposició…",
"step-arranging-widgets": "S'estan col·locant els ginys al tauler…",
"generate-dashboard": "Genera el tauler",
"generate-dashboard-with-ai": "Genera el tauler amb IA",
"no-telemetry-title": "No s'han trobat dades de telemetria",

7
ui-ngx/src/assets/locale/locale.constant-cs_CZ.json

@ -11376,14 +11376,7 @@
"info": "Informace",
"main-dashboard": "Hlavní dashboard",
"view-as": "Zobrazit jako {{ name }}",
"estimate-wait-time": "Odhadovaná doba čekání je ~{{ time }}",
"condition": "Podmínka",
"step-reading-device-data": "Čtení dat zařízení…",
"step-analyzing-telemetry-attributes": "Analýza telemetrie a atributů…",
"step-selecting-widgets": "Výběr widgetů pro vaše data…",
"step-configuring-titles-units-ranges": "Konfigurace názvů, jednotek a rozsahů…",
"step-designing-layout": "Návrh rozvržení…",
"step-arranging-widgets": "Rozmísťování widgetů na dashboardu…",
"generate-dashboard": "Generovat dashboard",
"generate-dashboard-with-ai": "Generovat dashboard pomocí AI",
"no-telemetry-title": "Nebyla nalezena žádná data telemetrie",

7
ui-ngx/src/assets/locale/locale.constant-da_DK.json

@ -11376,14 +11376,7 @@
"info": "Info",
"main-dashboard": "Hoveddashboard",
"view-as": "Vis som {{ name }}",
"estimate-wait-time": "Anslået ventetid er ~{{ time }}",
"condition": "Betingelse",
"step-reading-device-data": "Læser enhedsdata…",
"step-analyzing-telemetry-attributes": "Analyserer telemetri og attributter…",
"step-selecting-widgets": "Vælger widgets til dine data…",
"step-configuring-titles-units-ranges": "Konfigurerer titler, måleenheder og områder…",
"step-designing-layout": "Designer layoutet…",
"step-arranging-widgets": "Placerer widgets på dashboardet…",
"generate-dashboard": "Generér dashboard",
"generate-dashboard-with-ai": "Generér dashboard med AI",
"no-telemetry-title": "Ingen telemetridata fundet",

7
ui-ngx/src/assets/locale/locale.constant-de_DE.json

@ -11376,14 +11376,7 @@
"info": "Info",
"main-dashboard": "Haupt-Dashboard",
"view-as": "Anzeigen als {{ name }}",
"estimate-wait-time": "Geschätzte Wartezeit ca. {{ time }}",
"condition": "Bedingung",
"step-reading-device-data": "Gerätedaten werden gelesen…",
"step-analyzing-telemetry-attributes": "Telemetrie und Attribute werden analysiert…",
"step-selecting-widgets": "Widgets für Ihre Daten werden ausgewählt…",
"step-configuring-titles-units-ranges": "Titel, Einheiten und Bereiche werden konfiguriert…",
"step-designing-layout": "Layout wird entworfen…",
"step-arranging-widgets": "Widgets werden auf dem Dashboard angeordnet…",
"generate-dashboard": "Dashboard generieren",
"generate-dashboard-with-ai": "Dashboard mit KI generieren",
"no-telemetry-title": "Keine Telemetriedaten gefunden",

7
ui-ngx/src/assets/locale/locale.constant-el_GR.json

@ -11376,14 +11376,7 @@
"info": "Πληροφορίες",
"main-dashboard": "Κύριος πίνακας ελέγχου",
"view-as": "Προβολή ως {{ name }}",
"estimate-wait-time": "Ο εκτιμώμενος χρόνος αναμονής είναι ~{{ time }}",
"condition": "Συνθήκη",
"step-reading-device-data": "Ανάγνωση δεδομένων συσκευής…",
"step-analyzing-telemetry-attributes": "Ανάλυση τηλεμετρίας και χαρακτηριστικών…",
"step-selecting-widgets": "Επιλογή widget για τα δεδομένα σας…",
"step-configuring-titles-units-ranges": "Διαμόρφωση τίτλων, μονάδων και ευρών…",
"step-designing-layout": "Σχεδιασμός της διάταξης…",
"step-arranging-widgets": "Τοποθέτηση των widget στον πίνακα ελέγχου…",
"generate-dashboard": "Δημιουργία πίνακα ελέγχου",
"generate-dashboard-with-ai": "Δημιουργία πίνακα ελέγχου με AI",
"no-telemetry-title": "Δεν βρέθηκαν δεδομένα τηλεμετρίας",

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

@ -691,6 +691,10 @@
"use-system-mobile-settings": "Use system mobile settings"
},
"ai-assistant": {
"ask": {
"device-dashboard": "Build a dashboard for {{name}}",
"device-dashboard-keys": "Build a dashboard for {{name}} showing {{keys}}"
},
"question": {
"other-chip": "Other…",
"other-color": "Other color…",
@ -815,7 +819,6 @@
"text": "'{{text}}'",
"related-from": "what {{entity}} points to",
"related-to": "what points to {{entity}}",
"alarms-of": "{{entity}}",
"alarms": "{{filter}}",
"alarms-on": "on {{entity}}",
"alarms-filter-on": "{{filter}}, on {{entity}}",
@ -857,7 +860,6 @@
"search-named": "Searched {{what}} named like '{{name}}'",
"search-typed": "Searched {{what}} of the {{types}} profile",
"search-text": "Searched {{what}} matching '{{text}}'",
"search-alarms-of": "Searched the alarms of {{entity}}",
"what": {
"devices": "devices",
"assets": "assets",
@ -1131,6 +1133,7 @@
"search-web": "Searched the web for '{{query}}'",
"fetch-page": "Read {{url}}",
"create-dashboard": "Created the dashboard '{{name}}'",
"generate-device-dashboard": "Designed a dashboard for {{entity}} from its data",
"update-dashboard": "Updated {{entity}}",
"read-dashboard": "Read the layout of {{entity}}",
"add-state": "Added the state '{{name}}' to {{entity}}",
@ -1458,6 +1461,10 @@
"run": "Creating the dashboard",
"done": "Created the dashboard"
},
"generate-device-dashboard": {
"run": "Designing the dashboard",
"done": "Created the dashboard"
},
"update-dashboard": {
"run": "Updating the dashboard",
"done": "Updated the dashboard"
@ -2393,7 +2400,7 @@
"test-first": "Test from this computer first",
"test-here": "Test from this computer",
"send-test": "Send a test value",
"send-test-tip": "Sends one value as the device, marked as a test; the wait keeps listening for the device itself",
"send-test-tip": "Marked as a test",
"test-sent": "Sent a test value at {{time}}; it is on the latest telemetry. The wait goes on for the device itself.",
"test-failed": "The test value did not go through: {{error}}.",
"needs-you": "Needs you",
@ -2694,7 +2701,7 @@
}
},
"copy": "Copy",
"edit-message": "Edit: the words back in the composer",
"edit-message": "Edit",
"show-all": "Show all",
"rename-save": "Save (Enter)",
"rename-discard": "Discard (Esc)",
@ -2853,6 +2860,7 @@
"tag": "Tag",
"entities": "Entities",
"includes": "Also saves",
"shows": "Shows",
"removeOthers": "Delete what the version lacks",
"assignee": "Assignee",
"comment": "Comment",
@ -2861,6 +2869,7 @@
"window": "Time window",
"type": "Type",
"dashboard": "Default dashboard",
"dashboard-image": "Picture",
"queue": "Queue",
"image": "Picture",
"value": "Value",
@ -3076,6 +3085,7 @@
"NOTIFICATION_PREFERENCES": "Notification preferences"
},
"kind": {
"attributes": "attributes",
"ADMIN_SETTINGS": "the admin settings",
"AGENT": "an agent",
"AGENT_APPLICATION": "an application",
@ -3236,14 +3246,13 @@
"pinned": "Pinned",
"pin": "Pin to the top",
"unpin": "Unpin",
"double-click-to-rename": "Double-click to rename",
"new-solution": "New solution",
"edit-design": "Edit the design",
"chats-menu": "Chats and this chat",
"resize-panel": "Resize the AI Assistant panel",
"resize-panel-hint": "Drag to resize; double-click to reset",
"open-full-screen": "Open full screen",
"recent-chats": "Recent chats",
"on-this-page": "On this page",
"all-chats": "All chats",
"panel-title": "Ask about this page",
"panel-line": "What is on it, what to change, or something new.",
@ -3259,7 +3268,6 @@
"open-chat": "Open the chat"
},
"started-from": "Started from",
"open-page": "Open {{name}}",
"page": {
"DEVICE_LIST": "Devices",
"DEVICE_GROUP_LIST": "Device groups",
@ -4567,7 +4575,7 @@
"run-step-by-step": "Run step by step",
"run-auto": "Run with auto-approve",
"run-tip": "Each change waits for your approval",
"run-auto-tip": "Changes are made as the plan says. Every action still shows, and Stop halts the run.",
"run-auto-tip": "Stop still works",
"run-prompt": "Run the plan.",
"leave-out": "Leave out step {{number}}: {{text}}"
},
@ -15831,12 +15839,10 @@
"get-started": "Get started",
"installed": "Solution installed",
"installed-line": "{ entities, plural, =1 {1 entity} other {# entities} } · { dashboards, plural, =1 {1 dashboard} other {# dashboards} } · live on simulated data",
"view-as-user": "View as {{name}}",
"json-note": "Edits here are applied as they are; the AI does not review them.",
"json-note": "The AI does not review these edits",
"json-invalid": "Not valid JSON: {{message}}",
"json-applied": "Applied",
"json-discarded": "Your JSON changes were discarded.",
"json-tip": "View as JSON",
"view-json": "View",
"keys": "{ count, plural, =1 {1 key} other {# keys} }",
"list": "List",
@ -15877,8 +15883,6 @@
"view-as-main": "View as user",
"install-failed": "Install failed",
"step-failed": "Step failed",
"open-name": "Opens {{name}}",
"open-list": "Opens {{name}} in ThingsBoard",
"pending-DEVICE": "{{profile}} devices",
"pending-ASSET": "{{profile}} assets",
"pending-CUSTOMER": "{{profile}} customers",
@ -15901,7 +15905,6 @@
"installed-already-note": "The installed solution stays as it is until you create it again; creating then replaces it.",
"what-should-it-do": "What should the solution do?",
"what-it-becomes": "A description becomes profiles, roles, calculated fields, alarm rules and dashboards, on simulated devices.",
"example-tip": "Puts the example in the composer",
"limits": "Nothing is created in your tenant until you approve the design and install it.",
"what-is-solution": "What is a solution?",
"about-title": "ThingsBoard Solutions",
@ -15989,14 +15992,7 @@
"info": "Info",
"main-dashboard": "Main dashboard",
"view-as": "View as {{ name }}",
"estimate-wait-time": "Estimated wait time is ~{{ time }}",
"condition": "Condition",
"step-reading-device-data": "Reading device data…",
"step-analyzing-telemetry-attributes": "Analyzing telemetry & attributes…",
"step-selecting-widgets": "Selecting widgets for your data…",
"step-configuring-titles-units-ranges": "Configuring titles, units, and ranges…",
"step-designing-layout": "Designing the layout…",
"step-arranging-widgets": "Arranging widgets on the dashboard…",
"generate-dashboard": "Generate dashboard",
"generate-dashboard-with-ai": "Generate dashboard with AI",
"no-telemetry-title": "No telemetry data found",

7
ui-ngx/src/assets/locale/locale.constant-es_ES.json

@ -11376,14 +11376,7 @@
"info": "Información",
"main-dashboard": "Tablero principal",
"view-as": "Ver como {{ name }}",
"estimate-wait-time": "El tiempo de espera estimado es de ~{{ time }}",
"condition": "Condición",
"step-reading-device-data": "Leyendo los datos del dispositivo…",
"step-analyzing-telemetry-attributes": "Analizando telemetría y atributos…",
"step-selecting-widgets": "Seleccionando widgets para tus datos…",
"step-configuring-titles-units-ranges": "Configurando títulos, unidades y rangos…",
"step-designing-layout": "Diseñando el diseño de página…",
"step-arranging-widgets": "Organizando los widgets en el tablero…",
"generate-dashboard": "Generar tablero",
"generate-dashboard-with-ai": "Generar tablero con IA",
"no-telemetry-title": "No se encontraron datos de telemetría",

7
ui-ngx/src/assets/locale/locale.constant-fr_FR.json

@ -11376,14 +11376,7 @@
"info": "Infos",
"main-dashboard": "Tableau de bord principal",
"view-as": "Afficher en tant que {{ name }}",
"estimate-wait-time": "Le temps d’attente estimé est d’environ {{ time }}",
"condition": "Condition",
"step-reading-device-data": "Lecture des données de l’appareil…",
"step-analyzing-telemetry-attributes": "Analyse de la télémétrie et des attributs…",
"step-selecting-widgets": "Sélection des widgets pour vos données…",
"step-configuring-titles-units-ranges": "Configuration des titres, unités et plages…",
"step-designing-layout": "Conception de la mise en page…",
"step-arranging-widgets": "Disposition des widgets sur le tableau de bord…",
"generate-dashboard": "Générer le tableau de bord",
"generate-dashboard-with-ai": "Générer le tableau de bord avec l’IA",
"no-telemetry-title": "Aucune donnée de télémétrie trouvée",

7
ui-ngx/src/assets/locale/locale.constant-hi_IN.json

@ -11376,14 +11376,7 @@
"info": "जानकारी",
"main-dashboard": "मुख्य डैशबोर्ड",
"view-as": "{{ name }} के रूप में देखें",
"estimate-wait-time": "अनुमानित प्रतीक्षा समय ~{{ time }} है",
"condition": "शर्त",
"step-reading-device-data": "डिवाइस डेटा पढ़ा जा रहा है…",
"step-analyzing-telemetry-attributes": "टेलीमेट्री और विशेषताओं का विश्लेषण किया जा रहा है…",
"step-selecting-widgets": "आपके डेटा के लिए विजेट चुने जा रहे हैं…",
"step-configuring-titles-units-ranges": "शीर्षक, इकाइयाँ और रेंज कॉन्फ़िगर किए जा रहे हैं…",
"step-designing-layout": "लेआउट डिज़ाइन किया जा रहा है…",
"step-arranging-widgets": "डैशबोर्ड पर विजेट व्यवस्थित किए जा रहे हैं…",
"generate-dashboard": "डैशबोर्ड जनरेट करें",
"generate-dashboard-with-ai": "AI से डैशबोर्ड जनरेट करें",
"no-telemetry-title": "कोई टेलीमेट्री डेटा नहीं मिला",

7
ui-ngx/src/assets/locale/locale.constant-it_IT.json

@ -11376,14 +11376,7 @@
"info": "Info",
"main-dashboard": "Dashboard principale",
"view-as": "Visualizza come {{ name }}",
"estimate-wait-time": "Il tempo di attesa stimato è di ~{{ time }}",
"condition": "Condizione",
"step-reading-device-data": "Lettura dei dati del dispositivo…",
"step-analyzing-telemetry-attributes": "Analisi di telemetria e attributi…",
"step-selecting-widgets": "Selezione dei widget per i tuoi dati…",
"step-configuring-titles-units-ranges": "Configurazione di titoli, unità e intervalli…",
"step-designing-layout": "Progettazione del layout…",
"step-arranging-widgets": "Disposizione dei widget nella dashboard…",
"generate-dashboard": "Genera dashboard",
"generate-dashboard-with-ai": "Genera dashboard con l'IA",
"no-telemetry-title": "Nessun dato di telemetria trovato",

7
ui-ngx/src/assets/locale/locale.constant-ja_JP.json

@ -11376,14 +11376,7 @@
"info": "情報",
"main-dashboard": "メインダッシュボード",
"view-as": "{{ name }}として表示",
"estimate-wait-time": "推定待ち時間は約{{ time }}です。",
"condition": "条件",
"step-reading-device-data": "デバイスデータを読み取っています…",
"step-analyzing-telemetry-attributes": "テレメトリと属性を分析しています…",
"step-selecting-widgets": "データに適したウィジェットを選択しています…",
"step-configuring-titles-units-ranges": "タイトル、単位、範囲を設定しています…",
"step-designing-layout": "レイアウトを設計しています…",
"step-arranging-widgets": "ダッシュボードにウィジェットを配置しています…",
"generate-dashboard": "ダッシュボードを生成",
"generate-dashboard-with-ai": "AIでダッシュボードを生成",
"no-telemetry-title": "テレメトリデータが見つかりません",

7
ui-ngx/src/assets/locale/locale.constant-ka_GE.json

@ -11376,14 +11376,7 @@
"info": "ინფორმაცია",
"main-dashboard": "მთავარი სამუშაო დაფა",
"view-as": "ნახვა როგორც {{ name }}",
"estimate-wait-time": "მოლოდინის სავარაუდო დროა ~{{ time }}",
"condition": "პირობა",
"step-reading-device-data": "მოწყობილობის მონაცემების წაკითხვა…",
"step-analyzing-telemetry-attributes": "ტელემეტრიისა და ატრიბუტების ანალიზი…",
"step-selecting-widgets": "ვიჯეტების შერჩევა თქვენი მონაცემებისთვის…",
"step-configuring-titles-units-ranges": "სათაურების, ერთეულებისა და დიაპაზონების კონფიგურირება…",
"step-designing-layout": "განლაგების დაპროექტება…",
"step-arranging-widgets": "ვიჯეტების განთავსება სამუშაო დაფაზე…",
"generate-dashboard": "სამუშაო დაფის გენერირება",
"generate-dashboard-with-ai": "სამუშაო დაფის გენერირება AI-ით",
"no-telemetry-title": "ტელემეტრიის მონაცემები ვერ მოიძებნა",

7
ui-ngx/src/assets/locale/locale.constant-ko_KR.json

@ -11450,14 +11450,7 @@
"info": "정보",
"main-dashboard": "메인 대시보드",
"view-as": "{{ name }}(으)로 보기",
"estimate-wait-time": "예상 대기 시간은 약 {{ time }}입니다",
"condition": "조건",
"step-reading-device-data": "장치 데이터 읽는 중…",
"step-analyzing-telemetry-attributes": "텔레메트리 및 속성 분석 중…",
"step-selecting-widgets": "데이터에 맞는 위젯 선택 중…",
"step-configuring-titles-units-ranges": "제목, 단위 및 범위 구성 중…",
"step-designing-layout": "레이아웃 디자인 중…",
"step-arranging-widgets": "대시보드에 위젯 배치 중…",
"generate-dashboard": "대시보드 생성",
"generate-dashboard-with-ai": "AI로 대시보드 생성",
"no-telemetry-title": "텔레메트리 데이터를 찾을 수 없습니다",

7
ui-ngx/src/assets/locale/locale.constant-lt_LT.json

@ -11376,14 +11376,7 @@
"info": "Informacija",
"main-dashboard": "Pagrindinis skydelis",
"view-as": "Peržiūrėti kaip {{ name }}",
"estimate-wait-time": "Numatomas laukimo laikas – ~{{ time }}",
"condition": "Sąlyga",
"step-reading-device-data": "Skaitomi įrenginio duomenys…",
"step-analyzing-telemetry-attributes": "Analizuojama telemetrija ir atributai…",
"step-selecting-widgets": "Parenkami valdikliai jūsų duomenims…",
"step-configuring-titles-units-ranges": "Konfigūruojami pavadinimai, matavimo vienetai ir diapazonai…",
"step-designing-layout": "Kuriamas išdėstymas…",
"step-arranging-widgets": "Valdikliai išdėstomi skydelyje…",
"generate-dashboard": "Generuoti skydelį",
"generate-dashboard-with-ai": "Generuoti skydelį naudojant DI",
"no-telemetry-title": "Telemetrijos duomenų nerasta",

7
ui-ngx/src/assets/locale/locale.constant-lv_LV.json

@ -11376,14 +11376,7 @@
"info": "Informācija",
"main-dashboard": "Galvenais infopanelis",
"view-as": "Skatīt kā {{ name }}",
"estimate-wait-time": "Aptuvenais gaidīšanas laiks ir ~{{ time }}",
"condition": "Nosacījums",
"step-reading-device-data": "Notiek iekārtas datu nolasīšana…",
"step-analyzing-telemetry-attributes": "Telemetrijas un atribūtu analīze…",
"step-selecting-widgets": "Logrīku atlase jūsu datiem…",
"step-configuring-titles-units-ranges": "Virsrakstu, vienību un diapazonu konfigurēšana…",
"step-designing-layout": "Izkārtojuma izstrāde…",
"step-arranging-widgets": "Logrīku izkārtošana infopanelī…",
"generate-dashboard": "Ģenerēt infopaneli",
"generate-dashboard-with-ai": "Ģenerēt infopaneli ar MI",
"no-telemetry-title": "Telemetrijas dati nav atrasti",

7
ui-ngx/src/assets/locale/locale.constant-nl_BE.json

@ -11382,14 +11382,7 @@
"info": "Info",
"main-dashboard": "Hoofddashboard",
"view-as": "Bekijken als {{ name }}",
"estimate-wait-time": "Geschatte wachttijd is ~{{ time }}",
"condition": "Voorwaarde",
"step-reading-device-data": "Apparaatgegevens worden gelezen…",
"step-analyzing-telemetry-attributes": "Telemetrie & attributen worden geanalyseerd…",
"step-selecting-widgets": "Widgets voor je gegevens worden geselecteerd…",
"step-configuring-titles-units-ranges": "Titels, eenheden en bereiken worden geconfigureerd…",
"step-designing-layout": "De lay-out wordt ontworpen…",
"step-arranging-widgets": "Widgets worden op het dashboard gerangschikt…",
"generate-dashboard": "Dashboard genereren",
"generate-dashboard-with-ai": "Dashboard genereren met AI",
"no-telemetry-title": "Geen telemetriegegevens gevonden",

7
ui-ngx/src/assets/locale/locale.constant-nl_NL.json

@ -11376,14 +11376,7 @@
"info": "Info",
"main-dashboard": "Hoofddashboard",
"view-as": "Bekijken als {{ name }}",
"estimate-wait-time": "Geschatte wachttijd is ~{{ time }}",
"condition": "Voorwaarde",
"step-reading-device-data": "Apparaatgegevens worden gelezen…",
"step-analyzing-telemetry-attributes": "Telemetrie & attributen worden geanalyseerd…",
"step-selecting-widgets": "Widgets voor je gegevens worden geselecteerd…",
"step-configuring-titles-units-ranges": "Titels, eenheden en bereiken worden geconfigureerd…",
"step-designing-layout": "De lay-out wordt ontworpen…",
"step-arranging-widgets": "Widgets worden op het dashboard gerangschikt…",
"generate-dashboard": "Dashboard genereren",
"generate-dashboard-with-ai": "Dashboard genereren met AI",
"no-telemetry-title": "Geen telemetriegegevens gevonden",

7
ui-ngx/src/assets/locale/locale.constant-no_NO.json

@ -11376,14 +11376,7 @@
"info": "Info",
"main-dashboard": "Hoveddashbord",
"view-as": "Vis som {{ name }}",
"estimate-wait-time": "Estimert ventetid er ~{{ time }}",
"condition": "Betingelse",
"step-reading-device-data": "Leser enhetsdata…",
"step-analyzing-telemetry-attributes": "Analyserer telemetri og attributter…",
"step-selecting-widgets": "Velger widgeter for dataene dine…",
"step-configuring-titles-units-ranges": "Konfigurerer titler, måleenheter og områder…",
"step-designing-layout": "Utformer oppsettet…",
"step-arranging-widgets": "Plasserer widgeter på dashbordet…",
"generate-dashboard": "Generer dashbord",
"generate-dashboard-with-ai": "Generer dashbord med AI",
"no-telemetry-title": "Fant ingen telemetridata",

7
ui-ngx/src/assets/locale/locale.constant-pl_PL.json

@ -11376,14 +11376,7 @@
"info": "Informacje",
"main-dashboard": "Pulpit główny",
"view-as": "Wyświetl jako {{ name }}",
"estimate-wait-time": "Szacowany czas oczekiwania: ~{{ time }}",
"condition": "Warunek",
"step-reading-device-data": "Odczytywanie danych urządzenia…",
"step-analyzing-telemetry-attributes": "Analizowanie telemetrii i atrybutów…",
"step-selecting-widgets": "Wybieranie widżetów dla Twoich danych…",
"step-configuring-titles-units-ranges": "Konfigurowanie tytułów, jednostek i zakresów…",
"step-designing-layout": "Projektowanie układu…",
"step-arranging-widgets": "Rozmieszczanie widżetów na pulpicie…",
"generate-dashboard": "Wygeneruj pulpit",
"generate-dashboard-with-ai": "Wygeneruj pulpit za pomocą AI",
"no-telemetry-title": "Nie znaleziono danych telemetrii",

7
ui-ngx/src/assets/locale/locale.constant-pt_BR.json

@ -11376,14 +11376,7 @@
"info": "Informações",
"main-dashboard": "Dashboard principal",
"view-as": "Visualizar como {{ name }}",
"estimate-wait-time": "O tempo de espera estimado é de ~{{ time }}",
"condition": "Condição",
"step-reading-device-data": "Lendo dados do dispositivo…",
"step-analyzing-telemetry-attributes": "Analisando telemetria e atributos…",
"step-selecting-widgets": "Selecionando widgets para seus dados…",
"step-configuring-titles-units-ranges": "Configurando títulos, unidades e intervalos…",
"step-designing-layout": "Projetando o layout…",
"step-arranging-widgets": "Organizando widgets no dashboard…",
"generate-dashboard": "Gerar dashboard",
"generate-dashboard-with-ai": "Gerar dashboard com IA",
"no-telemetry-title": "Nenhum dado de telemetria encontrado",

7
ui-ngx/src/assets/locale/locale.constant-ro_RO.json

@ -11376,14 +11376,7 @@
"info": "Informații",
"main-dashboard": "Tablou de bord principal",
"view-as": "Vizualizează ca {{ name }}",
"estimate-wait-time": "Timpul de așteptare estimat este de ~{{ time }}",
"condition": "Condiție",
"step-reading-device-data": "Se citesc datele dispozitivului…",
"step-analyzing-telemetry-attributes": "Se analizează telemetria și atributele…",
"step-selecting-widgets": "Se selectează widgeturile pentru datele dumneavoastră…",
"step-configuring-titles-units-ranges": "Se configurează titlurile, unitățile și intervalele…",
"step-designing-layout": "Se proiectează aspectul…",
"step-arranging-widgets": "Se aranjează widgeturile pe tabloul de bord…",
"generate-dashboard": "Generează tabloul de bord",
"generate-dashboard-with-ai": "Generează tabloul de bord cu IA",
"no-telemetry-title": "Nu s-au găsit date de telemetrie",

7
ui-ngx/src/assets/locale/locale.constant-sl_SI.json

@ -11450,14 +11450,7 @@
"info": "Informacije",
"main-dashboard": "Glavna nadzorna plošča",
"view-as": "Prikaži kot {{ name }}",
"estimate-wait-time": "Predviden čas čakanja je ~{{ time }}",
"condition": "Pogoj",
"step-reading-device-data": "Branje podatkov naprave…",
"step-analyzing-telemetry-attributes": "Analiziranje telemetrije in atributov…",
"step-selecting-widgets": "Izbiranje gradnikov za vaše podatke…",
"step-configuring-titles-units-ranges": "Nastavljanje naslovov, enot in obsegov…",
"step-designing-layout": "Oblikovanje postavitve…",
"step-arranging-widgets": "Razporejanje gradnikov na nadzorni plošči…",
"generate-dashboard": "Ustvari nadzorno ploščo",
"generate-dashboard-with-ai": "Ustvari nadzorno ploščo z umetno inteligenco",
"no-telemetry-title": "Ni najdenih podatkov telemetrije",

7
ui-ngx/src/assets/locale/locale.constant-tr_TR.json

@ -11376,14 +11376,7 @@
"info": "Bilgi",
"main-dashboard": "Ana pano",
"view-as": "{{ name }} olarak görüntüle",
"estimate-wait-time": "Tahmini bekleme süresi: ~{{ time }}",
"condition": "Koşul",
"step-reading-device-data": "Cihaz verileri okunuyor…",
"step-analyzing-telemetry-attributes": "Telemetri ve öznitelikler analiz ediliyor…",
"step-selecting-widgets": "Verileriniz için widget'lar seçiliyor…",
"step-configuring-titles-units-ranges": "Başlıklar, birimler ve aralıklar yapılandırılıyor…",
"step-designing-layout": "Düzen tasarlanıyor…",
"step-arranging-widgets": "Widget'lar panoya yerleştiriliyor…",
"generate-dashboard": "Pano oluştur",
"generate-dashboard-with-ai": "Yapay zeka ile pano oluştur",
"no-telemetry-title": "Telemetri verisi bulunamadı",

7
ui-ngx/src/assets/locale/locale.constant-uk_UA.json

@ -11376,14 +11376,7 @@
"info": "Інформація",
"main-dashboard": "Головний дашборд",
"view-as": "Переглянути як {{ name }}",
"estimate-wait-time": "Орієнтовний час очікування: ~{{ time }}",
"condition": "Умова",
"step-reading-device-data": "Читання даних пристрою…",
"step-analyzing-telemetry-attributes": "Аналіз телеметрії та атрибутів…",
"step-selecting-widgets": "Підбір віджетів для ваших даних…",
"step-configuring-titles-units-ranges": "Налаштування заголовків, одиниць виміру та діапазонів…",
"step-designing-layout": "Проєктування макету…",
"step-arranging-widgets": "Розміщення віджетів на дашборді…",
"generate-dashboard": "Згенерувати дашборд",
"generate-dashboard-with-ai": "Згенерувати дашборд за допомогою ШІ",
"no-telemetry-title": "Дані телеметрії не знайдено",

7
ui-ngx/src/assets/locale/locale.constant-zh_CN.json

@ -11376,14 +11376,7 @@
"info": "信息",
"main-dashboard": "主仪表板",
"view-as": "以 {{ name }} 身份查看",
"estimate-wait-time": "预计等待时间约为 {{ time }}",
"condition": "条件",
"step-reading-device-data": "正在读取设备数据…",
"step-analyzing-telemetry-attributes": "正在分析遥测和属性…",
"step-selecting-widgets": "正在为您的数据选择部件…",
"step-configuring-titles-units-ranges": "正在配置标题、单位和范围…",
"step-designing-layout": "正在设计布局…",
"step-arranging-widgets": "正在仪表板上排列部件…",
"generate-dashboard": "生成仪表板",
"generate-dashboard-with-ai": "使用 AI 生成仪表板",
"no-telemetry-title": "未找到遥测数据",

7
ui-ngx/src/assets/locale/locale.constant-zh_TW.json

@ -13309,14 +13309,7 @@
"info": "資訊",
"main-dashboard": "主要儀表板",
"view-as": "以「{{ name }}」的身分檢視",
"estimate-wait-time": "預計等待時間約為 {{ time }}",
"condition": "條件",
"step-reading-device-data": "正在讀取裝置資料…",
"step-analyzing-telemetry-attributes": "正在分析遙測與屬性…",
"step-selecting-widgets": "正在為您的資料選擇小工具…",
"step-configuring-titles-units-ranges": "正在設定標題、單位與範圍…",
"step-designing-layout": "正在設計版面配置…",
"step-arranging-widgets": "正在配置儀表板上的小工具…",
"generate-dashboard": "產生儀表板",
"generate-dashboard-with-ai": "使用 AI 產生儀表板",
"no-telemetry-title": "找不到遙測資料",

BIN
ui-ngx/src/assets/solution-creator/building-animated.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 KiB

BIN
ui-ngx/src/assets/solution-creator/catch-animated.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 KiB

BIN
ui-ngx/src/assets/solution-creator/dashboard-animated.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

BIN
ui-ngx/src/assets/solution-creator/forest-animated.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

BIN
ui-ngx/src/assets/solution-creator/parachute-animated.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

BIN
ui-ngx/src/assets/solution-creator/rocket-animated.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

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

@ -475,8 +475,32 @@
}
}
.mat-mdc-tooltip.tb-ai-cursor-tooltip {
translate: -12px 30px;
@keyframes tb-ai-tip-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes tb-ai-tip-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.mat-mdc-tooltip.tb-ai-tip {
&.mat-mdc-tooltip-show {
animation: tb-ai-tip-in 100ms ease-out forwards;
}
&.mat-mdc-tooltip-hide {
animation: tb-ai-tip-out 60ms ease-in forwards;
}
}
@mixin tb-ai-kbd {
@ -2199,6 +2223,48 @@ 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 {
display: none;
}
}
@container k-chat (max-width: 340px) {
.tb-ai-composer .cred:has(.cred-topup) .cred-line {
display: none;
}
}
.tb-ai-composer.docked .composer-auto {
gap: 0;
.label {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
}
}
@container k-chat (max-width: 560px) {
tb-ai-action-detail.k-detail table.k-hist {
:is(th, td) {
padding-right: 8px;
}
:is(th, td):last-child {
padding-right: 0;
}
td.c,
.tb-spark {
width: 56px;
}
}
}
@container k-chat (max-width: 560px) {
.k-fields {
grid-template-columns: minmax(0, 1fr);
@ -2565,6 +2631,9 @@ code.k-ent[data-pal="solution"] .k-ent-ic { color: var(--entity-solution-fg); }
}
.k-optbody {
min-width: 0;
overflow-wrap: anywhere;
b {
display: block;
font-size: 15px;
@ -4160,6 +4229,26 @@ cursor: pointer;
font-weight: 400;
vertical-align: 1px;
}
.composer-ghost-end {
white-space: nowrap;
}
&.tight {
display: flex;
align-items: center;
white-space: nowrap;
> span {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
> kbd {
flex: none;
}
}
}
.tb-ai-sr-only {
@ -4536,10 +4625,10 @@ cursor: pointer;
gap: 8px;
.ob-chip {
height: calc(var(--chat-control) + 2px);
height: var(--chat-control);
padding: 0 14px;
font-size: var(--chat-line);
line-height: var(--chat-control);
line-height: calc(var(--chat-control) - 2px);
&[aria-pressed="true"] {
border-color: var(--ai-selected);
@ -5168,6 +5257,7 @@ tb-ai-action-detail.k-detail {
font-family: var(--tb-font);
.k-detail-recs,
.k-detail-facts.capped,
.k-tels,
.k-made,
.k-detail-links {
@ -5380,6 +5470,7 @@ tb-ai-action-detail.k-detail {
}
.k-hist {
max-width: 100%;
margin-top: 10px;
border-collapse: collapse;
font-size: var(--chat-line);
@ -5455,7 +5546,7 @@ tb-ai-action-detail.k-detail {
}
td.q {
white-space: nowrap;
min-width: 9ch;
font-variant-numeric: tabular-nums;
color: var(--tb-text-secondary);
}

Loading…
Cancel
Save