Browse Source

AI chat Details as Uplink draws them: a read of several devices shows each device's values under its name instead of raw JSON keyed by id; latest values as key and value rows; history as a table with Last and Range (changes counted for non-numeric keys); records leave out a profile most rows share; an alarm search reads Searched alarms with its filter, entity and window in Asked for and No alarms; code parts always fold with their line count and the widget read names the widget; a change's Details drops the record's own name, FQN and type, shows changed fields in the change form with 72x54 thumbnails and no inner scroll; approval image changes sit side by side at 72x54; an approved call's line shows Took live and from history; the hand-over's terminal test is offered folded under Nothing heard

pull/16859/head
Igor Kulikov 3 days ago
parent
commit
b96a3f6b3a
  1. 93
      ui-ngx/src/app/modules/home/components/ai/ai-action-detail.component.html
  2. 30
      ui-ngx/src/app/modules/home/components/ai/ai-action-detail.component.ts
  3. 140
      ui-ngx/src/app/modules/home/components/ai/ai-action-detail.models.ts
  4. 2
      ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.html
  5. 10
      ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts
  6. 1
      ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html
  7. 2
      ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts
  8. 1
      ui-ngx/src/app/modules/home/components/ai/ai-chat.component.html
  9. 3
      ui-ngx/src/app/modules/home/components/ai/ai-chat.component.ts
  10. 3
      ui-ngx/src/app/modules/home/components/ai/ai-code-block.ts
  11. 10
      ui-ngx/src/app/modules/home/components/ai/ai-hand-over.component.html
  12. 1
      ui-ngx/src/app/shared/models/ai-chat.models.ts
  13. 35
      ui-ngx/src/assets/locale/locale.constant-en_US.json
  14. 207
      ui-ngx/src/theme/ai-theme.scss

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

@ -52,25 +52,49 @@
} }
} }
@case ('values') { @case ('values') {
@if (block.label) { @if (block.entity) {
<p class="k-group-h">{{ entityName(block.entity) }}</p>
} @else if (block.label) {
<div class="k-detail-label">{{ say(block.label) }}</div> <div class="k-detail-label">{{ say(block.label) }}</div>
} }
<div class="k-tels"> <dl class="k-vals">
@for (row of block.rows; track $index) { @for (row of block.rows; track $index) {
<span class="k-tel" [matTooltip]="row.time ? time(row.time) : ''" [matTooltipDisabled]="!row.time" matTooltipPosition="above"><code class="k-tel-key">{{ row.key }}</code><span class="k-tel-val">{{ row.value }}</span></span> <dt><span class="k-key">{{ row.key }}</span></dt>
<dd [matTooltip]="row.time ? time(row.time) : ''" [matTooltipDisabled]="!row.time" matTooltipPosition="above">{{ row.value }}</dd>
} }
</div> </dl>
} }
@case ('series') { @case ('series') {
<div class="k-series"> @if (block.entity) {
@for (row of block.rows; track row.key) { <p class="k-group-h">{{ entityName(block.entity) }}</p>
<div class="k-series-row"> }
<code class="k-tel-key">{{ row.key }}</code> <table class="k-hist">
<svg class="k-series-spark" viewBox="0 0 96 20" preserveAspectRatio="none" aria-hidden="true"><path [attr.d]="row.path"></path></svg> <thead>
<span class="k-series-meta">{{ 'ai-assistant.detail.series' | translate:{points: row.points, min: number(row.min), max: number(row.max), last: number(row.last)} }}</span> <tr>
</div> <th scope="col"><span class="tb-ai-sr-only">{{ 'ai-assistant.detail.history-key' | translate }}</span></th>
} <th scope="col"><span class="tb-ai-sr-only">{{ 'ai-assistant.detail.history-curve' | translate }}</span></th>
</div> <th scope="col" class="n">{{ 'ai-assistant.detail.history-last' | translate }}</th>
<th scope="col">{{ 'ai-assistant.detail.history-range' | translate }}</th>
</tr>
</thead>
<tbody>
@for (row of block.rows; track row.key) {
<tr>
<th scope="row"><span class="k-key">{{ row.key }}</span></th>
<td class="c">
<div class="tb-spark" role="img" [attr.aria-label]="row.key">
<svg class="tb-spark-svg" viewBox="0 0 300 60" preserveAspectRatio="none" aria-hidden="true"><path [attr.d]="row.path"></path></svg>
<span class="tb-spark-dot" [style.top]="'calc(' + row.dot + '% - 3px)'"></span>
</div>
</td>
<td class="n">{{ row.lastText ?? number(row.last) }}</td>
<td class="q">{{ row.changes !== undefined
? ('ai-assistant.detail.history-changes' | translate: {count: row.changes})
: ('ai-assistant.detail.history-span' | translate: {min: number(row.min), max: number(row.max)}) }}</td>
</tr>
}
</tbody>
</table>
} }
@case ('keys') { @case ('keys') {
@if (block.label) { @if (block.label) {
@ -83,8 +107,43 @@
</div> </div>
} }
@case ('facts') { @case ('facts') {
@if (changeRows(block.rows); as changes) {
@if (changes.length) {
<div class="k-diff">
@for (change of changes; track $index) {
<div class="k-diff-f" [class.long]="change.long">
<div class="k-diff-l">{{ label(change) }}</div>
@if (change.images; as pair) {
<div class="k-diff-v k-img">
@if (pair.current) {
<img tbAiFadeIn [src]="pair.current | image: {preview: true, ignoreLoadingImage: true} | async" alt="">
} @else {
<span class="k-img-none"></span>
}
<mat-icon class="tb-mat-18" aria-hidden="true">arrow_forward</mat-icon>
<span class="tb-ai-sr-only">{{ 'ai-assistant.review.changes-to' | translate }}</span>
@if (pair.value) {
<img tbAiFadeIn [src]="pair.value | image: {preview: true, ignoreLoadingImage: true} | async" alt="">
} @else {
<span class="k-img-none"></span>
}
</div>
} @else {
<div class="k-diff-v" [class.mono]="change.mono">
<span class="k-diff-was">{{ change.was }}</span>
<span class="k-diff-to" aria-hidden="true">→</span>
<span class="tb-ai-sr-only">{{ 'ai-assistant.review.changes-to' | translate }}</span>
<span class="k-diff-now">{{ factValue(change) }}</span>
</div>
}
</div>
}
</div>
}
}
@if (plainRows(block.rows).length) {
<dl class="k-fields k-detail-facts"> <dl class="k-fields k-detail-facts">
@for (fact of block.rows; track $index) { @for (fact of plainRows(block.rows); track $index) {
<dt>{{ label(fact) }}</dt> <dt>{{ label(fact) }}</dt>
<dd [class.mono]="fact.mono"> <dd [class.mono]="fact.mono">
@if (fact.images; as pair) { @if (fact.images; as pair) {
@ -121,6 +180,7 @@
</dd> </dd>
} }
</dl> </dl>
}
} }
@case ('list') { @case ('list') {
@if (block.label) { @if (block.label) {
@ -139,7 +199,7 @@
@if (block.title) { @if (block.title) {
<div class="k-detail-label">{{ ('ai-assistant.action.' + block.title) | translate }}</div> <div class="k-detail-label">{{ ('ai-assistant.action.' + block.title) | translate }}</div>
} }
<pre><code [class]="'language-' + (block.lang || block.label.toLowerCase())" [attr.data-label]="block.lang ? codeLabel(block.label) : null">{{ block.text }}</code></pre> <pre><code [class]="'language-' + (block.lang || block.label.toLowerCase())" [attr.data-label]="block.lang ? codeLabel(block.label) : null" data-fold>{{ block.text }}</code></pre>
} }
@case ('links') { @case ('links') {
<div class="k-detail-links"> <div class="k-detail-links">
@ -174,6 +234,9 @@
@case ('warning') { @case ('warning') {
<div class="k-warn-block" role="note"><span class="tb-ai-sr-only">{{ 'ai-assistant.detail.heads-up' | translate }}</span>@if (block.label) {<b>{{ say(block.label) }}</b> }@for (row of block.rows; track $index) {<span>{{ rowText(row) }}</span>@if (!$last) {<span>; </span>}}</div> <div class="k-warn-block" role="note"><span class="tb-ai-sr-only">{{ 'ai-assistant.detail.heads-up' | translate }}</span>@if (block.label) {<b>{{ say(block.label) }}</b> }@for (row of block.rows; track $index) {<span>{{ rowText(row) }}</span>@if (!$last) {<span>; </span>}}</div>
} }
@case ('found') {
<p class="k-found">{{ say(block.text) }}</p>
}
@case ('note') { @case ('note') {
<p class="k-detail-note">{{ say(block.text) }}</p> <p class="k-detail-note">{{ say(block.text) }}</p>
} }

30
ui-ngx/src/app/modules/home/components/ai/ai-action-detail.component.ts

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
import { aiTrueMinus } from '@home/components/ai/ai-text';
import { afterRenderEffect, ChangeDetectionStrategy, Component, computed, DestroyRef, effect, ElementRef, inject, input, signal, untracked } from '@angular/core'; import { afterRenderEffect, ChangeDetectionStrategy, Component, computed, DestroyRef, effect, ElementRef, inject, input, signal, untracked } from '@angular/core';
import { ClipboardService } from 'ngx-clipboard'; import { ClipboardService } from 'ngx-clipboard';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@ -196,8 +197,11 @@ export class AiActionDetailComponent {
return new Date(ts).toLocaleString([], {dateStyle: 'short', timeStyle: 'short'}); return new Date(ts).toLocaleString([], {dateStyle: 'short', timeStyle: 'short'});
} }
number(value: number): string { number(value?: number): string {
return Number.isInteger(value) ? String(value) : String(Math.round(value * 100) / 100); if (value === undefined) {
return '';
}
return aiTrueMinus(Number.isInteger(value) ? String(value) : String(Math.round(value * 100) / 100));
} }
private rememberedTab(): string | null { private rememberedTab(): string | null {
@ -208,10 +212,22 @@ export class AiActionDetailComponent {
writeStored(PROTOCOL_KEY, label); writeStored(PROTOCOL_KEY, label);
} }
changeRows(rows: AiDetailFact[]): AiDetailFact[] {
return rows.filter(row => row.change);
}
plainRows(rows: AiDetailFact[]): AiDetailFact[] {
return rows.filter(row => !row.change);
}
entityName(entity: AiDetailEntity): string {
return this.nameOf(entity) ?? this.translate.instant('ai-assistant.detail.this', {what: this.typeWord(entity.entityType)});
}
private entityText(entity: AiDetailEntity): string { private entityText(entity: AiDetailEntity): string {
const name = this.nameOf(entity); const name = this.nameOf(entity);
if (name) { if (name) {
return `'${name}'`; return name;
} }
return this.translate.instant('ai-assistant.detail.this', {what: this.typeWord(entity.entityType)}); return this.translate.instant('ai-assistant.detail.this', {what: this.typeWord(entity.entityType)});
} }
@ -236,7 +252,13 @@ export class AiActionDetailComponent {
} }
}; };
Object.values(view.hood?.params ?? {}).forEach(value => typeof value === 'object' && !isAiWordList(value) && want(value)); Object.values(view.hood?.params ?? {}).forEach(value => typeof value === 'object' && !isAiWordList(value) && want(value));
view.blocks.forEach(block => block.type === 'facts' && block.rows.forEach(fact => want(fact.entity))); view.blocks.forEach(block => {
if (block.type === 'facts') {
block.rows.forEach(fact => want(fact.entity));
} else if (block.type === 'values' || block.type === 'series') {
want(block.entity);
}
});
if (!wanted.size) { if (!wanted.size) {
return; return;
} }

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

@ -50,12 +50,15 @@ export interface AiDetailValue {
export interface AiDetailSeries { export interface AiDetailSeries {
key: string; key: string;
points: number; points: number;
min: number; min?: number;
max: number; max?: number;
last: number; last?: number;
lastText?: string;
changes?: number;
from: number; from: number;
to: number; to: number;
path: string; path: string;
dot: number;
} }
export interface AiDetailFact { export interface AiDetailFact {
@ -68,6 +71,9 @@ export interface AiDetailFact {
secret?: boolean; secret?: boolean;
images?: {current?: string; value?: string}; images?: {current?: string; value?: string};
chip?: {icon?: string; image?: string}; chip?: {icon?: string; image?: string};
change?: boolean;
was?: string;
long?: boolean;
} }
export interface AiDetailCommand { export interface AiDetailCommand {
@ -85,8 +91,8 @@ export interface AiDetailLink {
export type AiDetailBlock = export type AiDetailBlock =
| {type: 'records'; label?: AiDetailText; rows: AiDetailRecord[]; total?: number} | {type: 'records'; label?: AiDetailText; rows: AiDetailRecord[]; total?: number}
| {type: 'hub'; rows: AiDetailHubItem[]} | {type: 'hub'; rows: AiDetailHubItem[]}
| {type: 'values'; label?: AiDetailText; rows: AiDetailValue[]} | {type: 'values'; label?: AiDetailText; entity?: AiDetailEntity; rows: AiDetailValue[]}
| {type: 'series'; rows: AiDetailSeries[]} | {type: 'series'; entity?: AiDetailEntity; rows: AiDetailSeries[]}
| {type: 'keys'; label?: AiDetailText; keys: string[]} | {type: 'keys'; label?: AiDetailText; keys: string[]}
| {type: 'facts'; rows: AiDetailFact[]} | {type: 'facts'; rows: AiDetailFact[]}
| {type: 'list'; label?: AiDetailText; rows: Array<string | AiDetailText>} | {type: 'list'; label?: AiDetailText; rows: Array<string | AiDetailText>}
@ -95,6 +101,7 @@ export type AiDetailBlock =
| {type: 'markdown'; text: string} | {type: 'markdown'; text: string}
| {type: 'code'; label: string; text: string; lang?: string; title?: string} | {type: 'code'; label: string; text: string; lang?: string; title?: string}
| {type: 'note'; text: AiDetailText} | {type: 'note'; text: AiDetailText}
| {type: 'found'; text: AiDetailText}
| {type: 'text'; text: string} | {type: 'text'; text: string}
| {type: 'json'; label: string; text: string} | {type: 'json'; label: string; text: string}
| {type: 'images'; rows: AiDetailImage[]} | {type: 'images'; rows: AiDetailImage[]}
@ -121,8 +128,10 @@ export interface AiStepView {
const ASKED_FOR: Record<string, string> = { const ASKED_FOR: Record<string, string> = {
'search-named': 'named', 'search-typed': 'typed', 'search-text': 'text', 'search-related-from': 'related-from', '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', 'search-alarms-of': 'alarms-of', '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', 'read-history': 'history', 'read-history-keys': 'history-keys', 'read-latest-keys': 'latest-keys', 'iot-hub-query': 'query',
'search-web': 'query' 'search-web': 'query', 'read-widget-parts': 'widget'
}; };
export function aiStepView(action: AiAction, names: AiDetailNames): AiStepView { export function aiStepView(action: AiAction, names: AiDetailNames): AiStepView {
@ -144,6 +153,8 @@ export function aiStepView(action: AiAction, names: AiDetailNames): AiStepView {
const K = 'ai-assistant.detail.'; const K = 'ai-assistant.detail.';
const ALARM_FILTER_WORDS = new Set(['ACTIVE', 'CLEARED', 'ACK', 'UNACK', 'CRITICAL', 'MAJOR', 'MINOR', 'WARNING', 'INDETERMINATE']);
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
const OK_ID = /^OK:\s*([0-9a-z_-]+)/i; const OK_ID = /^OK:\s*([0-9a-z_-]+)/i;
@ -414,38 +425,64 @@ function timeOf(ts: unknown): number | undefined {
return typeof value === 'number' && Number.isFinite(value) && value > 1e11 ? value : undefined; return typeof value === 'number' && Number.isFinite(value) && value > 1e11 ? value : undefined;
} }
function sparkPath(values: number[], times: number[]): {path: string; dot: number} {
const width = 300;
const height = 60;
const pad = 6;
const from = times[0];
const span = times[times.length - 1] - from || 1;
const min = Math.min(...values);
const range = Math.max(...values) - min || 1;
const y = (value: number) => height - pad - (value - min) / range * (height - 2 * pad);
const path = values.map((value, index) =>
`${index ? 'L' : 'M'}${((times[index] - from) / span * width).toFixed(1)} ${y(value).toFixed(1)}`).join('');
return {path, dot: Math.round(y(values[values.length - 1]) / height * 100)};
}
function series(key: string, points: Array<[number, number]>): AiDetailSeries { function series(key: string, points: Array<[number, number]>): AiDetailSeries {
const sorted = [...points].sort((a, b) => a[0] - b[0]); const sorted = [...points].sort((a, b) => a[0] - b[0]);
const values = sorted.map(point => point[1]); const values = sorted.map(point => point[1]);
const min = Math.min(...values); const times = sorted.map(point => point[0]);
const max = Math.max(...values); return {key, points: sorted.length, min: Math.min(...values), max: Math.max(...values), last: values[values.length - 1],
const from = sorted[0][0]; from: times[0], to: times[times.length - 1], ...sparkPath(values, times)};
const to = sorted[sorted.length - 1][0]; }
const width = 96;
const height = 20; function changesSeries(key: string, points: Array<[number, unknown]>): AiDetailSeries {
const span = to - from || 1; const sorted = [...points].sort((a, b) => a[0] - b[0]);
const range = max - min || 1; const words = sorted.map(point => aiValueText(point[1]));
const path = sorted.map(([ts, value], index) => const levels = [...new Set(words)];
`${index ? 'L' : 'M'}${((ts - from) / span * width).toFixed(1)} ${(height - 1 - (value - min) / range * (height - 2)).toFixed(1)}`).join(''); const changes = words.filter((word, index) => index && word !== words[index - 1]).length;
return {key, points: sorted.length, min, max, last: sorted[sorted.length - 1][1], from, to, path}; const times = sorted.map(point => point[0]);
} return {key, points: sorted.length, lastText: words[words.length - 1], changes, from: times[0], to: times[times.length - 1],
...sparkPath(words.map(word => levels.indexOf(word)), times)};
function telemetry(result: Values): AiDetailBlock[] { }
function telemetry(result: Values, entityOf?: (id: string) => AiDetailEntity): AiDetailBlock[] {
const ids = Object.keys(result);
if (entityOf && ids.length && ids.every(id => UUID.test(id) && isObject(result[id]))) {
return ids.flatMap(id => telemetry(result[id] as Values).map(block =>
block.type === 'values' || block.type === 'series' ? {...block, entity: entityOf(id)} : block));
}
const latest: AiDetailValue[] = []; const latest: AiDetailValue[] = [];
const history: AiDetailSeries[] = []; const history: AiDetailSeries[] = [];
const other: AiDetailValue[] = []; const other: AiDetailValue[] = [];
const add = (key: string, points: Array<[number, unknown]>) => {
const numbers = points.map(([ts, value]) => [ts, typeof value === 'boolean' ? NaN : Number(value)] as [number, number]);
if (points.length > 1 && numbers.every(([, value]) => Number.isFinite(value))) {
history.push(series(key, numbers));
} else if (points.length > 1) {
history.push(changesSeries(key, points));
} else if (points.length) {
latest.push({key, value: aiValueText(points[0][1]), time: points[0][0]});
}
};
for (const [key, data] of Object.entries(result)) { for (const [key, data] of Object.entries(result)) {
if (isObject(data) && 'value' in data) { if (isObject(data) && 'value' in data) {
latest.push({key, value: aiValueText(data.value), time: timeOf(data.ts)}); latest.push({key, value: aiValueText(data.value), time: timeOf(data.ts)});
continue; continue;
} }
if (Array.isArray(data) && data.every(point => isObject(point) && 'ts' in point)) { if (Array.isArray(data) && data.every(point => isObject(point) && 'ts' in point)) {
const numbers = data.map(point => [timeOf(point.ts), Number(point.value)] as [number, number]).filter(([ts, value]) => ts && Number.isFinite(value)); add(key, data.map(point => [timeOf(point.ts), point.value] as [number, unknown]).filter(([ts]) => !!ts));
if (numbers.length > 1) {
history.push(series(key, numbers));
} else if (data.length) {
latest.push({key, value: aiValueText(data[0].value), time: timeOf(data[0].ts)});
}
continue; continue;
} }
if (!isObject(data)) { if (!isObject(data)) {
@ -453,12 +490,8 @@ function telemetry(result: Values): AiDetailBlock[] {
continue; continue;
} }
const entries = Object.entries(data).filter(([ts]) => timeOf(ts)); const entries = Object.entries(data).filter(([ts]) => timeOf(ts));
const numbers = entries.map(([ts, value]) => [timeOf(ts), Number(value)] as [number, number]).filter(([, value]) => Number.isFinite(value)); if (entries.length) {
if (entries.length > 1 && numbers.length === entries.length) { add(key, entries.map(([ts, value]) => [timeOf(ts), value] as [number, unknown]));
history.push(series(key, numbers));
} else if (entries.length) {
const [ts, value] = entries.sort((a, b) => Number(b[0]) - Number(a[0]))[0];
latest.push({key, value: aiValueText(value), time: timeOf(ts)});
} else { } else {
other.push({key, value: aiValueText(data)}); other.push({key, value: aiValueText(data)});
} }
@ -513,6 +546,16 @@ function recordOf(row: Values, entityType: string): AiDetailRecord | null {
return {entityType: entityType === 'ALARM_RULE' ? 'ALARM_RULE' : entityType, id: idOf(row.id), name, meta: meta || undefined}; return {entityType: entityType === 'ALARM_RULE' ? 'ALARM_RULE' : entityType, id: idOf(row.id), name, meta: meta || undefined};
} }
function withoutCommonMeta(rows: AiDetailRecord[]): AiDetailRecord[] {
if (rows.length < 2) {
return rows;
}
const counts = new Map<string, number>();
rows.forEach(row => row.meta && counts.set(row.meta, (counts.get(row.meta) ?? 0) + 1));
const common = [...counts].find(([, count]) => count > rows.length / 2)?.[0];
return common ? rows.map(row => row.meta === common ? {...row, meta: undefined} : row) : rows;
}
function searchEntities(values: Values, result: unknown, names: AiDetailNames): AiDetailView { function searchEntities(values: Values, result: unknown, names: AiDetailNames): AiDetailView {
const filter = isObject(values.entityFilter) ? values.entityFilter : {}; const filter = isObject(values.entityFilter) ? values.entityFilter : {};
const type = searchType(values); const type = searchType(values);
@ -534,9 +577,18 @@ function searchEntities(values: Values, result: unknown, names: AiDetailNames):
} else if (str(values.pageLink?.textSearch)) { } else if (str(values.pageLink?.textSearch)) {
key = 'search-text'; key = 'search-text';
params.text = values.pageLink.textSearch; params.text = values.pageLink.textSearch;
} else if (values.filterType === 'alarm' && Array.isArray(filter.originatorIds) && filter.originatorIds.length === 1) { } else if (values.filterType === 'alarm') {
key = 'search-alarms-of'; const words = [...(Array.isArray(filter.severityList) ? filter.severityList : []), ...(Array.isArray(filter.statusList) ? filter.statusList : [])]
params.entity = entity(filter.originatorIds[0], filter.originatorType, names); .map(word => str(word)?.toUpperCase()).filter(word => !!word && ALARM_FILTER_WORDS.has(word)).map(word => K + 'alarm-filter.' + word);
const one = Array.isArray(filter.originatorIds) && filter.originatorIds.length === 1;
const window = timeOf(filter.startTs) ? `${dateText(timeOf(filter.startTs))} – ${endText(filter.endTs)}` : undefined;
const parts = [words.length ? 'filter' : '', one ? 'on' : '', window ? 'window' : ''].filter(Boolean);
if (parts.length) {
key = parts.length === 1 && parts[0] === 'filter' ? 'search-alarms' : 'search-alarms-' + parts.join('-');
params.filter = {words, commas: true};
params.entity = one ? entity(filter.originatorIds[0], filter.originatorType, names) : '';
params.window = window ?? '';
}
} }
const sections = searchSections(result); const sections = searchSections(result);
if (!sections.length) { if (!sections.length) {
@ -548,13 +600,13 @@ function searchEntities(values: Values, result: unknown, names: AiDetailNames):
const data: unknown[] = Array.isArray(section.page.data) ? section.page.data : []; const data: unknown[] = Array.isArray(section.page.data) ? section.page.data : [];
if (!data.length) { if (!data.length) {
if (sections.length === 1) { if (sections.length === 1) {
blocks.push({type: 'note', text: text('nothing-found')}); blocks.push({type: 'found', text: text(entityType === 'ALARM' ? 'no-alarms' : 'nothing-found')});
} }
continue; continue;
} }
const groupType = entityType === 'ENTITY_GROUP' ? str(filter.groupType)?.toUpperCase() : undefined; const groupType = entityType === 'ENTITY_GROUP' ? str(filter.groupType)?.toUpperCase() : undefined;
const rows = data.filter(isObject).map(row => recordOf(row, entityType)).filter(Boolean).slice(0, MAX_ROWS) const rows = withoutCommonMeta(data.filter(isObject).map(row => recordOf(row, entityType)).filter(Boolean).slice(0, MAX_ROWS)
.map(row => groupType ? {...row, groupType} : row); .map(row => groupType ? {...row, groupType} : row));
const total = typeof section.page.totalElements === 'number' ? section.page.totalElements : data.length; const total = typeof section.page.totalElements === 'number' ? section.page.totalElements : data.length;
blocks.push(rows.length blocks.push(rows.length
? {type: 'records', label: sections.length > 1 ? text('what-found.' + (SEARCHED[entityType] ?? 'entities')) : undefined, rows, total} ? {type: 'records', label: sections.length > 1 ? text('what-found.' + (SEARCHED[entityType] ?? 'entities')) : undefined, rows, total}
@ -1160,10 +1212,14 @@ function describe(tool: string, values: Values, result: unknown, names: AiDetail
return {hood: text('read-relations', {entity: target}), blocks: relations(result)}; return {hood: text('read-relations', {entity: target}), blocks: relations(result)};
case 'read_timeseries': { case 'read_timeseries': {
const keys = Array.isArray(values.keys) ? values.keys.join(', ') : ''; const keys = Array.isArray(values.keys) ? values.keys.join(', ') : '';
const ids = Array.isArray(values.entityIds) ? values.entityIds.map(idOf).filter(Boolean) : [];
const subject: AiDetailParam = ids.length > 1
? {words: ids.map(id => names.get(id)?.name).every(Boolean) ? ids.map(id => names.get(id).name) : ['ai-assistant.detail.several'], commas: true}
: ids.length ? of(ids[0], values.entityType) : target;
const hood = values.mode === 'HISTORY' || values.startTime const hood = values.mode === 'HISTORY' || values.startTime
? text(keys ? 'read-history-keys' : 'read-history', {entity: target, keys, from: dateText(values.startTime), to: endText(values.endTime)}) ? text(keys ? 'read-history-keys' : 'read-history', {entity: subject, keys, from: dateText(values.startTime), to: endText(values.endTime)})
: text(keys ? 'read-latest-keys' : 'read-latest', {entity: target, keys}); : text(keys ? 'read-latest-keys' : 'read-latest', {entity: subject, keys});
const blocks = isObject(result) ? telemetry(result) : generic(result, 'result'); const blocks = isObject(result) ? telemetry(result, id => of(id, values.entityType)) : generic(result, 'result');
return {hood, blocks: isObject(result) && !Object.keys(result).length ? [{type: 'note', text: text('no-data')}] : blocks}; return {hood, blocks: isObject(result) && !Object.keys(result).length ? [{type: 'note', text: text('no-data')}] : blocks};
} }
case 'read_timeseries_keys': { case 'read_timeseries_keys': {
@ -1788,7 +1844,7 @@ function describe(tool: string, values: Values, result: unknown, names: AiDetail
return {hood, blocks: generic(raw, 'result')}; return {hood, blocks: generic(raw, 'result')};
} }
const warnings = Array.isArray(raw.warnings) ? raw.warnings.map(item => String(item)) : []; const warnings = Array.isArray(raw.warnings) ? raw.warnings.map(item => String(item)) : [];
const rows = facts(raw, ['typeParameters', 'warnings', 'note', 'next']); const rows = facts(raw, ['typeParameters', 'warnings', 'note', 'next', 'id', 'name', 'fqn', 'type']);
return {hood, blocks: [...(rows.length ? [{type: 'facts' as const, rows}] : []), return {hood, blocks: [...(rows.length ? [{type: 'facts' as const, rows}] : []),
...(warnings.length ? [{type: 'list' as const, label: text('widget-warnings'), rows: warnings.slice(0, MAX_ROWS)}] : [])]}; ...(warnings.length ? [{type: 'list' as const, label: text('widget-warnings'), rows: warnings.slice(0, MAX_ROWS)}] : [])]};
} }

2
ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.html

@ -43,7 +43,7 @@
@for (change of changes; track $index) { @for (change of changes; track $index) {
<div class="k-diff-f" [class.long]="isLongChange(change)"> <div class="k-diff-f" [class.long]="isLongChange(change)">
<div class="k-diff-l">@if (change.labelCode) { <code>{{ change.label }}</code> } @else { {{ change.label }} }</div> <div class="k-diff-l">@if (change.labelCode) { <code>{{ change.label }}</code> } @else { {{ change.label }} }</div>
<div class="k-diff-v"> <div class="k-diff-v" [class.pics]="change.image || change.currentImage">
<span class="k-diff-was">@if (change.currentImage) { <img tbAiFadeIn class="k-img was" [src]="change.current | image: {preview: true, ignoreLoadingImage: true} | async" alt=""> } @else { {{ change.current }} }</span> <span class="k-diff-was">@if (change.currentImage) { <img tbAiFadeIn class="k-img was" [src]="change.current | image: {preview: true, ignoreLoadingImage: true} | async" alt=""> } @else { {{ change.current }} }</span>
<span class="k-diff-to" aria-hidden="true">→</span> <span class="k-diff-to" aria-hidden="true">→</span>
<span class="tb-ai-sr-only">{{ 'ai-assistant.review.changes-to' | translate }}</span> <span class="tb-ai-sr-only">{{ 'ai-assistant.review.changes-to' | translate }}</span>

10
ui-ngx/src/app/modules/home/components/ai/ai-approval-card.component.ts

@ -219,6 +219,8 @@ export class AiApprovalCardComponent implements OnChanges, AfterViewChecked {
@Input() completedExecution: ToolExecutionResult | null = null; @Input() completedExecution: ToolExecutionResult | null = null;
@Input() durationMs?: number;
@Input() autoApprove = false; @Input() autoApprove = false;
@Input() answered = false; @Input() answered = false;
@ -269,6 +271,9 @@ export class AiApprovalCardComponent implements OnChanges, AfterViewChecked {
this.denying = false; this.denying = false;
this.state = 'denied'; this.state = 'denied';
} }
if (changes.durationMs && this.handedOver && !changes.completedExecution) {
this.handedOver = {...this.handedOver, durationMs: this.durationMs};
}
if (changes.completedExecution && this.completedExecution?.executionId === this.data.executionId) { if (changes.completedExecution && this.completedExecution?.executionId === this.data.executionId) {
const result = this.completedExecution; const result = this.completedExecution;
if (result.approvalStatus === ToolApprovalResult.TIMEOUT) { if (result.approvalStatus === ToolApprovalResult.TIMEOUT) {
@ -285,6 +290,7 @@ export class AiApprovalCardComponent implements OnChanges, AfterViewChecked {
result: result.result, result: result.result,
status: result.executionStatus, status: result.executionStatus,
startedAt: this.data.time ?? Date.now(), startedAt: this.data.time ?? Date.now(),
durationMs: this.durationMs ?? result.durationMs,
affectedEntities: result.affectedEntities ?? [] affectedEntities: result.affectedEntities ?? []
}; };
this.handedFacts = DETAILED_TOOLS.has(this.data.tool ?? '') ? [] : this.reviewFacts(); this.handedFacts = DETAILED_TOOLS.has(this.data.tool ?? '') ? [] : this.reviewFacts();
@ -398,8 +404,8 @@ export class AiApprovalCardComponent implements OnChanges, AfterViewChecked {
...this.rows('FACT', field => !isBlock(field)).map(row => row.image ? {label: row.label, raw: true, images: {value: row.value}} ...this.rows('FACT', field => !isBlock(field)).map(row => row.image ? {label: row.label, raw: true, images: {value: row.value}}
: {label: row.label, raw: true, value: row.value, mono: row.valueCode, chip: row.chip}), : {label: row.label, raw: true, value: row.value, mono: row.valueCode, chip: row.chip}),
...this.rows('CHANGE', field => !isBlock(field)).map(row => row.image || row.currentImage ...this.rows('CHANGE', field => !isBlock(field)).map(row => row.image || row.currentImage
? {label: row.label, raw: true, images: {current: row.currentImage ? row.current : undefined, value: row.image ? row.value : undefined}} ? {label: row.label, raw: true, change: true, images: {current: row.currentImage ? row.current : undefined, value: row.image ? row.value : undefined}}
: {label: row.label, raw: true, value: `${row.current ?? '—'} → ${row.value}`, mono: row.valueCode}) : {label: row.label, raw: true, change: true, was: row.current ?? '—', value: row.value, mono: row.valueCode, long: this.isLongChange(row)})
]; ];
} }

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

@ -137,6 +137,7 @@
<tb-ai-approval-card <tb-ai-approval-card
[data]="getApprovalData(msg)" [data]="getApprovalData(msg)"
[completedExecution]="getCompletedExecution(msg)" [completedExecution]="getCompletedExecution(msg)"
[durationMs]="toolDurations[msg.data.executionId]"
[autoApprove]="autoApprove" [autoApprove]="autoApprove"
[answered]="!!denyReasons[getApprovalData(msg).executionId]" [answered]="!!denyReasons[getApprovalData(msg).executionId]"
[busy]="loading" [busy]="loading"

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

@ -100,6 +100,8 @@ export class AiChatMessagesComponent implements OnChanges, OnDestroy {
@Input() loading = false; @Input() loading = false;
@Input() additionalStyles: string[]; @Input() additionalStyles: string[];
@Input() completedExecutions: Record<string, ToolExecutionResult> = {}; @Input() completedExecutions: Record<string, ToolExecutionResult> = {};
@Input() toolDurations: Record<string, number> = {};
@Input() autoApprove = false; @Input() autoApprove = false;
@Input() scrollContainer: HTMLElement; @Input() scrollContainer: HTMLElement;
@Input() initialScroll: 'lastUserMessage' | 'bottom' = 'lastUserMessage'; @Input() initialScroll: 'lastUserMessage' | 'bottom' = 'lastUserMessage';

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

@ -72,6 +72,7 @@
[messages]="messages()" [messages]="messages()"
[loading]="loading()" [loading]="loading()"
[completedExecutions]="completedExecutions()" [completedExecutions]="completedExecutions()"
[toolDurations]="toolDurations()"
[autoApprove]="autoApprove()" [autoApprove]="autoApprove()"
[additionalStyles]="markdownStyles" [additionalStyles]="markdownStyles"
[scrollContainer]="chatArea" [scrollContainer]="chatArea"

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

@ -184,6 +184,7 @@ export class AiChatComponent implements OnInit, OnDestroy {
historyLoading = signal(false); historyLoading = signal(false);
completedExecutions = signal<Record<string, ToolExecutionResult>>({}); completedExecutions = signal<Record<string, ToolExecutionResult>>({});
toolDurations = signal<Record<string, number>>({});
chat = computed(() => { chat = computed(() => {
const id = this.chatId(); const id = this.chatId();
@ -914,6 +915,7 @@ export class AiChatComponent implements OnInit, OnDestroy {
this.messages.set([]); this.messages.set([]);
this.limitOut.set(null); this.limitOut.set(null);
this.completedExecutions.set({}); this.completedExecutions.set({});
this.toolDurations.set({});
this.denyReasons.set({}); this.denyReasons.set({});
this.answeredApprovals.set(new Set()); this.answeredApprovals.set(new Set());
this.historyLoading.set(!!chatId); this.historyLoading.set(!!chatId);
@ -1475,6 +1477,7 @@ export class AiChatComponent implements OnInit, OnDestroy {
} }
private finishAction(finished: ToolFinished): void { private finishAction(finished: ToolFinished): void {
this.toolDurations.update(map => ({...map, [finished.executionId]: finished.durationMs}));
const known = this.messages().find(message => message.from === 'ACTION' && message.data.executionId === finished.executionId); const known = this.messages().find(message => message.from === 'ACTION' && message.data.executionId === finished.executionId);
if (known?.from === 'ACTION' && known.data.status !== 'RUNNING') { if (known?.from === 'ACTION' && known.data.status !== 'RUNNING') {
return; return;

3
ui-ngx/src/app/modules/home/components/ai/ai-code-block.ts

@ -200,6 +200,7 @@ function decorate(pre: HTMLElement, translate: TranslateService, copy: (text: st
const text = (pre.textContent ?? '').replace(/\n$/, ''); const text = (pre.textContent ?? '').replace(/\n$/, '');
const file = pre.querySelector('code')?.getAttribute('data-file'); const file = pre.querySelector('code')?.getAttribute('data-file');
const noCopy = pre.querySelector('code')?.hasAttribute('data-nocopy'); const noCopy = pre.querySelector('code')?.hasAttribute('data-nocopy');
const alwaysFolds = !!pre.querySelector('code')?.hasAttribute('data-fold');
const language = languageOf(pre); const language = languageOf(pre);
const lang = language?.lang ?? 'text'; const lang = language?.lang ?? 'text';
const shell = lang === 'shell' || lang === 'powershell'; const shell = lang === 'shell' || lang === 'powershell';
@ -217,7 +218,7 @@ function decorate(pre: HTMLElement, translate: TranslateService, copy: (text: st
pre.className = 'tb-code'; pre.className = 'tb-code';
pre.replaceChildren(code); pre.replaceChildren(code);
const lineCount = text.split('\n').length; const lineCount = text.split('\n').length;
const folds = lineCount > FOLD_LINES && lang !== 'diff'; const folds = (lineCount > FOLD_LINES || alwaysFolds) && lang !== 'diff';
const block = element('div', 'tb-codeblock'); const block = element('div', 'tb-codeblock');
const wrapper = pre.closest('.code-wrapper'); const wrapper = pre.closest('.code-wrapper');
if (wrapper) { if (wrapper) {

10
ui-ngx/src/app/modules/home/components/ai/ai-hand-over.component.html

@ -98,7 +98,7 @@
} }
</ol> </ol>
} }
@if (handOver().test; as test) { @if (!handOver().waitFor && handOver().test; as test) {
<tb-ai-disclosure class="k-test" variant="section" [summary]="'ai-assistant.hand-over.test-first' | translate"> <tb-ai-disclosure class="k-test" variant="section" [summary]="'ai-assistant.hand-over.test-first' | translate">
@if (test.hint) { @if (test.hint) {
<p class="ob-hint">{{ test.hint }}</p> <p class="ob-hint">{{ test.hint }}</p>
@ -153,6 +153,14 @@
</button> </button>
} }
</div> </div>
@if (handOver().test; as test) {
<tb-ai-disclosure class="k-test" variant="section" [summary]="'ai-assistant.hand-over.test-here' | translate">
@if (test.hint) {
<p class="ob-hint">{{ test.hint }}</p>
}
<div class="k-test-slot"></div>
</tb-ai-disclosure>
}
</div> </div>
} @else if (waiting()) { } @else if (waiting()) {
<div class="k-waitrow"> <div class="k-waitrow">

1
ui-ngx/src/app/shared/models/ai-chat.models.ts

@ -146,6 +146,7 @@ export interface ToolExecutionResult extends BaseChatToolEventData {
affectedEntities?: Array<EntityId>; affectedEntities?: Array<EntityId>;
reason?: string; reason?: string;
result?: string; result?: string;
durationMs?: number;
} }
export interface ToolExecutionResultEvent extends BaseChatEvent { export interface ToolExecutionResultEvent extends BaseChatEvent {

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

@ -791,6 +791,25 @@
"all-visible": "The customer can see every entity this dashboard shows.", "all-visible": "The customer can see every entity this dashboard shows.",
"alarm-meta": "{{severity}}, {{status}} · since {{since}}", "alarm-meta": "{{severity}}, {{status}} · since {{since}}",
"asked-for": "Asked for", "asked-for": "Asked for",
"several": "several entities",
"history-key": "Key",
"history-curve": "Over time",
"history-last": "Last",
"history-range": "Range",
"history-changes": "{{count}} changes",
"history-span": "{{min}} to {{max}}",
"no-alarms": "No alarms",
"alarm-filter": {
"ACTIVE": "active",
"CLEARED": "cleared",
"ACK": "acknowledged",
"UNACK": "not acknowledged",
"CRITICAL": "critical",
"MAJOR": "major",
"MINOR": "minor",
"WARNING": "warning",
"INDETERMINATE": "indeterminate"
},
"heads-up": "Heads-up", "heads-up": "Heads-up",
"stages": "Stages", "stages": "Stages",
"asked": { "asked": {
@ -800,11 +819,19 @@
"related-from": "what {{entity}} points to", "related-from": "what {{entity}} points to",
"related-to": "what points to {{entity}}", "related-to": "what points to {{entity}}",
"alarms-of": "{{entity}}", "alarms-of": "{{entity}}",
"alarms": "{{filter}}",
"alarms-on": "on {{entity}}",
"alarms-filter-on": "{{filter}}, on {{entity}}",
"alarms-window": "{{window}}",
"alarms-filter-window": "{{filter}}, {{window}}",
"alarms-on-window": "on {{entity}}, {{window}}",
"alarms-filter-on-window": "{{filter}}, on {{entity}}, {{window}}",
"attributes-scope": "the {{scope}} of {{entity}}", "attributes-scope": "the {{scope}} of {{entity}}",
"history": "{{entity}}, {{from}} – {{to}}", "history": "{{entity}}, {{from}} – {{to}}",
"history-keys": "{{keys}} on {{entity}}, {{from}} – {{to}}", "history-keys": "{{keys}} on {{entity}}, {{from}} – {{to}}",
"latest-keys": "{{keys}} of {{entity}}", "latest-keys": "{{keys}} of {{entity}}",
"query": "'{{query}}'" "query": "'{{query}}'",
"widget": "{{name}}"
}, },
"alarm-status": { "alarm-status": {
"ACTIVE_UNACK": "active, not acknowledged", "ACTIVE_UNACK": "active, not acknowledged",
@ -1224,7 +1251,6 @@
"now": "now", "now": "now",
"cut-short": "Cut short: only the start of it was reported.", "cut-short": "Cut short: only the start of it was reported.",
"more": "and {{count}} more", "more": "and {{count}} more",
"series": "{{points}} points · {{min}} – {{max}} · last {{last}}",
"installs": "{{count}} installs", "installs": "{{count}} installs",
"hub-device": "Device", "hub-device": "Device",
"on-iot-hub": "On IoT Hub", "on-iot-hub": "On IoT Hub",
@ -1348,8 +1374,8 @@
"done": "Looked up gateways" "done": "Looked up gateways"
}, },
"search-alarms": { "search-alarms": {
"run": "Looking up alarms", "run": "Searching alarms",
"done": "Looked up alarms" "done": "Searched alarms"
}, },
"search-alarm-rules": { "search-alarm-rules": {
"run": "Looking up alarm rules", "run": "Looking up alarm rules",
@ -2368,6 +2394,7 @@
"stopped-at": "Stopped listening at {{time}}", "stopped-at": "Stopped listening at {{time}}",
"listen-again": "Listen again", "listen-again": "Listen again",
"test-first": "Test from this computer first", "test-first": "Test from this computer first",
"test-here": "Test from this computer",
"send-test": "Send a test value", "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": "Sends one value as the device, marked as a test; the wait keeps listening for the device itself",
"test-sent": "Sent a test value at {{time}}; it is on the latest telemetry. The wait goes on for the device itself.", "test-sent": "Sent a test value at {{time}}; it is on the latest telemetry. The wait goes on for the device itself.",

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

@ -1555,6 +1555,21 @@
display: grid; display: grid;
gap: 10px; gap: 10px;
} }
.k-diff-v.pics {
display: flex;
align-items: center;
gap: 10px;
.k-diff-to {
margin: 0;
}
.k-img {
width: 72px;
height: 54px;
}
}
} }
.k-actions { .k-actions {
@ -5137,10 +5152,8 @@ tb-ai-action-detail.k-detail {
.k-detail-recs, .k-detail-recs,
.k-tels, .k-tels,
.k-series,
.k-made, .k-made,
.k-detail-links, .k-detail-links {
.k-detail-facts {
max-height: 214px; max-height: 214px;
overflow-y: auto; overflow-y: auto;
overscroll-behavior: contain; overscroll-behavior: contain;
@ -5256,49 +5269,179 @@ tb-ai-action-detail.k-detail {
} }
} }
.k-series { .k-diff {
display: grid; margin-top: 8px;
gap: 6px; gap: 6px;
margin-top: 10px;
.k-diff-v {
font-size: var(--chat-line);
line-height: var(--chat-line-lh);
}
.k-diff-v.mono {
font-family: var(--tb-mono);
font-size: var(--chat-code);
}
.k-diff-l {
font-size: var(--chat-meta);
color: var(--tb-text-secondary);
}
} }
.k-series-row { .k-img {
display: grid; display: flex;
grid-template-columns: max-content 96px minmax(0, 1fr);
align-items: center; align-items: center;
gap: 10px; gap: 10px;
code.k-tel-key { img, .k-img-none {
padding: 2px 7px; display: block;
border-radius: 5px; width: 72px;
background: rgba(0, 0, 0, 0.06); height: 54px;
font-family: var(--tb-mono); box-sizing: border-box;
font-size: 13px; object-fit: contain;
line-height: 20px; border: 1px solid var(--tb-line);
color: var(--tb-ink); border-radius: 6px;
background: var(--tb-surface);
}
> .mat-icon {
color: var(--tb-ink-38);
} }
} }
.k-series-spark { .k-found {
width: 96px; margin: 4px 0 0;
height: 20px; font-size: var(--chat-line);
overflow: visible; line-height: var(--chat-line-lh);
color: var(--tb-ink);
}
.k-group-h {
margin: 20px 0 0;
font-size: var(--chat-line);
line-height: var(--chat-line-lh);
font-weight: 500;
color: var(--tb-ink);
path { &:first-child {
fill: none; margin-top: 0;
stroke: var(--ai-teal-500); }
stroke-width: 1.5;
stroke-linejoin: round; + * {
vector-effect: non-scaling-stroke; margin-top: 2px;
} }
} }
.k-series-meta { .k-key {
font-family: var(--tb-mono); font-family: var(--tb-mono);
font-size: 12px; font-size: var(--chat-code);
line-height: 18px; }
color: var(--k-grey);
font-variant-numeric: tabular-nums; .k-vals {
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
align-items: baseline;
column-gap: 16px;
row-gap: 2px;
margin: 10px 0 0;
font-size: var(--chat-line);
line-height: var(--chat-line-lh);
dt {
font-size: var(--chat-meta);
line-height: var(--chat-line-lh);
color: var(--tb-text-secondary);
}
dd {
margin: 0;
min-width: 0;
overflow-wrap: anywhere;
color: var(--tb-ink);
}
}
.k-hist {
margin-top: 10px;
border-collapse: collapse;
font-size: var(--chat-line);
line-height: var(--chat-line-lh);
th, td {
padding: 2px 16px 2px 0;
text-align: left;
vertical-align: middle;
font-weight: 400;
}
:is(th, td):last-child {
padding-right: 0;
}
thead th {
padding-bottom: 4px;
font-size: var(--chat-meta);
line-height: var(--chat-meta-lh);
color: var(--tb-text-muted);
}
.k-key {
color: var(--tb-text-secondary);
}
td.c {
width: 112px;
}
.tb-spark {
position: relative;
width: 112px;
height: 20px;
}
.tb-spark-svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
path {
fill: none;
stroke: var(--tb-ink-54);
stroke-width: 2;
stroke-linejoin: round;
stroke-linecap: round;
vector-effect: non-scaling-stroke;
}
}
.tb-spark-dot {
position: absolute;
right: -3px;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--tb-ink-54);
box-shadow: 0 0 0 2px var(--tb-surface);
}
:is(td, th).n {
text-align: right;
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
td.n {
color: var(--tb-ink);
}
td.q {
white-space: nowrap;
font-variant-numeric: tabular-nums;
color: var(--tb-text-secondary);
}
} }
.k-detail-facts { .k-detail-facts {

Loading…
Cancel
Save