@cuadra-ai/uikit 0.5.0 → 0.5.1
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/dist/adapters/chatErrorStore.d.ts +22 -2
- package/dist/adapters/chatErrorStore.d.ts.map +1 -1
- package/dist/adapters/chatModelAdapter.d.ts.map +1 -1
- package/dist/components/thread/MessageComponents.d.ts.map +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +832 -802
- package/dist/index.mjs.map +1 -1
- package/dist/types/strings.d.ts +4 -0
- package/dist/types/strings.d.ts.map +1 -1
- package/dist/widget/cuadra-uikit.umd.js +20 -20
- package/dist/widget/cuadra-uikit.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reactive store for surfacing chat-level error status
|
|
2
|
+
* Reactive store for surfacing chat-level error status.
|
|
3
|
+
*
|
|
4
|
+
* Sources:
|
|
5
|
+
* - GET /v1/chats/{id} returning `status === "error"`
|
|
6
|
+
* - Stream completing without producing any content (silent server failure)
|
|
3
7
|
*
|
|
4
|
-
* Populated when a chat with `status === "error"` is loaded from the backend.
|
|
5
8
|
* The UI subscribes via useSyncExternalStore to show an inline retry indicator.
|
|
9
|
+
* Consecutive empty-stream failures are tracked so the UI can escalate
|
|
10
|
+
* from "try again" to "contact support" after repeated failures.
|
|
6
11
|
*/
|
|
7
12
|
type Listener = () => void;
|
|
8
13
|
export interface ChatErrorState {
|
|
9
14
|
chatId: string;
|
|
10
15
|
lastError: string;
|
|
11
16
|
lastErrorAt: string;
|
|
17
|
+
/** True when the error was caused by a stream that ended without content. */
|
|
18
|
+
isEmptyStream?: boolean;
|
|
19
|
+
/** How many empty-stream failures have occurred in a row. */
|
|
20
|
+
consecutiveEmptyFailures?: number;
|
|
12
21
|
}
|
|
13
22
|
declare class ChatErrorStore {
|
|
14
23
|
private current;
|
|
24
|
+
private _consecutiveEmptyFailures;
|
|
15
25
|
private listeners;
|
|
16
26
|
set(state: ChatErrorState): void;
|
|
27
|
+
/**
|
|
28
|
+
* Record a stream that ended with [DONE] but produced no content.
|
|
29
|
+
* Increments the consecutive failure counter and notifies subscribers.
|
|
30
|
+
*/
|
|
31
|
+
setEmptyStreamError(): void;
|
|
32
|
+
/** Whether the consecutive failure count has reached the support threshold. */
|
|
33
|
+
get shouldSuggestSupport(): boolean;
|
|
34
|
+
/** Reset the consecutive empty-stream failure counter (call on success). */
|
|
35
|
+
resetEmptyFailures(): void;
|
|
36
|
+
/** Clear the current error state (does NOT reset the failure counter). */
|
|
17
37
|
clear(): void;
|
|
18
38
|
getSnapshot: () => ChatErrorState | null;
|
|
19
39
|
subscribe: (listener: Listener) => (() => void);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatErrorStore.d.ts","sourceRoot":"","sources":["../../src/adapters/chatErrorStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chatErrorStore.d.ts","sourceRoot":"","sources":["../../src/adapters/chatErrorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,6DAA6D;IAC7D,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAID,cAAM,cAAc;IAClB,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,yBAAyB,CAAK;IACtC,OAAO,CAAC,SAAS,CAAuB;IAExC,GAAG,CAAC,KAAK,EAAE,cAAc;IAKzB;;;OAGG;IACH,mBAAmB;IAYnB,+EAA+E;IAC/E,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAED,4EAA4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AAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,gBAAgB,CAskBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageComponents.d.ts","sourceRoot":"","sources":["../../../src/components/thread/MessageComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAYjF;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,GAAG,EACH,SAAS,EACT,KAAK,GACN,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,2CAqEA;AAwDD,wBAAgB,iBAAiB,4CAYhC;AAID,wBAAgB,WAAW,4CAyE1B;AAID,wBAAgB,gBAAgB,4CAoE/B;AAID,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"MessageComponents.d.ts","sourceRoot":"","sources":["../../../src/components/thread/MessageComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAYjF;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,GAAG,EACH,SAAS,EACT,KAAK,GACN,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,2CAqEA;AAwDD,wBAAgB,iBAAiB,4CAYhC;AAID,wBAAgB,WAAW,4CAyE1B;AAID,wBAAgB,gBAAgB,4CAoE/B;AAID,wBAAgB,kBAAkB,mDA0DjC"}
|