@paymanai/payman-typescript-ask-sdk 2.0.1 → 2.0.2
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/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.js +6 -4
- package/dist/index.native.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -123,6 +123,8 @@ type MessageDisplay = {
|
|
|
123
123
|
allThinkingText?: string;
|
|
124
124
|
formattedThinkingText?: string;
|
|
125
125
|
isResolvingImages?: boolean;
|
|
126
|
+
/** Elapsed thinking time in seconds, captured at stream completion and persisted. */
|
|
127
|
+
thinkingDurationSec?: number;
|
|
126
128
|
/** History row loaded via loadSession(). Renderers skip streaming/step UI. */
|
|
127
129
|
isHistorical?: boolean;
|
|
128
130
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -123,6 +123,8 @@ type MessageDisplay = {
|
|
|
123
123
|
allThinkingText?: string;
|
|
124
124
|
formattedThinkingText?: string;
|
|
125
125
|
isResolvingImages?: boolean;
|
|
126
|
+
/** Elapsed thinking time in seconds, captured at stream completion and persisted. */
|
|
127
|
+
thinkingDurationSec?: number;
|
|
126
128
|
/** History row loaded via loadSession(). Renderers skip streaming/step UI. */
|
|
127
129
|
isHistorical?: boolean;
|
|
128
130
|
};
|
package/dist/index.js
CHANGED
|
@@ -968,6 +968,7 @@ function useStreamManagerV2(config, callbacks, setMessages, setIsWaitingForRespo
|
|
|
968
968
|
const abortController = externalAbortController ?? new AbortController();
|
|
969
969
|
abortControllerRef.current = abortController;
|
|
970
970
|
const state = createInitialV2State();
|
|
971
|
+
const streamStartedAt = Date.now();
|
|
971
972
|
const updateMessage = (update) => {
|
|
972
973
|
if (abortController.signal.aborted) return;
|
|
973
974
|
setMessages(
|
|
@@ -1102,7 +1103,8 @@ function useStreamManagerV2(config, callbacks, setMessages, setIsWaitingForRespo
|
|
|
1102
1103
|
currentExecutingStepId: void 0,
|
|
1103
1104
|
userActionResult: state.userActionResult,
|
|
1104
1105
|
formattedThinkingText: state.hasError ? void 0 : state.formattedThinkingText || void 0,
|
|
1105
|
-
isResolvingImages: needsImageResolve
|
|
1106
|
+
isResolvingImages: needsImageResolve,
|
|
1107
|
+
thinkingDurationSec: state.hasError ? void 0 : Math.max(0, Math.round((Date.now() - streamStartedAt) / 1e3))
|
|
1106
1108
|
};
|
|
1107
1109
|
setMessages(
|
|
1108
1110
|
(prev) => prev.map(
|
|
@@ -1320,9 +1322,9 @@ function streamKeyFor(scopeKey, sessionId) {
|
|
|
1320
1322
|
function useChatV2(config, callbacks = {}) {
|
|
1321
1323
|
const scopeKey = react.useMemo(() => buildScopeKey(config), [
|
|
1322
1324
|
config.session?.userId,
|
|
1323
|
-
config.workflow
|
|
1324
|
-
config.workflow
|
|
1325
|
-
config.workflow
|
|
1325
|
+
config.workflow?.id,
|
|
1326
|
+
config.workflow?.version,
|
|
1327
|
+
config.workflow?.stage
|
|
1326
1328
|
]);
|
|
1327
1329
|
const initialSessionId = chatStore.get(scopeKey).find((m) => m.sessionId)?.sessionId ?? config.session?.initialId ?? void 0;
|
|
1328
1330
|
const [messages, setMessages] = react.useState(() => {
|