wuic-framework-lib 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{wuic-framework-lib-chart-list.component-B1V8Q-Qq.mjs → wuic-framework-lib-chart-list.component-C02jeFGy.mjs} +2 -2
- package/fesm2022/{wuic-framework-lib-code-editor.component-4N95qt3D.mjs → wuic-framework-lib-code-editor.component-BZNLr0Jj.mjs} +59 -2
- package/fesm2022/{wuic-framework-lib-designer.component-pW1YK-oY.mjs → wuic-framework-lib-designer.component-N_CfbGnr.mjs} +986 -17
- package/fesm2022/{wuic-framework-lib-first-run-wizard.component-CaGePYLi.mjs → wuic-framework-lib-first-run-wizard.component-lW7-xMm3.mjs} +7 -61
- package/fesm2022/{wuic-framework-lib-framework-docs.component-m0IlS0Sl.mjs → wuic-framework-lib-framework-docs.component-CGQbmSkv.mjs} +3716 -347
- package/fesm2022/{wuic-framework-lib-pivot-builder.component-VIs0CIH_.mjs → wuic-framework-lib-pivot-builder.component-0gJz9RWr.mjs} +5 -5
- package/fesm2022/{wuic-framework-lib-prompt-dialog-fallback-host.component-Dm9GTZ07.mjs → wuic-framework-lib-prompt-dialog-fallback-host.component-C9LvmFsL.mjs} +2 -2
- package/fesm2022/{wuic-framework-lib-report-designer.component-FiAwNkPM.mjs → wuic-framework-lib-report-designer.component-DcpdzFjh.mjs} +2 -2
- package/fesm2022/{wuic-framework-lib-report-viewer.component-DY0dGMrt.mjs → wuic-framework-lib-report-viewer.component-BHpbGpp9.mjs} +2 -2
- package/fesm2022/{wuic-framework-lib-scheduler-list.component-3E5m-9Qd.mjs → wuic-framework-lib-scheduler-list.component-DHoukjf-.mjs} +2 -2
- package/fesm2022/{wuic-framework-lib-spreadsheet-list-sf.component-D9P9WbDl.mjs → wuic-framework-lib-spreadsheet-list-sf.component-VsaXepUC.mjs} +2 -2
- package/fesm2022/{wuic-framework-lib-workflow-designer.component-4RC2EkGA.mjs → wuic-framework-lib-workflow-designer.component-epj3oKq3.mjs} +2 -2
- package/fesm2022/{wuic-framework-lib-wuic-framework-lib-BSyGhpM1.mjs → wuic-framework-lib-wuic-framework-lib-Deudd4MY.mjs} +2186 -144
- package/fesm2022/wuic-framework-lib.mjs +1 -1
- package/package.json +1 -1
- package/types/wuic-framework-lib.d.ts +829 -11
|
@@ -594,6 +594,15 @@ declare class TranslationManagerService {
|
|
|
594
594
|
* del missing key).
|
|
595
595
|
*/
|
|
596
596
|
private _langMismatchReloadInFlight;
|
|
597
|
+
/**
|
|
598
|
+
* Ultimo locale risolto in modo AFFIDABILE (da override localStorage o da
|
|
599
|
+
* `userInfo`). Usato come fallback stabile in `resolveCurrentLocale()` quando
|
|
600
|
+
* `getuserInfo()` torna momentaneamente vuoto (succede durante navigazione/
|
|
601
|
+
* edit/reload metadata): senza, il locale driftarebbe a `navigator.language`/
|
|
602
|
+
* default, cambiando la `translationCacheKey` e innescando il self-heal che
|
|
603
|
+
* faceva sparire le traduzioni fino al refresh.
|
|
604
|
+
*/
|
|
605
|
+
private _stableLocale;
|
|
597
606
|
/**
|
|
598
607
|
* Bundle minimo di traduzioni hardcoded per il SOLO scenario firstRun (DB
|
|
599
608
|
* metadati ancora non inizializzato → tabella `_wuic_translations` non
|
|
@@ -1160,9 +1169,17 @@ declare class DataSourceComponent implements OnInit, OnDestroy {
|
|
|
1160
1169
|
* DI) invece che da costruttore per non rompere i call site manuali tipo
|
|
1161
1170
|
* `new DataSourceComponent(metaSrv, dataSrv, ...)` in designer.component.ts
|
|
1162
1171
|
* e metadata-editor.service.ts (che mantengono i 7 params posizionali storici).
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1172
|
+
*
|
|
1173
|
+
* ATTENZIONE: `{ optional: true }` rende il field `null` solo se il TOKEN non e'
|
|
1174
|
+
* risolvibile, NON quando si e' fuori da un injection context. Fuori contesto
|
|
1175
|
+
* (istanziazione manuale via `new`, es. metadata-editor.service che crea un
|
|
1176
|
+
* DataSource headless per fetch schema/dati) `inject()` lancia SEMPRE `NG0203`
|
|
1177
|
+
* a prescindere da `optional`. Per questo lo avvolgiamo in try/catch: nel path
|
|
1178
|
+
* Angular normale ritorna l'ElementRef host; nei call site manuali ritorna
|
|
1179
|
+
* `null` (il consumo in ngOnInit usa `?.nativeElement`, quindi entrambi i path
|
|
1180
|
+
* sono supportati). Senza questo guard, un doppio-click su una label del
|
|
1181
|
+
* parametric dialog (che passa per metadata-editor.service -> `new DataSource`)
|
|
1182
|
+
* crashava con NG0203.
|
|
1166
1183
|
* Scopo: esporre `this` su `host.__wuicCmp` per E2E introspection senza
|
|
1167
1184
|
* dipendere da `window.ng.getComponent` (tree-shaken in prod build).
|
|
1168
1185
|
*/
|
|
@@ -1514,6 +1531,31 @@ declare class DataSourceComponent implements OnInit, OnDestroy {
|
|
|
1514
1531
|
* Svuota la selezione locale delle righe.
|
|
1515
1532
|
*/
|
|
1516
1533
|
clearSelectedRows(): void;
|
|
1534
|
+
/**
|
|
1535
|
+
* Ritorna i record correntemente selezionati nella `<wuic-list-grid>` (checkbox
|
|
1536
|
+
* di selezione multipla). Usato nelle **toolbar action bulk** per recuperare le
|
|
1537
|
+
* righe su cui agire prima di chiamare un endpoint server.
|
|
1538
|
+
*
|
|
1539
|
+
* Forma canonica nei callback (firma `(datasource, metaInfo, record, event, wtoolbox)`):
|
|
1540
|
+
* ```js
|
|
1541
|
+
* const selected = (datasource.getSelectedRows && datasource.getSelectedRows()) || [];
|
|
1542
|
+
* if (!selected.length) {
|
|
1543
|
+
* wtoolbox.messageNotificationService.add({ severity:'warn', summary:'Selezione vuota', detail:'Seleziona almeno una riga' });
|
|
1544
|
+
* return;
|
|
1545
|
+
* }
|
|
1546
|
+
* const ids = selected.map(r => Number(r.id?.value ?? r.id ?? r.Id));
|
|
1547
|
+
* ```
|
|
1548
|
+
*
|
|
1549
|
+
* **Importante**: il parametro `record` passato al callback toolbar è un SINGOLO
|
|
1550
|
+
* record (la riga "corrente"), NON l'array dei selezionati. Per il bulk usare
|
|
1551
|
+
* SEMPRE `datasource.getSelectedRows()` (oggetti completi) o
|
|
1552
|
+
* `datasource.getSelectedKeys()` (solo PK).
|
|
1553
|
+
*
|
|
1554
|
+
* Pre-requisito: la tabella deve avere `mdmultipleselection=1` su
|
|
1555
|
+
* `_metadati__tabelle` (vedi skill `table-actions`).
|
|
1556
|
+
*
|
|
1557
|
+
* @returns Array di record selezionati (vuoto se nulla e' selezionato).
|
|
1558
|
+
*/
|
|
1517
1559
|
getSelectedRows(): any[];
|
|
1518
1560
|
/**
|
|
1519
1561
|
* Estrae dalla selezione i valori della chiave primaria; per PK composta restituisce un oggetto per riga.
|
|
@@ -2993,6 +3035,32 @@ declare class MetadataProviderService {
|
|
|
2993
3035
|
* @param userId Identificativo utente usato per contesto e persistenza.
|
|
2994
3036
|
*/
|
|
2995
3037
|
private clearMenuAdminMethodsCache;
|
|
3038
|
+
/**
|
|
3039
|
+
* Cancella dalla Dexie locale SOLO i record collegati alla route data, lasciando
|
|
3040
|
+
* intatto il resto del database multi-tenant. Necessario dopo che un'operazione
|
|
3041
|
+
* server-side (es. RAG chatbot Apply, metadata-editor save) modifica i metadati
|
|
3042
|
+
* di una singola route senza invalidare l'intera cache: chiamare
|
|
3043
|
+
* <c>Dexie.delete()</c> per tutto il DB causa una riapertura completa al primo
|
|
3044
|
+
* F5 (costosa: ~MB di re-fetch dal backend per le route che non hanno cambiato);
|
|
3045
|
+
* con questo metodo si esegue un flush mirato sulle 7 tabelle Dexie correlate.
|
|
3046
|
+
*
|
|
3047
|
+
* Tabelle gestite (vedi <c>generateLocalDB</c>):
|
|
3048
|
+
* - MetadatiTabella (filter: md_route_name)
|
|
3049
|
+
* - MetadatiColonna (filter: md_id derivato)
|
|
3050
|
+
* - MetadatiCustomActionTabella (filter: md_id)
|
|
3051
|
+
* - MetadatiUiStiliTabella (filter: md_id)
|
|
3052
|
+
* - MetadatiUiStiliColonna (filter: mc_id ∈ colonne della route)
|
|
3053
|
+
* - MetadatiUtentiAutorizzazioniColonna (filter: mc_id ∈ colonne della route)
|
|
3054
|
+
* - MetadatiConditionGroup (filter: md_id)
|
|
3055
|
+
*
|
|
3056
|
+
* No-op se: route vuota, Dexie non inizializzata, o la route non e' presente in
|
|
3057
|
+
* cache (gia' "lazy" - verra' fetched dal backend al primo accesso).
|
|
3058
|
+
* Best-effort: errori dei singoli delete non bloccano gli altri.
|
|
3059
|
+
*
|
|
3060
|
+
* @param route Nome route metadata (es. "cities", "stockitems") — corrisponde
|
|
3061
|
+
* a <c>MetadatiTabella.md_route_name</c>.
|
|
3062
|
+
*/
|
|
3063
|
+
static deleteRouteFromCache(route: string): Promise<void>;
|
|
2996
3064
|
/**
|
|
2997
3065
|
* Invalida la cache menu dell'utente corrente (o dell'utente passato) rimuovendo la voce `menu_{userId}` da localStorage.
|
|
2998
3066
|
* Se richiesto elimina anche la cache dei metodi amministrativi `menu_admin_methods_{userId}`.
|
|
@@ -3007,6 +3075,32 @@ declare class MetadataProviderService {
|
|
|
3007
3075
|
* @returns Collezione metadata colonna della tabella richiesta.
|
|
3008
3076
|
*/
|
|
3009
3077
|
getMetadatiById(md_id: number): Promise<MetadatiColonna[]>;
|
|
3078
|
+
private static _availableRoutesCache;
|
|
3079
|
+
private static _availableRoutesInflight;
|
|
3080
|
+
/**
|
|
3081
|
+
* Lista delle route metadata utente (md_route_name + md_display_string).
|
|
3082
|
+
* Backend: `MetaService.getAvailableRoutes` (admin-only, cached server-side).
|
|
3083
|
+
*
|
|
3084
|
+
* Idempotente + de-duplicato in-flight: chiamate concorrenti condividono
|
|
3085
|
+
* la stessa Promise per evitare race.
|
|
3086
|
+
*
|
|
3087
|
+
* Usata dal chatbot RAG (designer state provider) per:
|
|
3088
|
+
* 1) fornire al LLM la whitelist di route valide,
|
|
3089
|
+
* 2) permettere fuzzy-match semantico ("provincie" -> "provinces"),
|
|
3090
|
+
* 3) fare follow-up question quando l'utente menziona una route ambigua.
|
|
3091
|
+
*/
|
|
3092
|
+
getAvailableRoutesAsync(): Promise<Array<{
|
|
3093
|
+
md_id: number;
|
|
3094
|
+
md_route_name: string;
|
|
3095
|
+
md_display_string: string;
|
|
3096
|
+
}>>;
|
|
3097
|
+
/**
|
|
3098
|
+
* Invalida la cache process-wide delle route disponibili. Chiamare dopo
|
|
3099
|
+
* scaffolding (crea/elimina route) per forzare un re-fetch al prossimo
|
|
3100
|
+
* accesso. La cache server-side va invalidata separatamente (boot di
|
|
3101
|
+
* un nuovo worker o gesture esplicita).
|
|
3102
|
+
*/
|
|
3103
|
+
clearAvailableRoutesCache(): void;
|
|
3010
3104
|
/**
|
|
3011
3105
|
* Restituisce i metadata di una route (o `md_id`) da cache Dexie quando validi; in caso contrario ricarica da backend.
|
|
3012
3106
|
* Gestisce invalidazione per versioning metadata progetto e bypass cache in modalita client-side CRUD.
|
|
@@ -3596,8 +3690,10 @@ declare class DataProviderMetaService {
|
|
|
3596
3690
|
*/
|
|
3597
3691
|
private buildStoredParametersPayload;
|
|
3598
3692
|
/**
|
|
3599
|
-
* Pulisce la cache localStorage preservando le
|
|
3600
|
-
*
|
|
3693
|
+
* Pulisce la cache localStorage preservando le chiavi user-state della
|
|
3694
|
+
* whitelist centralizzata in `util/wuic-storage.util.ts` (translation cache,
|
|
3695
|
+
* id sessione chatbot RAG, preferenze tema/lingua, ecc.). Vedi i commenti in
|
|
3696
|
+
* quel file per la lista completa e il razionale.
|
|
3601
3697
|
*/
|
|
3602
3698
|
private clearLocalStoragePreservingTranslation;
|
|
3603
3699
|
private buildRouteContext;
|
|
@@ -6225,6 +6321,9 @@ declare class ListGridComponent implements AfterViewInit, OnInit, OnDestroy, IDa
|
|
|
6225
6321
|
private releaseGridStateUrlPushTimer;
|
|
6226
6322
|
private navigationTriggeredByPopstate;
|
|
6227
6323
|
private suppressNextPageOnlyQuerySync;
|
|
6324
|
+
private pendingFilterChangeEvent;
|
|
6325
|
+
private pendingFilterChangeTimer;
|
|
6326
|
+
private lastFetchedPayloadHash;
|
|
6228
6327
|
clientSideCrudToggleBusy: boolean;
|
|
6229
6328
|
private persistedColumnWidthsByRoute;
|
|
6230
6329
|
private persistedColumnLayoutByRoute;
|
|
@@ -6658,6 +6757,12 @@ declare class ListGridComponent implements AfterViewInit, OnInit, OnDestroy, IDa
|
|
|
6658
6757
|
* @returns Risultato elaborato da `pageFilterChange` e restituito al chiamante.
|
|
6659
6758
|
*/
|
|
6660
6759
|
pageFilterChange(event: any): Promise<void>;
|
|
6760
|
+
/**
|
|
6761
|
+
* Processore reale dell'evento PrimeNG (sort/filter/paging). Chiamato
|
|
6762
|
+
* tail-call da `pageFilterChange` via setTimeout(0) per coalesce.
|
|
6763
|
+
* NON chiamare direttamente: la coalesce e' la guard anti-duplicate-fetch.
|
|
6764
|
+
*/
|
|
6765
|
+
private _processPageFilterEvent;
|
|
6661
6766
|
/**
|
|
6662
6767
|
* Gestisce la logica operativa di `clearFilter` in modo coerente con l'implementazione corrente.
|
|
6663
6768
|
* @param table Parametro utilizzato dal metodo nel flusso elaborativo.
|
|
@@ -9951,6 +10056,12 @@ interface AppSettingFieldDef {
|
|
|
9951
10056
|
* user can't accidentally write `mssqll` and brick the next backend boot.
|
|
9952
10057
|
*/
|
|
9953
10058
|
options?: string[] | null;
|
|
10059
|
+
/** Se valorizzato, le `options` sono DINAMICHE: vengono fetchate da questo endpoint
|
|
10060
|
+
* (relativo, es. `api/AppSettings/LlmModels`) passando il valore del campo
|
|
10061
|
+
* `optionsDependsOn` come query param omonimo. Re-fetch al cambio di quel campo. */
|
|
10062
|
+
optionsEndpoint?: string | null;
|
|
10063
|
+
/** Key (senza prefisso `AppSettings:`) del campo da cui dipendono le options dinamiche. */
|
|
10064
|
+
optionsDependsOn?: string | null;
|
|
9954
10065
|
}
|
|
9955
10066
|
interface AppSettingSection {
|
|
9956
10067
|
name: string;
|
|
@@ -10033,6 +10144,14 @@ declare class AppSettingsEditorComponent implements OnInit {
|
|
|
10033
10144
|
*/
|
|
10034
10145
|
onFieldChange(key: string, newValue: any): void;
|
|
10035
10146
|
fieldValue(key: string): any;
|
|
10147
|
+
/** Per ogni field con `optionsEndpoint`, fetcha le options usando il valore corrente
|
|
10148
|
+
* del campo `optionsDependsOn`. Chiamato dopo ogni loadSchema. */
|
|
10149
|
+
private refreshDynamicOptions;
|
|
10150
|
+
/** Valore corrente del campo identificato da `dependsOnKey` (con/senza prefisso AppSettings:). */
|
|
10151
|
+
private dependsOnValue;
|
|
10152
|
+
/** GET `<endpoint>?<dependsOn>=<depVal>` -> popola `f.options`. Best-effort: su errore
|
|
10153
|
+
* lascia il campo come testo libero (options resta vuoto). */
|
|
10154
|
+
private fetchFieldOptions;
|
|
10036
10155
|
/**
|
|
10037
10156
|
* Ritorna `true` se almeno uno dei changes coinvolge una chiave licenza
|
|
10038
10157
|
* (`license-email` / `license-payload` / `license-signature`). Usato dal save
|
|
@@ -12428,6 +12547,17 @@ declare class DynamicRowTemplateComponent {
|
|
|
12428
12547
|
* Gestisce la logica operativa di `classes` usando metadati di tabella/colonna allineati al modello server `_Metadati_*`.
|
|
12429
12548
|
* @returns Valore calcolato dinamicamente a partire dallo stato corrente del componente.
|
|
12430
12549
|
*/
|
|
12550
|
+
/**
|
|
12551
|
+
* Inline style cumulativo applicato alla `<tr>` quando una entry di
|
|
12552
|
+
* `_metadati__u_i__stili__tabelle` ha `must_attribute_name` con prefisso `style:`
|
|
12553
|
+
* (es. `style:background-color:#9b59b6;color:white`). Permette al chatbot RAG
|
|
12554
|
+
* (tool `propose_table_style`) di proporre colori arbitrari fuori dalla palette
|
|
12555
|
+
* predefinita (`row-danger/warning/info/success`) senza dover aggiungere CSS
|
|
12556
|
+
* lato app. Sintassi: prefisso `style:` letterale + dichiarazioni standard CSS
|
|
12557
|
+
* separate da `;`. Backwards-compatible: entries senza prefisso `style:` restano
|
|
12558
|
+
* trattate come classe CSS (vedi `getTableStyleClasses`).
|
|
12559
|
+
*/
|
|
12560
|
+
get inlineStyle(): string | null;
|
|
12431
12561
|
get classes(): string | null;
|
|
12432
12562
|
/**
|
|
12433
12563
|
* Recupera e prepara i dati richiesti dal chiamante normalizzando e trasformando collezioni di record, usando i metadati per determinare campi, chiavi e comportamento runtime, allineando i record al formato atteso dal framework.
|
|
@@ -12435,6 +12565,16 @@ declare class DynamicRowTemplateComponent {
|
|
|
12435
12565
|
*/
|
|
12436
12566
|
private getTableStyleClasses;
|
|
12437
12567
|
/**
|
|
12568
|
+
* Inline-style speculare a `getTableStyleClasses`. Filtra le entries di
|
|
12569
|
+
* `_Metadati_UI_Stili_Tabelles` il cui `must_attribute_name` ha prefisso
|
|
12570
|
+
* `style:` letterale; valuta il predicate (`must_attribute_value`) con
|
|
12571
|
+
* stessa semantica e stessa cache (skip su throw); concatena le dichiarazioni
|
|
12572
|
+
* CSS in una stringa unica idonea all'attributo HTML `style`. Restituisce
|
|
12573
|
+
* `null` se nessuna entry matcha — Angular rimuove l'attributo, lasciando
|
|
12574
|
+
* intatto eventuale styling dal CSS.
|
|
12575
|
+
*/
|
|
12576
|
+
private getTableInlineStyle;
|
|
12577
|
+
/**
|
|
12438
12578
|
* Costruisce una struttura di output a partire dal contesto corrente usando i metadati per determinare campi, chiavi e comportamento runtime, allineando i record al formato atteso dal framework.
|
|
12439
12579
|
* @param conditionCode Valore testuale usato come chiave, campo, route o parametro di configurazione.
|
|
12440
12580
|
* @returns Valore di tipo `(metaInfo: MetaInfo, record: any, wtoolbox: typeof WtoolboxService) => boolean` costruito dal metodo per i passaggi successivi del flusso.
|
|
@@ -12448,6 +12588,17 @@ declare class DynamicRowTemplateComponent {
|
|
|
12448
12588
|
*/
|
|
12449
12589
|
getCellClasses(metaColumn: any, rowData: any): string | null;
|
|
12450
12590
|
/**
|
|
12591
|
+
* Inline-style speculare a `getCellInlineStyle` per le celle. Filtra le
|
|
12592
|
+
* entries di `_Metadati_UI_Stili_Colonnes` il cui `musc_attribute_name` ha
|
|
12593
|
+
* prefisso `style:`; valuta il predicate (`musc_attribute_value` o
|
|
12594
|
+
* `musc_attribute_value_callback`) e concatena le dichiarazioni CSS in una
|
|
12595
|
+
* stringa unica idonea all'attributo HTML `style`. Iniezione automatica di
|
|
12596
|
+
* `!important` su ogni dichiarazione che non ce l'ha gia' (PrimeNG p-table
|
|
12597
|
+
* applica `background` ai td via regole con `!important` per striped/hover —
|
|
12598
|
+
* senza, l'inline style perderebbe la specificity).
|
|
12599
|
+
*/
|
|
12600
|
+
getCellInlineStyle(metaColumn: any, rowData: any): string | null;
|
|
12601
|
+
/**
|
|
12451
12602
|
* Recupera e prepara i dati richiesti dal chiamante usando i metadati per determinare campi, chiavi e comportamento runtime.
|
|
12452
12603
|
* @param fieldName Valore testuale usato come chiave, campo, route o parametro di configurazione.
|
|
12453
12604
|
* @returns Valore di tipo `MetadatiColonna | null` costruito dal metodo per i passaggi successivi del flusso.
|
|
@@ -14181,11 +14332,15 @@ interface RagChatTurn {
|
|
|
14181
14332
|
role: 'user' | 'assistant';
|
|
14182
14333
|
content: string;
|
|
14183
14334
|
}
|
|
14335
|
+
/** Profilo redazione richiesto dall'UI (toggle). Il server applica
|
|
14336
|
+
* strictest-of(env, richiesta): puo' solo aumentare la redazione. */
|
|
14337
|
+
type RagProfile = 'internal' | 'release';
|
|
14184
14338
|
/** Payload `POST /api/Rag/Query`. */
|
|
14185
14339
|
interface RagQueryRequest {
|
|
14186
14340
|
query: string;
|
|
14187
14341
|
top_k?: number;
|
|
14188
14342
|
use_lora?: boolean;
|
|
14343
|
+
profile?: RagProfile;
|
|
14189
14344
|
}
|
|
14190
14345
|
/** Risposta `POST /api/Rag/Query`. */
|
|
14191
14346
|
interface RagQueryResponse {
|
|
@@ -14197,6 +14352,7 @@ interface RagChatRequest {
|
|
|
14197
14352
|
history?: RagChatTurn[];
|
|
14198
14353
|
top_k?: number;
|
|
14199
14354
|
model?: string;
|
|
14355
|
+
profile?: RagProfile;
|
|
14200
14356
|
}
|
|
14201
14357
|
/**
|
|
14202
14358
|
* Risposta `POST /api/Rag/Chat`.
|
|
@@ -14232,6 +14388,14 @@ interface RagChatSessionDto {
|
|
|
14232
14388
|
title?: string | null;
|
|
14233
14389
|
createdAt: string;
|
|
14234
14390
|
updatedAt: string;
|
|
14391
|
+
/** Riassunto dei turn pre-compact (iniettato nel system prompt LLM). Null
|
|
14392
|
+
* finche' la session non e' mai stata compattata. */
|
|
14393
|
+
contextSummary?: string | null;
|
|
14394
|
+
/** JSON array dei memory facts pinnati. Null/[] = nessun fact pinnato. */
|
|
14395
|
+
memoryFactsJson?: string | null;
|
|
14396
|
+
/** Marker: turn con `id <= summaryUpToMessageId` sono coperti dal `contextSummary`
|
|
14397
|
+
* e vengono trim-mati dalla history passata al LLM. */
|
|
14398
|
+
summaryUpToMessageId?: number | null;
|
|
14235
14399
|
}
|
|
14236
14400
|
/** Un messaggio (turno) della cronologia. */
|
|
14237
14401
|
interface RagChatMessageDto {
|
|
@@ -14249,6 +14413,123 @@ interface RagChatMessageDto {
|
|
|
14249
14413
|
correlationId: string;
|
|
14250
14414
|
createdAt: string;
|
|
14251
14415
|
completedAt?: string | null;
|
|
14416
|
+
/** JSON serializzato della proposta strutturata emessa dall'LLM via tool-use.
|
|
14417
|
+
* Forma: {"kind":"toolbar_action","route":"cities","label":"Genera PDF",
|
|
14418
|
+
* "icon":"pi pi-file-pdf","callback_js":"...","rationale":"..."}.
|
|
14419
|
+
* Null = nessuna proposta (risposta solo testo). */
|
|
14420
|
+
proposedActionJson?: string | null;
|
|
14421
|
+
/** Timestamp UTC dell'applicazione della proposta. Null = mai applicata. */
|
|
14422
|
+
proposedActionAppliedAt?: string | null;
|
|
14423
|
+
/** JSON array di follow-up question (max 3) emesse dall'LLM via tool
|
|
14424
|
+
* `suggest_followups`. Renderizzate come chip cliccabili sotto la risposta;
|
|
14425
|
+
* click su un chip popola l'input box (non invia automaticamente). */
|
|
14426
|
+
followupQuestionsJson?: string | null;
|
|
14427
|
+
/** Token consumati dalla call Anthropic per questo turn (driver del cerchio cue). */
|
|
14428
|
+
contextUsedTokens?: number | null;
|
|
14429
|
+
/** Context window max del modello al momento del turn (es. 200000 per Haiku). */
|
|
14430
|
+
contextWindowMax?: number | null;
|
|
14431
|
+
}
|
|
14432
|
+
/** Forma deserializzata della proposta. Il client deve gestire SOLO i `kind` che
|
|
14433
|
+
* conosce — futuro-proof: gli sconosciuti vengono mostrati come "azione non
|
|
14434
|
+
* supportata da questa versione del client". */
|
|
14435
|
+
type RagProposedActionKind = 'toolbar_action' | 'row_action' | 'table_style' | 'column_style' | 'display_formula' | 'form_title_formula' | 'default_value_callback' | 'custom_validation' | 'selection_changed' | 'lifecycle_callback' | 'simple_metadata_update'
|
|
14436
|
+
/**
|
|
14437
|
+
* Iniezione di componenti nel canvas del dashboard designer.
|
|
14438
|
+
*
|
|
14439
|
+
* NB: kind CLIENT-ONLY - NON viene applicato dal backend
|
|
14440
|
+
* `RagController.ApplyAction` ma da un handler registrato dal
|
|
14441
|
+
* designer.component via `ChatbotHostRegistryService`. Vedi
|
|
14442
|
+
* docs/pages/_internal/designer-tool-catalog.md per il catalogo
|
|
14443
|
+
* dei tool palette disponibili + constraint.
|
|
14444
|
+
*
|
|
14445
|
+
* Payload: `{ kind, layout: [{tool_name, inputs?, parent_unique_name?, children?}, ...], rationale }`.
|
|
14446
|
+
* Il chatbot popover bypassa `/api/Rag/ApplyAction` quando il
|
|
14447
|
+
* registry ha un handler per questo kind.
|
|
14448
|
+
*/
|
|
14449
|
+
| 'designer_inject'
|
|
14450
|
+
/**
|
|
14451
|
+
* Scrittura di uno snippet SQL in un campo metadata D3 (super-admin).
|
|
14452
|
+
* Campi gated da `Helpers.SqlFragmentMetadataFields`:
|
|
14453
|
+
* `md_join_override`, `mc_custom_select_clause`, `mc_custom_join`,
|
|
14454
|
+
* `mc_computed_formula`, `mc_ui_lookup_computed_dataTextField`.
|
|
14455
|
+
*
|
|
14456
|
+
* Backend-applied via `RagController.ApplySqlMetadataField` con D3 RBAC
|
|
14457
|
+
* gate (`AssertCanWriteSqlFragmentFields`) + audit log su `_error__logs`.
|
|
14458
|
+
* Payload: `{kind, target_table, target_row_key:{route, column_name?},
|
|
14459
|
+
* field_name, sql_snippet, dbms_target, rationale}`.
|
|
14460
|
+
*/
|
|
14461
|
+
| 'sql_metadata_field'
|
|
14462
|
+
/**
|
|
14463
|
+
* Creazione di una nuova riga in `_metadati__colonne` (colonna fisica o
|
|
14464
|
+
* calcolata). Step 1 del workflow per colonne calcolate (step 2 = `sql_metadata_field`
|
|
14465
|
+
* con `mc_computed_formula`). Backend-applied via
|
|
14466
|
+
* `RagController.ApplyMetadataColumnCreate` + audit log `_error__logs`.
|
|
14467
|
+
* Payload: `{kind, route, column_name, display_string, ui_column_type,
|
|
14468
|
+
* is_computed, real_column_name?, rationale}`.
|
|
14469
|
+
*/
|
|
14470
|
+
| 'metadata_column_create';
|
|
14471
|
+
interface RagProposedAction {
|
|
14472
|
+
kind: RagProposedActionKind | string;
|
|
14473
|
+
route?: string;
|
|
14474
|
+
label?: string;
|
|
14475
|
+
icon?: string;
|
|
14476
|
+
callback_js?: string;
|
|
14477
|
+
rationale?: string;
|
|
14478
|
+
/**
|
|
14479
|
+
* Solo per `kind === 'toolbar_action'`. True quando il callback opera sulla
|
|
14480
|
+
* SELEZIONE corrente (bulk delete/archive/export/update via
|
|
14481
|
+
* `datasource.getSelectedRows()`). All'apply, il backend abilita
|
|
14482
|
+
* `md_multiple_selection` sulla route se non gia' attivo (le checkbox di
|
|
14483
|
+
* selezione riga compaiono in UI). Omettere significa false.
|
|
14484
|
+
*/
|
|
14485
|
+
requires_multi_selection?: boolean;
|
|
14486
|
+
[key: string]: any;
|
|
14487
|
+
}
|
|
14488
|
+
/** Payload `POST /api/Rag/ApplyAction`. */
|
|
14489
|
+
interface RagApplyActionRequest {
|
|
14490
|
+
messageId: number;
|
|
14491
|
+
}
|
|
14492
|
+
/** Payload `POST /api/Rag/UpdateProposedAction`. Usato quando l'utente edita
|
|
14493
|
+
* la classe/stile o il callback nell'UI prima del click "Applica" — il
|
|
14494
|
+
* componente invia il payload completo e il backend sovrascrive
|
|
14495
|
+
* `proposed_action_json` (filtri ownership + non-applicata). */
|
|
14496
|
+
interface RagUpdateProposedActionRequest {
|
|
14497
|
+
messageId: number;
|
|
14498
|
+
proposedAction: RagProposedAction;
|
|
14499
|
+
}
|
|
14500
|
+
interface RagUpdateProposedActionResponse {
|
|
14501
|
+
ok: boolean;
|
|
14502
|
+
error?: string;
|
|
14503
|
+
maxBytes?: number;
|
|
14504
|
+
}
|
|
14505
|
+
interface RagApplyActionResponse {
|
|
14506
|
+
ok: boolean;
|
|
14507
|
+
kind?: string;
|
|
14508
|
+
projectMetadataVersion?: string;
|
|
14509
|
+
error?: string;
|
|
14510
|
+
detail?: string;
|
|
14511
|
+
}
|
|
14512
|
+
/** Payload `POST /api/Rag/Compact`. */
|
|
14513
|
+
interface RagCompactRequest {
|
|
14514
|
+
sessionId: number;
|
|
14515
|
+
}
|
|
14516
|
+
interface RagCompactResponse {
|
|
14517
|
+
ok?: boolean;
|
|
14518
|
+
noop?: boolean;
|
|
14519
|
+
summaryUpToMessageId?: number;
|
|
14520
|
+
summaryLength?: number;
|
|
14521
|
+
error?: string;
|
|
14522
|
+
reason?: string;
|
|
14523
|
+
}
|
|
14524
|
+
/** Payload `POST /api/Rag/RenameSession`. */
|
|
14525
|
+
interface RagRenameSessionRequest {
|
|
14526
|
+
sessionId: number;
|
|
14527
|
+
title: string;
|
|
14528
|
+
}
|
|
14529
|
+
interface RagRenameSessionResponse {
|
|
14530
|
+
ok?: boolean;
|
|
14531
|
+
title?: string;
|
|
14532
|
+
error?: string;
|
|
14252
14533
|
}
|
|
14253
14534
|
/** Snapshot history completo (sessione + messaggi ordine cronologico). */
|
|
14254
14535
|
interface RagChatHistorySnapshot {
|
|
@@ -14264,6 +14545,17 @@ interface RagAskRequest {
|
|
|
14264
14545
|
mode?: 'auto' | 'chat' | 'retrieval';
|
|
14265
14546
|
topK?: number;
|
|
14266
14547
|
model?: string;
|
|
14548
|
+
/** Profilo redazione dal toggle UI (strictest-of lato server). */
|
|
14549
|
+
profile?: RagProfile;
|
|
14550
|
+
/**
|
|
14551
|
+
* Contesto della pagina dell'utente (route, tabella metadata, colonne, eventuali
|
|
14552
|
+
* route correlate). Iniettato dal lato client al momento del send: permette
|
|
14553
|
+
* all'LLM di generare snippet che usano i nomi REALI delle colonne (es.
|
|
14554
|
+
* `record.CityName.value`) invece di placeholder generici, e di referenziare
|
|
14555
|
+
* la route effettiva. Niente effetto se vuoto. Costruito da
|
|
14556
|
+
* `WuicRagChatbotComponent.buildRouteContext()`.
|
|
14557
|
+
*/
|
|
14558
|
+
routeContext?: string | null;
|
|
14267
14559
|
}
|
|
14268
14560
|
/** Risposta `POST /api/Rag/Ask` - ritornato SUBITO, prima del completamento. */
|
|
14269
14561
|
interface RagAskAcceptedResponse {
|
|
@@ -14294,11 +14586,13 @@ declare class WuicRagService {
|
|
|
14294
14586
|
query(query: string, options?: {
|
|
14295
14587
|
topK?: number;
|
|
14296
14588
|
useLora?: boolean;
|
|
14589
|
+
profile?: RagProfile;
|
|
14297
14590
|
}): Observable<RagQueryResponse>;
|
|
14298
14591
|
/** Variant Promise di {@link query}. */
|
|
14299
14592
|
queryAsync(query: string, options?: {
|
|
14300
14593
|
topK?: number;
|
|
14301
14594
|
useLora?: boolean;
|
|
14595
|
+
profile?: RagProfile;
|
|
14302
14596
|
}): Promise<RagQueryResponse>;
|
|
14303
14597
|
/**
|
|
14304
14598
|
* Esegue una chat completa (RAG + Claude). Se il server non ha
|
|
@@ -14312,11 +14606,13 @@ declare class WuicRagService {
|
|
|
14312
14606
|
chat(query: string, history?: RagChatTurn[], options?: {
|
|
14313
14607
|
topK?: number;
|
|
14314
14608
|
model?: string;
|
|
14609
|
+
profile?: RagProfile;
|
|
14315
14610
|
}): Observable<RagChatResponse>;
|
|
14316
14611
|
/** Variant Promise di {@link chat}. */
|
|
14317
14612
|
chatAsync(query: string, history?: RagChatTurn[], options?: {
|
|
14318
14613
|
topK?: number;
|
|
14319
14614
|
model?: string;
|
|
14615
|
+
profile?: RagProfile;
|
|
14320
14616
|
}): Promise<RagChatResponse>;
|
|
14321
14617
|
/**
|
|
14322
14618
|
* Stato del server RAG (status, LLM enabled, chunks indicizzati).
|
|
@@ -14380,6 +14676,39 @@ declare class WuicRagService {
|
|
|
14380
14676
|
*/
|
|
14381
14677
|
ask(req: RagAskRequest): Observable<RagAskAcceptedResponse>;
|
|
14382
14678
|
askAsync(req: RagAskRequest): Promise<RagAskAcceptedResponse>;
|
|
14679
|
+
/**
|
|
14680
|
+
* Applica la proposta d'azione precedentemente emessa dall'LLM sul messaggio
|
|
14681
|
+
* indicato. Server-side: re-legge la `proposed_action_json` dal DB (non dal
|
|
14682
|
+
* client: prevenzione tampering del `callback_js`), valida, fa INSERT sul
|
|
14683
|
+
* metadata corrispondente + `InvalidateMetadataCachesAndSetVersion`.
|
|
14684
|
+
*
|
|
14685
|
+
* Gating: solo `isSuperAdmin` (server torna `403 admin-required` in caso).
|
|
14686
|
+
* Esiti tipici (`error`): `not-authenticated` | `admin-required` |
|
|
14687
|
+
* `message-not-found` | `no-proposed-action-on-message` | `already-applied` |
|
|
14688
|
+
* `unsupported-kind: <x>` | `apply-failed`.
|
|
14689
|
+
*/
|
|
14690
|
+
applyProposedAction(req: RagApplyActionRequest): Observable<RagApplyActionResponse>;
|
|
14691
|
+
applyProposedActionAsync(req: RagApplyActionRequest): Promise<RagApplyActionResponse>;
|
|
14692
|
+
/**
|
|
14693
|
+
* Sovrascrive il `proposed_action_json` di un messaggio assistant con il
|
|
14694
|
+
* payload editato dall'utente in UI (campo "Classe/Stile" + textarea callback).
|
|
14695
|
+
* Va chiamato PRIMA di `applyProposedActionAsync` quando l'utente modifica
|
|
14696
|
+
* qualcosa, cosi' che il backend ApplyAction rilegga dal DB il payload giusto.
|
|
14697
|
+
* Filtri di sicurezza nel backend: ownership user_id + non gia' applicata.
|
|
14698
|
+
*/
|
|
14699
|
+
updateProposedAction(req: RagUpdateProposedActionRequest): Observable<RagUpdateProposedActionResponse>;
|
|
14700
|
+
updateProposedActionAsync(req: RagUpdateProposedActionRequest): Promise<RagUpdateProposedActionResponse>;
|
|
14701
|
+
/**
|
|
14702
|
+
* Compatta la sessione: chiama il backend che a sua volta chiama il rag_server
|
|
14703
|
+
* per produrre un summary della history. Persiste su `_rag_chat_sessions`
|
|
14704
|
+
* + avanza `summary_up_to_message_id`. Le future call /Ask passeranno il
|
|
14705
|
+
* summary nel system prompt al posto dei turn coperti.
|
|
14706
|
+
*/
|
|
14707
|
+
compactSession(req: RagCompactRequest): Observable<RagCompactResponse>;
|
|
14708
|
+
compactSessionAsync(req: RagCompactRequest): Promise<RagCompactResponse>;
|
|
14709
|
+
/** Rinomina il titolo di una session (mostrato nella sessions list). */
|
|
14710
|
+
renameSession(req: RagRenameSessionRequest): Observable<RagRenameSessionResponse>;
|
|
14711
|
+
renameSessionAsync(req: RagRenameSessionRequest): Promise<RagRenameSessionResponse>;
|
|
14383
14712
|
/**
|
|
14384
14713
|
* Costruisce l'URL `<api_base>Rag/<action>` rispettando l'eventuale
|
|
14385
14714
|
* `WtoolboxService.appSettings.api_url` configurato lato runtime (stesso
|
|
@@ -14391,6 +14720,147 @@ declare class WuicRagService {
|
|
|
14391
14720
|
static ɵprov: i0.ɵɵInjectableDeclaration<WuicRagService>;
|
|
14392
14721
|
}
|
|
14393
14722
|
|
|
14723
|
+
/**
|
|
14724
|
+
* Esito ritornato da un host action handler. Il chatbot lo mostra come toast
|
|
14725
|
+
* (success se ok=true, error altrimenti). `message` e' opzionale.
|
|
14726
|
+
*/
|
|
14727
|
+
interface ChatbotHostActionResult {
|
|
14728
|
+
ok: boolean;
|
|
14729
|
+
message?: string;
|
|
14730
|
+
}
|
|
14731
|
+
/**
|
|
14732
|
+
* Signature del callback che un componente "host" (es. designer.component)
|
|
14733
|
+
* registra per ricevere le proposed_action_json di kind client-only
|
|
14734
|
+
* (es. 'designer_inject') invece di farle passare dal backend
|
|
14735
|
+
* `/api/Rag/ApplyAction`.
|
|
14736
|
+
*
|
|
14737
|
+
* Il handler DEVE essere async (o ritornare una Promise) cosi' il chatbot
|
|
14738
|
+
* puo' aspettare l'esito prima di marcare il turn come applicato e
|
|
14739
|
+
* mostrare il toast.
|
|
14740
|
+
*/
|
|
14741
|
+
type ChatbotHostActionHandler = (action: RagProposedAction) => Promise<ChatbotHostActionResult>;
|
|
14742
|
+
/**
|
|
14743
|
+
* Singleton (providedIn:'root') che propaga un `ChatbotHostActionHandler`
|
|
14744
|
+
* dal componente host (es. designer.component) al chatbot popover globale
|
|
14745
|
+
* (`<wuic-rag-chatbot-fab>`), evitando il pattern di passare un @Input()
|
|
14746
|
+
* lungo la catena di componenti.
|
|
14747
|
+
*
|
|
14748
|
+
* Pattern d'uso (designer.component.ts):
|
|
14749
|
+
*
|
|
14750
|
+
* ngOnInit() {
|
|
14751
|
+
* this.chatbotHostRegistry.register('designer_inject', this.handleDesignerInject.bind(this));
|
|
14752
|
+
* }
|
|
14753
|
+
* ngOnDestroy() {
|
|
14754
|
+
* this.chatbotHostRegistry.unregister('designer_inject');
|
|
14755
|
+
* }
|
|
14756
|
+
*
|
|
14757
|
+
* Lato chatbot (rag-chatbot.component.ts), in onApplyActionToTurn():
|
|
14758
|
+
*
|
|
14759
|
+
* const action = turn.proposedAction;
|
|
14760
|
+
* const hostHandler = this.chatbotHostRegistry.get(action.kind);
|
|
14761
|
+
* if (hostHandler) {
|
|
14762
|
+
* // bypass backend - applica client-only
|
|
14763
|
+
* const result = await hostHandler(action);
|
|
14764
|
+
* ...
|
|
14765
|
+
* } else {
|
|
14766
|
+
* // backend apply standard
|
|
14767
|
+
* ...
|
|
14768
|
+
* }
|
|
14769
|
+
*
|
|
14770
|
+
* Registry per-kind: piu' kind possono avere handler distinti
|
|
14771
|
+
* registrati da componenti diversi. Quando l'host viene distrutto,
|
|
14772
|
+
* deve sempre fare unregister(kind) per evitare leak (es. handler
|
|
14773
|
+
* che cattura una vecchia istanza componente non piu' nel DOM).
|
|
14774
|
+
*/
|
|
14775
|
+
/**
|
|
14776
|
+
* Signature del callback che fornisce uno snapshot testuale (compact tree)
|
|
14777
|
+
* dello state corrente dell'host, da iniettare nel `route_context` del LLM.
|
|
14778
|
+
*
|
|
14779
|
+
* Esempio dump del designer:
|
|
14780
|
+
* TABLE__123 (rows=2, cols=2)
|
|
14781
|
+
* TR__124
|
|
14782
|
+
* TD__125 (top-left)
|
|
14783
|
+
* TD__126 (top-right)
|
|
14784
|
+
* TR__127
|
|
14785
|
+
* TD__128 (bottom-left)
|
|
14786
|
+
* TD__129 (bottom-right)
|
|
14787
|
+
*
|
|
14788
|
+
* Ritornare `null` se lo state non e' rilevante per questo turn (es.
|
|
14789
|
+
* canvas vuoto), cosi' il chatbot non spreca token nel system prompt.
|
|
14790
|
+
*/
|
|
14791
|
+
type ChatbotHostStateProvider = () => string | null;
|
|
14792
|
+
declare class ChatbotHostRegistryService {
|
|
14793
|
+
private readonly handlers;
|
|
14794
|
+
private readonly stateProviders;
|
|
14795
|
+
/**
|
|
14796
|
+
* Registra (o sostituisce) il handler per un dato `kind`. L'ultima
|
|
14797
|
+
* registrazione vince - utile per scenari edge in cui due viste
|
|
14798
|
+
* concorrenti gestiscono lo stesso kind (raro, ma documentato).
|
|
14799
|
+
*/
|
|
14800
|
+
register(kind: string, handler: ChatbotHostActionHandler): void;
|
|
14801
|
+
/**
|
|
14802
|
+
* Rimuove il handler per un dato `kind`. No-op se non registrato.
|
|
14803
|
+
* Da chiamare in ngOnDestroy dell'host per evitare retain.
|
|
14804
|
+
*/
|
|
14805
|
+
unregister(kind: string): void;
|
|
14806
|
+
/**
|
|
14807
|
+
* Restituisce il handler registrato per `kind`, o `null` se nessuno
|
|
14808
|
+
* lo gestisce client-side. Il chatbot usa questo per decidere se
|
|
14809
|
+
* bypassare il backend o no.
|
|
14810
|
+
*/
|
|
14811
|
+
get(kind: string): ChatbotHostActionHandler | null;
|
|
14812
|
+
/**
|
|
14813
|
+
* Helper diagnostico: lista tutti i kind attualmente registrati.
|
|
14814
|
+
* Usato dai test e dal debug panel.
|
|
14815
|
+
*/
|
|
14816
|
+
registeredKinds(): string[];
|
|
14817
|
+
/**
|
|
14818
|
+
* Registra (o sostituisce) un state provider per un dato `kind`.
|
|
14819
|
+
* Il provider verra' chiamato dal chatbot in `buildRouteContext()` per
|
|
14820
|
+
* arricchire il system prompt del LLM con lo state corrente dell'host
|
|
14821
|
+
* (es. designer.dashboardElements serializzati come tree compatto).
|
|
14822
|
+
*
|
|
14823
|
+
* Esempio (designer.component):
|
|
14824
|
+
* this.chatbotHostRegistry.registerStateProvider(
|
|
14825
|
+
* 'designer_inject',
|
|
14826
|
+
* () => this.buildCompactStateDump()
|
|
14827
|
+
* );
|
|
14828
|
+
*/
|
|
14829
|
+
registerStateProvider(kind: string, provider: ChatbotHostStateProvider): void;
|
|
14830
|
+
/**
|
|
14831
|
+
* Rimuove il state provider. Da chiamare in ngOnDestroy.
|
|
14832
|
+
*/
|
|
14833
|
+
unregisterStateProvider(kind: string): void;
|
|
14834
|
+
/**
|
|
14835
|
+
* Invoca il state provider registrato per `kind` e ritorna il dump.
|
|
14836
|
+
* Se non registrato, ritorna `null`. Errori nel provider sono
|
|
14837
|
+
* swallowed e logged (best-effort: il chatbot deve sempre funzionare
|
|
14838
|
+
* anche se l'host crasha durante il dump).
|
|
14839
|
+
*/
|
|
14840
|
+
getStateDump(kind: string): string | null;
|
|
14841
|
+
/**
|
|
14842
|
+
* Helper diagnostico: lista tutti i kind con state provider attivo.
|
|
14843
|
+
*/
|
|
14844
|
+
registeredStateKinds(): string[];
|
|
14845
|
+
/**
|
|
14846
|
+
* Invoca SYNC tutti gli state provider registrati ignorandone il risultato.
|
|
14847
|
+
*
|
|
14848
|
+
* Scopo: dare ai provider la possibilita' di triggerare i loro fetch lazy
|
|
14849
|
+
* (es. il designer prefetcha `getAvailableRoutes` solo quando lo state
|
|
14850
|
+
* provider viene invocato — altrimenti spreca chiamate al mount). Chiamato
|
|
14851
|
+
* dal chatbot in ngOnInit: la finestra "apertura chatbot" → "primo prompt
|
|
14852
|
+
* inviato" e' di almeno 1-2 secondi (l'utente deve digitare), tempo
|
|
14853
|
+
* sufficiente perche' la cache sia pronta al primo Ask. Senza warm-up,
|
|
14854
|
+
* il primo prompt vedrebbe state dump 'caricamento' e il LLM
|
|
14855
|
+
* potrebbe hallucinare nomi alternativi inventati.
|
|
14856
|
+
*
|
|
14857
|
+
* Errori dei provider vengono swallowed (lo stesso pattern di getStateDump).
|
|
14858
|
+
*/
|
|
14859
|
+
warmUpAllStateProviders(): void;
|
|
14860
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotHostRegistryService, never>;
|
|
14861
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ChatbotHostRegistryService>;
|
|
14862
|
+
}
|
|
14863
|
+
|
|
14394
14864
|
/**
|
|
14395
14865
|
* Singolo turno della conversazione visualizzato nel chatbot.
|
|
14396
14866
|
*
|
|
@@ -14412,6 +14882,51 @@ interface RagChatbotTurn {
|
|
|
14412
14882
|
tokensOut?: number | null;
|
|
14413
14883
|
/** GUID di correlazione (usato per match notifica completion). */
|
|
14414
14884
|
correlationId?: string;
|
|
14885
|
+
/** Proposta d'azione emessa dall'LLM via tool-use, gia' parsata da JSON.
|
|
14886
|
+
* Null = nessuna proposta (risposta solo testo). */
|
|
14887
|
+
proposedAction?: RagProposedAction | null;
|
|
14888
|
+
/** Timestamp ISO dell'applicazione (audit). Null = mai applicata. */
|
|
14889
|
+
proposedActionAppliedAt?: string | null;
|
|
14890
|
+
/** Flag UI: true mentre il bottone "Applica" e' in flight (loading). */
|
|
14891
|
+
applyingAction?: boolean;
|
|
14892
|
+
/** Errore ultimo apply (UI feedback). */
|
|
14893
|
+
applyError?: string | null;
|
|
14894
|
+
/**
|
|
14895
|
+
* Lista di follow-up question parsate dal `followupQuestionsJson` del messaggio.
|
|
14896
|
+
* Renderizzata come chip cliccabili sotto la risposta assistant. Null/empty =
|
|
14897
|
+
* niente chip mostrate.
|
|
14898
|
+
*/
|
|
14899
|
+
followupQuestions?: string[] | null;
|
|
14900
|
+
/**
|
|
14901
|
+
* Toggle textarea (default) <-> Monaco editor per il `callback_js` proposto.
|
|
14902
|
+
* Pattern identico a `<lib-code-area-editor>` (vedi
|
|
14903
|
+
* `field/code-area-editor/code-area-editor.component.ts`): di default mostra
|
|
14904
|
+
* una `<textarea>` leggera (niente chunk Monaco scaricato, niente flash nero),
|
|
14905
|
+
* con click su "Apri editor avanzato" si commuta e il `@defer (when ...)`
|
|
14906
|
+
* carica `<wuic-code-editor-lazy>` on-demand.
|
|
14907
|
+
*/
|
|
14908
|
+
editorMode?: boolean;
|
|
14909
|
+
/**
|
|
14910
|
+
* True quando l'utente ha editato un campo della `proposedAction` in UI
|
|
14911
|
+
* (classe/stile o body del callback). Triggera la pre-flight
|
|
14912
|
+
* `updateProposedActionAsync` prima di `applyProposedActionAsync` cosi' il
|
|
14913
|
+
* backend rilegge dal DB il payload aggiornato (vedi commento sicurezza in
|
|
14914
|
+
* RagController.ApplyAction). Resettato a false dopo il PATCH riuscito.
|
|
14915
|
+
*/
|
|
14916
|
+
proposedActionDirty?: boolean;
|
|
14917
|
+
}
|
|
14918
|
+
/**
|
|
14919
|
+
* Descrittore di un campo NON-body della proposta editabile dall'utente
|
|
14920
|
+
* sopra la textarea del callback (es. classe/stile per `table_style`, label
|
|
14921
|
+
* per `toolbar_action`). `fieldName` e' la chiave dentro `RagProposedAction`
|
|
14922
|
+
* su cui scrivere. `isInlineStyle` (solo per `css_class`) indica che il valore
|
|
14923
|
+
* UI mostra la parte dopo il prefisso `style:` — il setter ri-prepende.
|
|
14924
|
+
*/
|
|
14925
|
+
interface RagProposedActionExtraField {
|
|
14926
|
+
label: string;
|
|
14927
|
+
fieldName: string;
|
|
14928
|
+
value: string;
|
|
14929
|
+
isInlineStyle?: boolean;
|
|
14415
14930
|
}
|
|
14416
14931
|
/**
|
|
14417
14932
|
* Componente standalone che espone una chat sopra il RAG del codebase WUIC.
|
|
@@ -14436,9 +14951,11 @@ interface RagChatbotTurn {
|
|
|
14436
14951
|
declare class WuicRagChatbotComponent implements OnInit, OnDestroy {
|
|
14437
14952
|
private readonly ragService;
|
|
14438
14953
|
private readonly cdr;
|
|
14954
|
+
private readonly chatbotHostRegistry;
|
|
14439
14955
|
private readonly route?;
|
|
14440
14956
|
private readonly router?;
|
|
14441
14957
|
private readonly notificationRT?;
|
|
14958
|
+
private readonly metaSrv?;
|
|
14442
14959
|
/** Titolo mostrato nell'header del chatbot. */
|
|
14443
14960
|
title: string;
|
|
14444
14961
|
/** Modalita' operativa: vedi nota nella classDoc. */
|
|
@@ -14451,12 +14968,52 @@ declare class WuicRagChatbotComponent implements OnInit, OnDestroy {
|
|
|
14451
14968
|
maxHistory: number;
|
|
14452
14969
|
/** Placeholder dell'input. */
|
|
14453
14970
|
placeholder: string;
|
|
14454
|
-
/** Modello
|
|
14971
|
+
/** Modello LLM in modalita' chat. Vuoto (default) = usa il model configurato lato
|
|
14972
|
+
* backend (`rag-llm-default-chat-model`), provider-appropriate. Non hardcodare un
|
|
14973
|
+
* model Anthropic: su provider openrouter/openai manderebbe un ID invalido (HTTP 400
|
|
14974
|
+
* -> retrieval-only). Valorizzare solo per forzare un model specifico. */
|
|
14455
14975
|
model: string;
|
|
14456
14976
|
/** Altezza fissa dell'area chat in CSS units (default `420px`). */
|
|
14457
14977
|
chatHeight: string;
|
|
14458
14978
|
/** Mostra il bottone "Svuota cronologia" nell'header. */
|
|
14459
14979
|
showClearButton: boolean;
|
|
14980
|
+
/**
|
|
14981
|
+
* Persiste l'id della sessione corrente in `localStorage` e lo ripristina al
|
|
14982
|
+
* boot del componente (es. refresh della pagina) quando NON arriva un
|
|
14983
|
+
* `?sessionId` dalla route. La cronologia completa viene poi ricaricata dal DB
|
|
14984
|
+
* via `/api/Rag/History` (che ritorna TUTTI i messaggi della sessione, non un
|
|
14985
|
+
* sottoinsieme) -> il refresh non svuota piu' la chat. Default true.
|
|
14986
|
+
*/
|
|
14987
|
+
persistSession: boolean;
|
|
14988
|
+
/**
|
|
14989
|
+
* Se `true` (default), prima di ogni `Ask` il componente costruisce un
|
|
14990
|
+
* **route context** sintetico (route corrente + tabella metadata + colonne)
|
|
14991
|
+
* dal `MetadataProviderService` e lo invia al rag_server come `routeContext`
|
|
14992
|
+
* nel payload. Il server lo inietta nel system prompt dell'LLM cosi' che le
|
|
14993
|
+
* risposte usino i NOMI REALI delle colonne della pagina corrente invece di
|
|
14994
|
+
* placeholder generici.
|
|
14995
|
+
*
|
|
14996
|
+
* Disabilitare a `false` per la route full-page `/rag-chatbot` (il chatbot
|
|
14997
|
+
* stesso non e' una "business route" — niente context utile da iniettare) o
|
|
14998
|
+
* per UI di privacy avanzata.
|
|
14999
|
+
*/
|
|
15000
|
+
sendRouteContext: boolean;
|
|
15001
|
+
/** Chiave `localStorage` dell'ultima sessione (scoped per browser). */
|
|
15002
|
+
private static readonly LAST_SESSION_KEY;
|
|
15003
|
+
/**
|
|
15004
|
+
* Mostra il toggle "Vista Dev / Vista Cliente" nell'header (default OFF).
|
|
15005
|
+
* Da abilitare SOLO nelle pagine dev/demo: la chat spedita al cliente NON
|
|
15006
|
+
* deve esporlo. E' comunque leak-safe (il server applica strictest-of: il
|
|
15007
|
+
* toggle puo' solo aumentare la redazione, mai diminuirla).
|
|
15008
|
+
*/
|
|
15009
|
+
allowProfileToggle: boolean;
|
|
15010
|
+
/**
|
|
15011
|
+
* Profilo di redazione corrente scelto dal toggle UI.
|
|
15012
|
+
* - 'internal' = Vista Dev (full source);
|
|
15013
|
+
* - 'release' = Vista Cliente (firme + niente skill, come on-prem).
|
|
15014
|
+
* Inviato al server solo se {@link allowProfileToggle} e' true.
|
|
15015
|
+
*/
|
|
15016
|
+
profileOverride: RagProfile;
|
|
14460
15017
|
/** Emette quando l'utente clicca su un source chip. */
|
|
14461
15018
|
resultSelected: EventEmitter<RagSource>;
|
|
14462
15019
|
/** Emette in caso di errore HTTP non recuperabile. */
|
|
@@ -14488,6 +15045,35 @@ declare class WuicRagChatbotComponent implements OnInit, OnDestroy {
|
|
|
14488
15045
|
private processedNotificationIds;
|
|
14489
15046
|
/** Sub a notificationRT.notifications$ + ActivatedRoute.queryParams. */
|
|
14490
15047
|
private subs;
|
|
15048
|
+
/**
|
|
15049
|
+
* Context window usage del modello corrente (ultima stima dal backend, 0-100%).
|
|
15050
|
+
* Aggiornato a ogni completion. Driver del cerchio colorato in header:
|
|
15051
|
+
* verde <60% / giallo 60-80% / arancione 80-90% / rosso >90%.
|
|
15052
|
+
*/
|
|
15053
|
+
contextUsagePercent: number;
|
|
15054
|
+
/** Token usati (dall'ultima call) / context window max. Mostrati in tooltip. */
|
|
15055
|
+
contextUsedTokens: number | null;
|
|
15056
|
+
contextWindowMax: number | null;
|
|
15057
|
+
/** True quando il dialog "context-overflow" e' aperto: l'ultima call ha
|
|
15058
|
+
* fallito perche' la history sfora il context. UX: 2 bottoni (Compatta / Nuova). */
|
|
15059
|
+
contextOverflowDialogOpen: boolean;
|
|
15060
|
+
/** True mentre il /compact e' in-flight (loading nel bottone). */
|
|
15061
|
+
compactingSession: boolean;
|
|
15062
|
+
/**
|
|
15063
|
+
* True per tutto il flow `onClearHistory`: apertura prompt di conferma
|
|
15064
|
+
* (PrimeNG Dialog lazy-load, ~300-800ms al primo click) + DELETE backend +
|
|
15065
|
+
* reset stato locale. Driver dello spinner sul bottone cestino in header.
|
|
15066
|
+
* Re-entry guard: blocca click multipli mentre il flow e' in corso.
|
|
15067
|
+
*/
|
|
15068
|
+
clearingHistory: boolean;
|
|
15069
|
+
/** True quando il dialog "Sessioni" e' aperto. Lazy-load lista al toggle. */
|
|
15070
|
+
sessionsDialogOpen: boolean;
|
|
15071
|
+
sessionsList: RagChatSessionDto[];
|
|
15072
|
+
sessionsLoading: boolean;
|
|
15073
|
+
/** Map sessionId -> bool: true se quella riga e' in modalita' rinomina. */
|
|
15074
|
+
sessionRenameEditing: Record<number, boolean>;
|
|
15075
|
+
/** Map sessionId -> string: valore temporaneo del titolo durante l'edit inline. */
|
|
15076
|
+
sessionRenameDraft: Record<number, string>;
|
|
14491
15077
|
/**
|
|
14492
15078
|
* Source selezionato per il dialog preview. Null = dialog chiuso.
|
|
14493
15079
|
* Il dialog mostra SOLO lo snippet embedded in RagSource (max 500 char dal
|
|
@@ -14497,7 +15083,7 @@ declare class WuicRagChatbotComponent implements OnInit, OnDestroy {
|
|
|
14497
15083
|
selectedSource: RagSource | null;
|
|
14498
15084
|
inputTextarea?: ElementRef<HTMLTextAreaElement>;
|
|
14499
15085
|
scrollContainer?: ElementRef<HTMLElement>;
|
|
14500
|
-
constructor(ragService: WuicRagService, cdr: ChangeDetectorRef, route?: ActivatedRoute, router?: Router, notificationRT?: NotificationRealtimeService);
|
|
15086
|
+
constructor(ragService: WuicRagService, cdr: ChangeDetectorRef, chatbotHostRegistry: ChatbotHostRegistryService, route?: ActivatedRoute, router?: Router, notificationRT?: NotificationRealtimeService, metaSrv?: MetadataProviderService);
|
|
14501
15087
|
ngOnInit(): void;
|
|
14502
15088
|
ngOnDestroy(): void;
|
|
14503
15089
|
get effectiveMode(): 'rag-llm' | 'retrieval-only';
|
|
@@ -14505,6 +15091,14 @@ declare class WuicRagChatbotComponent implements OnInit, OnDestroy {
|
|
|
14505
15091
|
get modeBadgeSeverity(): 'success' | 'info' | 'warn' | 'danger';
|
|
14506
15092
|
/** Disabilita il send button SOLO durante la chiamata Ask (~200ms), NON durante il pending. */
|
|
14507
15093
|
get sendDisabled(): boolean;
|
|
15094
|
+
/** Label del toggle profilo. */
|
|
15095
|
+
get profileToggleLabel(): string;
|
|
15096
|
+
/**
|
|
15097
|
+
* Flippa il profilo di redazione (Dev <-> Cliente). Le risposte gia' in
|
|
15098
|
+
* cronologia restano com'erano (il profilo e' per-richiesta); i prossimi
|
|
15099
|
+
* invii usano il nuovo profilo.
|
|
15100
|
+
*/
|
|
15101
|
+
toggleProfile(): void;
|
|
14508
15102
|
/**
|
|
14509
15103
|
* Invia il prompt corrente via flow async:
|
|
14510
15104
|
* 1. Append turno user (placeholder, sara' ricevuto messageId nell'ack);
|
|
@@ -14517,6 +15111,13 @@ declare class WuicRagChatbotComponent implements OnInit, OnDestroy {
|
|
|
14517
15111
|
/**
|
|
14518
15112
|
* Svuota la cronologia chat (soft-delete della sessione corrente sul DB) +
|
|
14519
15113
|
* reset stato locale.
|
|
15114
|
+
*
|
|
15115
|
+
* Il flag `clearingHistory` resta `true` per tutto il flow (dall'apertura
|
|
15116
|
+
* del dialog di conferma fino al completamento DELETE+reset). Driver dello
|
|
15117
|
+
* spinner sul bottone cestino in header — necessario perche' il PRIMO click
|
|
15118
|
+
* subisce ~300-800ms di lazy-load del bundle PrimeNG Dialog
|
|
15119
|
+
* (`promptDialog` apre un `p-dialog` dinamico, non gia' istanziato). Senza
|
|
15120
|
+
* feedback l'utente cliccava 2-3 volte pensando che non rispondesse.
|
|
14520
15121
|
*/
|
|
14521
15122
|
onClearHistory(): Promise<void>;
|
|
14522
15123
|
/**
|
|
@@ -14630,12 +15231,219 @@ declare class WuicRagChatbotComponent implements OnInit, OnDestroy {
|
|
|
14630
15231
|
private dtoToTurn;
|
|
14631
15232
|
private applyMessageToTurn;
|
|
14632
15233
|
private scrollToMessage;
|
|
15234
|
+
/**
|
|
15235
|
+
* Persiste (o cancella se id null) l'ultima sessione in localStorage.
|
|
15236
|
+
* Best-effort: guard SSR + try/catch (private-mode / quota / storage disabled).
|
|
15237
|
+
*/
|
|
15238
|
+
private saveLastSession;
|
|
15239
|
+
/** Legge l'ultima sessione salvata (>0) o null. */
|
|
15240
|
+
private readLastSession;
|
|
15241
|
+
/** Parse JSON del field `proposed_action_json` -> oggetto tipato (o null). */
|
|
15242
|
+
private parseProposedAction;
|
|
15243
|
+
/** Parse JSON del field `followup_questions_json` -> array di stringhe (o null). */
|
|
15244
|
+
private parseFollowupQuestions;
|
|
15245
|
+
/**
|
|
15246
|
+
* Click su un chip follow-up: popola l'input box con la domanda (NON invia
|
|
15247
|
+
* automaticamente; l'utente puo' editare prima di premere invio). Coerente
|
|
15248
|
+
* con la scelta UX di non lanciare query "per sbaglio".
|
|
15249
|
+
*/
|
|
15250
|
+
applyFollowup(question: string): void;
|
|
15251
|
+
/** Aggiorna lo stato del cerchio cue dato (usedTokens, windowMax). */
|
|
15252
|
+
private updateContextCue;
|
|
15253
|
+
/** Colore del cerchio basato sul `contextUsagePercent`. */
|
|
15254
|
+
get contextCueColor(): string;
|
|
15255
|
+
get contextCueTooltip(): string;
|
|
15256
|
+
/**
|
|
15257
|
+
* Click sul cerchio context cue: conferma + lancia /compact. Disponibile sempre
|
|
15258
|
+
* (anche <60%): l'utente puo' compattare on-demand.
|
|
15259
|
+
*/
|
|
15260
|
+
onContextCueClick(): Promise<void>;
|
|
15261
|
+
/**
|
|
15262
|
+
* Chiama l'endpoint /api/Rag/Compact. Aggiorna lo stato dopo successo.
|
|
15263
|
+
* Riusato da: contextCue click, slash-command /compact, dialog overflow "Compatta ora".
|
|
15264
|
+
*/
|
|
15265
|
+
doCompactSession(): Promise<void>;
|
|
15266
|
+
/**
|
|
15267
|
+
* Nuova sessione: chiude la corrente (clear localStorage), resetta history, ricomincia.
|
|
15268
|
+
* Chiamato dal bottone "Nuova sessione" del dialog overflow.
|
|
15269
|
+
*/
|
|
15270
|
+
startNewSession(): void;
|
|
15271
|
+
openSessionsDialog(): Promise<void>;
|
|
15272
|
+
closeSessionsDialog(): void;
|
|
15273
|
+
/** Switch alla session selezionata (carica history). */
|
|
15274
|
+
selectSession(s: RagChatSessionDto): Promise<void>;
|
|
15275
|
+
/** Apre l'edit inline del titolo. */
|
|
15276
|
+
startRenameSession(s: RagChatSessionDto, event?: Event): void;
|
|
15277
|
+
confirmRenameSession(s: RagChatSessionDto, event?: Event): Promise<void>;
|
|
15278
|
+
cancelRenameSession(s: RagChatSessionDto): void;
|
|
15279
|
+
/**
|
|
15280
|
+
* Cancella una sessione dalla cronologia (chiamato dall'icona cestino
|
|
15281
|
+
* sulla riga della lista sessioni). Confirm via WtoolboxService.promptDialog
|
|
15282
|
+
* (regola 12 AGENTS: mai window.confirm). Backend soft-delete via
|
|
15283
|
+
* POST /api/Rag/DeleteSession (gia' esistente).
|
|
15284
|
+
*
|
|
15285
|
+
* Se la sessione cancellata e' quella CORRENTE: clear della view (history
|
|
15286
|
+
* + currentSessionId reset) e remove da localStorage. Se non corrente:
|
|
15287
|
+
* solo splice dalla lista locale senza toccare la chat aperta.
|
|
15288
|
+
*
|
|
15289
|
+
* Best-effort: errori backend swallowed (la lista si refresha al prossimo
|
|
15290
|
+
* open del dialog comunque, e l'utente puo' riprovare).
|
|
15291
|
+
*/
|
|
15292
|
+
onDeleteSessionFromList(s: RagChatSessionDto, event?: Event): Promise<void>;
|
|
15293
|
+
/** Truncate del primo prompt a 100 char per anteprima list (full su tooltip). */
|
|
15294
|
+
sessionPreview(s: RagChatSessionDto): string;
|
|
15295
|
+
/** Formato data sessione (locale). */
|
|
15296
|
+
sessionDate(s: RagChatSessionDto): string;
|
|
15297
|
+
/** Label umana per il bottone/header in base al `kind`. */
|
|
15298
|
+
proposedActionTitle(a: RagProposedAction | null | undefined): string;
|
|
15299
|
+
/**
|
|
15300
|
+
* Estrae il body del code/template della proposta indipendentemente dal kind:
|
|
15301
|
+
* - toolbar_action / row_action / default_value / custom_validation /
|
|
15302
|
+
* selection_changed / lifecycle / form_title → `callback_js` / `formula_js`
|
|
15303
|
+
* - table_style / column_style → `condition_js`
|
|
15304
|
+
* - display_formula → `template_html` (Angular markup)
|
|
15305
|
+
* o `formula_js` (legacy backward-compat)
|
|
15306
|
+
* - sql_metadata_field → `sql_snippet` (SQL fragment)
|
|
15307
|
+
* Ritorna stringa vuota se nessun campo body e' presente.
|
|
15308
|
+
*/
|
|
15309
|
+
proposedActionJsBody(a: RagProposedAction | null | undefined): string;
|
|
15310
|
+
/**
|
|
15311
|
+
* Campi NON-body della proposta che e' utile mostrare all'utente accanto
|
|
15312
|
+
* al codice (es. per `table_style` la classe CSS o l'inline-style che verra'
|
|
15313
|
+
* applicato alla `<tr>` quando il callback ritorna true; per `toolbar_action`
|
|
15314
|
+
* la label del bottone; per `sql_metadata_field` il field target). Per ogni
|
|
15315
|
+
* kind ritorna 0..N coppie `{label, value}`. Il template li renderizza in
|
|
15316
|
+
* lettura sopra la textarea del body. Mantenere allineato alla definizione
|
|
15317
|
+
* tool in `rag_tools.json`: quando si aggiunge un campo importante a un kind
|
|
15318
|
+
* (es. `inline_style` su `propose_table_style`), aggiungerlo anche qui per
|
|
15319
|
+
* non far perdere visibilita' all'utente sulla decisione del LLM.
|
|
15320
|
+
*/
|
|
15321
|
+
proposedActionExtraFields(a: RagProposedAction | null | undefined): Array<RagProposedActionExtraField>;
|
|
15322
|
+
/**
|
|
15323
|
+
* Nome del campo nella `RagProposedAction` che porta il body editabile della
|
|
15324
|
+
* textarea (callback / template / sql snippet). Speculare a
|
|
15325
|
+
* `proposedActionJsBody` ma ritorna l'identificatore del field, cosi' il
|
|
15326
|
+
* `(ngModelChange)` puo' scrivere su `a[name]`. Default `callback_js` per i
|
|
15327
|
+
* kind che non hanno un body editabile (no-op all'edit).
|
|
15328
|
+
*/
|
|
15329
|
+
proposedActionJsBodyFieldName(a: RagProposedAction | null | undefined): string;
|
|
15330
|
+
/**
|
|
15331
|
+
* Setter chiamato da `(ngModelChange)` su un campo extra (es. classe/stile).
|
|
15332
|
+
* Per `css_class` con `isInlineStyle=true` ri-prepende il prefisso `style:`
|
|
15333
|
+
* cosi' la convenzione persistita resta omogenea (vedi
|
|
15334
|
+
* `dynamic-template.component.ts:getTableInlineStyle`). Segna il turno come
|
|
15335
|
+
* `proposedActionDirty=true` cosi' `onApplyAction` chiama il PATCH backend
|
|
15336
|
+
* prima dell'Apply.
|
|
15337
|
+
*/
|
|
15338
|
+
onProposedExtraFieldEdit(turn: RagChatbotTurn, extra: RagProposedActionExtraField, newValue: string): void;
|
|
15339
|
+
/**
|
|
15340
|
+
* Setter per la textarea del body (callback_js / condition_js / template_html
|
|
15341
|
+
* / formula_js / sql_snippet). Aggiorna il field corretto in base al kind.
|
|
15342
|
+
*/
|
|
15343
|
+
onProposedBodyEdit(turn: RagChatbotTurn, newValue: string): void;
|
|
15344
|
+
/**
|
|
15345
|
+
* Stessa `codeContext` che il metadata-editor usa per editare il callback
|
|
15346
|
+
* sullo stesso campo metadata. Permette al Monaco TS provider di applicare
|
|
15347
|
+
* autocomplete + type-check come se l'utente stesse editando in metadata-editor.
|
|
15348
|
+
* Centralizzato qui per kind: future aggiunte = entry nella map.
|
|
15349
|
+
*/
|
|
15350
|
+
proposedActionCodeContext(a: RagProposedAction | null | undefined): string;
|
|
15351
|
+
/**
|
|
15352
|
+
* Cache field+record sintetici per `<wuic-code-editor>` indicizzata per messageId.
|
|
15353
|
+
* MOTIVATION: il code-editor accetta `field: MetadatiColonna` e
|
|
15354
|
+
* `record: { [k]: BehaviorSubject<any> }`; ricostruirli ad ogni ciclo di CD
|
|
15355
|
+
* causerebbe re-init pesanti del Monaco (riload types, ecc). Cache stabile per
|
|
15356
|
+
* messageId -> stesse referenze -> niente re-init.
|
|
15357
|
+
*/
|
|
15358
|
+
private proposedActionEditorCache;
|
|
15359
|
+
/**
|
|
15360
|
+
* Costruisce (o riusa cached) il `MetadatiColonna` sintetico da passare al
|
|
15361
|
+
* `<wuic-code-editor>` per il box proposta. Inietta il `codeContext` corretto
|
|
15362
|
+
* per il `kind` cosi' il TSProvider Monaco applica autocomplete come nel
|
|
15363
|
+
* metadata-editor stesso. L'editor e' EDITABILE (readOnly:false): le modifiche
|
|
15364
|
+
* vengono propagate a `turn.proposedAction[bodyFieldName]` tramite subscription
|
|
15365
|
+
* al BehaviorSubject del record, e segnano il turno come dirty cosi'
|
|
15366
|
+
* `onApplyAction` chiama il PATCH backend prima dell'Apply.
|
|
15367
|
+
*/
|
|
15368
|
+
getProposedActionField(turn: RagChatbotTurn): MetadatiColonna;
|
|
15369
|
+
/** Compagno di `getProposedActionField`: ritorna lo stesso `record` cached. */
|
|
15370
|
+
getProposedActionRecord(turn: RagChatbotTurn): {
|
|
15371
|
+
[key: string]: BehaviorSubject<any>;
|
|
15372
|
+
};
|
|
15373
|
+
/**
|
|
15374
|
+
* Toggle textarea (default) <-> Monaco editor avanzato per il callback proposto.
|
|
15375
|
+
* Pattern `<lib-code-area-editor>`: textarea istantanea, Monaco on-demand via
|
|
15376
|
+
* `@defer (when turn.editorMode)`. Entrando in Monaco ri-sincronizza il
|
|
15377
|
+
* BehaviorSubject del record cached col valore corrente di `proposedAction`
|
|
15378
|
+
* (potrebbe essere stato editato dalla textarea nel frattempo, vedi
|
|
15379
|
+
* `onProposedBodyEdit`).
|
|
15380
|
+
*/
|
|
15381
|
+
toggleEditorMode(turn: RagChatbotTurn): void;
|
|
15382
|
+
/** True se il turn ha una proposta non ancora applicata (mostra "Applica"). */
|
|
15383
|
+
canApplyAction(turn: RagChatbotTurn): boolean;
|
|
15384
|
+
/**
|
|
15385
|
+
* Bottone "Applica": chiama POST /api/Rag/ApplyAction con conferma. Il server
|
|
15386
|
+
* re-legge la proposta dal DB (anti-tampering del callback_js), checka admin,
|
|
15387
|
+
* INSERT su metadata, InvalidateMetadataCachesAndSetVersion. La proposta viene
|
|
15388
|
+
* marcata come applicata in DB.
|
|
15389
|
+
*/
|
|
15390
|
+
onApplyAction(turn: RagChatbotTurn): Promise<void>;
|
|
14633
15391
|
private trimHistory;
|
|
15392
|
+
/**
|
|
15393
|
+
* Costruisce un riepilogo testuale della pagina/route corrente che viene
|
|
15394
|
+
* iniettato nel system prompt dell'LLM. Permette di generare snippet che
|
|
15395
|
+
* usano i nomi REALI delle colonne (es. `record.CityName.value`) invece di
|
|
15396
|
+
* placeholder generici.
|
|
15397
|
+
*
|
|
15398
|
+
* Formato (compatto, leggibile dall'LLM):
|
|
15399
|
+
* ```
|
|
15400
|
+
* Route corrente: cities
|
|
15401
|
+
* Tabella: Cities (md_id=42, mdtablename=Cities)
|
|
15402
|
+
* Colonne:
|
|
15403
|
+
* - CityName: type=text, required=yes (real column: CityName)
|
|
15404
|
+
* - StateProvince: type=lookupByID -> StateProvinces
|
|
15405
|
+
* - Location: type=text
|
|
15406
|
+
* - LatestRecordedPopulation: type=number
|
|
15407
|
+
* - btn_send: type=button (row action)
|
|
15408
|
+
* ```
|
|
15409
|
+
*
|
|
15410
|
+
* Ritorna `null` se: router assente, route non resolvibile, route NON e'
|
|
15411
|
+
* una business route (framework-docs/rag-chatbot/auth), o metadata
|
|
15412
|
+
* non disponibile in cache (l'utente probabilmente non e' su una list/edit
|
|
15413
|
+
* della route).
|
|
15414
|
+
*/
|
|
15415
|
+
private buildRouteContext;
|
|
15416
|
+
/**
|
|
15417
|
+
* Contesto MINIMALE della pagina: SOLO la route/pagina corrente (es. `cities/list`,
|
|
15418
|
+
* `cities/edit`, `designer`). I dettagli di metadata (elenco colonne reali, identita'
|
|
15419
|
+
* SQL schema/tabella, alias di join dei lookup) NON sono inlineati: il LLM li recupera
|
|
15420
|
+
* ON-DEMAND via il tool `request_metadata_detail` (detail='columns'|'lookup_columns'),
|
|
15421
|
+
* risolto lato backend da `RagController.ResolveMetadataDetail`.
|
|
15422
|
+
*
|
|
15423
|
+
* RAZIONALE: inlinare colonne + SQL identity gonfiava OGNI richiesta a prescindere dal
|
|
15424
|
+
* prompt (context window saturato, token sprecati). Col retrieval agentico il model
|
|
15425
|
+
* recupera SOLO cio' che il prompt richiede, e il meccanismo scala a N dimensioni di
|
|
15426
|
+
* metadata (physical_columns, related_routes, enum_values, ...) senza toccare questo
|
|
15427
|
+
* builder. Vale per qualunque pagina, incluse quelle framework (designer, ...): il
|
|
15428
|
+
* model puo' comunque targetizzare una route business via retrieval.
|
|
15429
|
+
*/
|
|
15430
|
+
private buildMinimalPageContext;
|
|
15431
|
+
/**
|
|
15432
|
+
* Concatena lo state dump fornito dai componenti host che hanno registrato
|
|
15433
|
+
* un state provider per un proposed_action kind. Tipicamente designer.component
|
|
15434
|
+
* registra `designer_inject` con un tree dei dashboardElements (uniqueName +
|
|
15435
|
+
* inputs significativi), cosi' il LLM puo' identificare componenti via
|
|
15436
|
+
* uniqueName quando l'utente chiede modifiche tipo "cambia background
|
|
15437
|
+
* del riquadro in alto a destra".
|
|
15438
|
+
*
|
|
15439
|
+
* Ritorna `null` se nessun host ha registrato dump per il turn corrente.
|
|
15440
|
+
*/
|
|
15441
|
+
private buildHostStateContext;
|
|
14634
15442
|
private scheduleScrollToBottom;
|
|
14635
15443
|
private focusInput;
|
|
14636
15444
|
private extractErrorMessage;
|
|
14637
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<WuicRagChatbotComponent, [null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
|
|
14638
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<WuicRagChatbotComponent, "wuic-rag-chatbot", never, { "title": { "alias": "title"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "topK": { "alias": "topK"; "required": false; }; "showSources": { "alias": "showSources"; "required": false; }; "maxHistory": { "alias": "maxHistory"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "model": { "alias": "model"; "required": false; }; "chatHeight": { "alias": "chatHeight"; "required": false; }; "showClearButton": { "alias": "showClearButton"; "required": false; }; }, { "resultSelected": "resultSelected"; "errorOccurred": "errorOccurred"; "turnAdded": "turnAdded"; }, never, never, true, never>;
|
|
15445
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WuicRagChatbotComponent, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
|
|
15446
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WuicRagChatbotComponent, "wuic-rag-chatbot", never, { "title": { "alias": "title"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "topK": { "alias": "topK"; "required": false; }; "showSources": { "alias": "showSources"; "required": false; }; "maxHistory": { "alias": "maxHistory"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "model": { "alias": "model"; "required": false; }; "chatHeight": { "alias": "chatHeight"; "required": false; }; "showClearButton": { "alias": "showClearButton"; "required": false; }; "persistSession": { "alias": "persistSession"; "required": false; }; "sendRouteContext": { "alias": "sendRouteContext"; "required": false; }; "allowProfileToggle": { "alias": "allowProfileToggle"; "required": false; }; }, { "resultSelected": "resultSelected"; "errorOccurred": "errorOccurred"; "turnAdded": "turnAdded"; }, never, never, true, never>;
|
|
14639
15447
|
}
|
|
14640
15448
|
|
|
14641
15449
|
/**
|
|
@@ -14667,6 +15475,7 @@ declare class WuicRagChatbotFabComponent implements OnInit, OnDestroy {
|
|
|
14667
15475
|
private readonly licenseService;
|
|
14668
15476
|
private readonly notificationRT;
|
|
14669
15477
|
private readonly cdr;
|
|
15478
|
+
private readonly router;
|
|
14670
15479
|
/** Tooltip dell'icona FAB. */
|
|
14671
15480
|
fabTooltip: string;
|
|
14672
15481
|
/** Titolo del dialog (passato anche al chatbot interno). */
|
|
@@ -14702,9 +15511,18 @@ declare class WuicRagChatbotFabComponent implements OnInit, OnDestroy {
|
|
|
14702
15511
|
licenseAllowed: boolean;
|
|
14703
15512
|
/** Counter unread per il badge sul FAB. */
|
|
14704
15513
|
unreadRagCount: number;
|
|
15514
|
+
/**
|
|
15515
|
+
* True quando la route corrente e' `/rag-chatbot` (o un suo sub-path).
|
|
15516
|
+
* Nascondiamo il FAB in quel caso perche' renderebbe un launcher duplicato
|
|
15517
|
+
* sopra il chatbot gia' aperto a tutta pagina. Aggiornato reattivamente
|
|
15518
|
+
* ai `NavigationEnd` del Router, e inizializzato dal `router.url` corrente
|
|
15519
|
+
* cosi' il primo render (es. F5 mentre sei gia' sulla route) e' coerente.
|
|
15520
|
+
*/
|
|
15521
|
+
private onRagChatbotRoute;
|
|
14705
15522
|
private subs;
|
|
14706
|
-
constructor(licenseService: LicenseFeatureService, notificationRT: NotificationRealtimeService, cdr: ChangeDetectorRef);
|
|
15523
|
+
constructor(licenseService: LicenseFeatureService, notificationRT: NotificationRealtimeService, cdr: ChangeDetectorRef, router: Router);
|
|
14707
15524
|
ngOnInit(): void;
|
|
15525
|
+
private updateOnRagChatbotRoute;
|
|
14708
15526
|
ngOnDestroy(): void;
|
|
14709
15527
|
get visible(): boolean;
|
|
14710
15528
|
/**
|
|
@@ -15036,4 +15854,4 @@ declare function getThemeOptions(): ThemeOption[];
|
|
|
15036
15854
|
declare function getThemePrimaryHex(value: string): string;
|
|
15037
15855
|
|
|
15038
15856
|
export { AUTH_REDIRECT_REASON_KEY, AppSettingsEditorComponent, AuthSessionService, BooleanEditorComponent, BoundedRepeaterComponent, ButtonEditorComponent, CallbackPipe, CallbackPipe2, CarouselListComponent, CodeAreaEditorComponent, ColorEditorComponent, CrashReporterService, CustomAttributesService, CustomException, DataActionButtonComponent, DataProviderOdataService, DataRepeaterComponent, DataSourceComponent, DateEditorComponent, DesignerRouteComponent, DictionaryEditorComponent, DynamicCompilerService, DynamicRowTemplateComponent, FieldEditorComponent, FilterBarComponent, FilterInfo, FormatGridViewValuePipe, GetSrcUploadPreviewPipe, GlobalHandler, HtmlEditorComponent, ImageWrapperComponent, ImportExportButtonComponent, IsSelectedRowPipe, KanbanListComponent, KanbanOptions, KanbanStatusColumnItem, LazyChartListComponent, LazyCodeEditorComponent, LazyDataActionButtonComponent, LazyDataSourceComponent, LazyFieldEditorComponent, LazyFirstRunWizardComponent, LazyImageWrapperComponent, LazyKanbanListComponent, LazyMetaMenuComponent, LazyPivotBuilderComponent, LazyReportDesignerComponent, LazyReportViewerComponent, LazySchedulerListComponent, LazySpreadsheetListSfComponent, LicenseFeatureService, ListGridComponent, LookupEditorComponent, MapListComponent, MetaInfo, MetaMenuComponent, MetadataEditorService, MetadataProviderService, MetadatiColonna, MetadatiTabella, NotificationBellComponent, NotificationRealtimeService, NumberEditorComponent, PRIMARY_PALETTES, PagerComponent, ParametricDialogComponent, PropertyArrayEditorComponent, PropertyObjectEditorComponent, THEME_OPTIONS, TextAreaEditorComponent, TextEditorComponent, TranslationManagerService, TreeListComponent, TreeViewSelectorComponent, UploadDialogComponent, UploadEditorComponent, UserInfoService, ValidationRule, ValueChangedPayload, VisibleFieldListPipe, WidgetDefinition, WorkflowDesignerRouteComponent, WorkflowRunnerComponent, WorkflowRuntimeMetadataService, WtoolboxService, WuicAziendaSwitcherComponent, WuicErrorDialogComponent, WuicErrorInterceptor, WuicFeatureDirective, WuicFrozenColumnDirective, WuicRagChatbotComponent, WuicRagChatbotFabComponent, WuicRagService, WuicRowTogglerDirective, _PRIMENG_TABLE_DIRECTIVES_NAMES, authExpiredInterceptor, boundedRepeaterPendingChangesGuard, featureRouteCanActivateGuard, featureRouteCanMatchGuard, getThemeOptions, getThemePrimaryHex, inferTemplateFieldFromBaseClass, loadBooleanEditorComponent, loadButtonEditorComponent, loadCodeAreaEditorComponent, loadColorEditorComponent, loadDateEditorComponent, loadDictionaryEditorComponent, loadHtmlEditorComponent, loadLookupEditorComponent, loadNumberEditorComponent, loadPropertyArrayEditorComponent, loadPropertyObjectEditorComponent, loadTextAreaEditorComponent, loadTextEditorComponent, loadTreeViewSelectorComponent, loadUploadEditorComponent, menuRouteAccessCanActivateGuard, menuRouteAccessCanMatchGuard, routes, wuicErrorInterceptor };
|
|
15039
|
-
export type { AuthSessionState, Breadcrumb, CompileDynamicComponentOptions, CrashReportPayload, CrashReportingConfig, CustomAttributeDefinition, CustomAttributeResolved, CustomLookupOption, CustomValue, CvUpsertItem, DataSourceAfterSyncEvent, DataSourceBeforeSyncEvent, DataSourceSyncOperation, ErrorDelegate, ErrorDelegateContext, IDataBoundHostComponent, IFieldEditor, KanbanStatusColumn, LicenseStatusResponse, ListGridAfterRenderEvent, ListGridAfterRowRenderEvent, ListGridBeforeRowRenderEvent, MultiDatasourceMeta, NotificationItem, NotifyOptions, RagAskAcceptedResponse, RagAskRequest, RagChatHistorySnapshot, RagChatMessageDto, RagChatMessageStatus, RagChatRequest, RagChatResponse, RagChatSessionDto, RagChatTurn, RagChatbotTurn, RagHealthResponse, RagQueryRequest, RagQueryResponse, RagSource, RealtimeProgressEvent, ThemeOption, ThemePresetName, ThemePrimaryName, WorkflowRuntimeLinkedActionRouteMetadataEntry, WorkflowRuntimePreviousRouteNodeEntry, WorkflowRuntimeRouteMetadataEntry, WorkflowRuntimeRouteNodePayloadEntry };
|
|
15857
|
+
export type { AuthSessionState, Breadcrumb, CompileDynamicComponentOptions, CrashReportPayload, CrashReportingConfig, CustomAttributeDefinition, CustomAttributeResolved, CustomLookupOption, CustomValue, CvUpsertItem, DataSourceAfterSyncEvent, DataSourceBeforeSyncEvent, DataSourceSyncOperation, ErrorDelegate, ErrorDelegateContext, IDataBoundHostComponent, IFieldEditor, KanbanStatusColumn, LicenseStatusResponse, ListGridAfterRenderEvent, ListGridAfterRowRenderEvent, ListGridBeforeRowRenderEvent, MultiDatasourceMeta, NotificationItem, NotifyOptions, RagApplyActionRequest, RagApplyActionResponse, RagAskAcceptedResponse, RagAskRequest, RagChatHistorySnapshot, RagChatMessageDto, RagChatMessageStatus, RagChatRequest, RagChatResponse, RagChatSessionDto, RagChatTurn, RagChatbotTurn, RagCompactRequest, RagCompactResponse, RagHealthResponse, RagProfile, RagProposedAction, RagProposedActionExtraField, RagProposedActionKind, RagQueryRequest, RagQueryResponse, RagRenameSessionRequest, RagRenameSessionResponse, RagSource, RagUpdateProposedActionRequest, RagUpdateProposedActionResponse, RealtimeProgressEvent, ThemeOption, ThemePresetName, ThemePrimaryName, WorkflowRuntimeLinkedActionRouteMetadataEntry, WorkflowRuntimePreviousRouteNodeEntry, WorkflowRuntimeRouteMetadataEntry, WorkflowRuntimeRouteNodePayloadEntry };
|