@personaai/react 0.7.4 → 0.7.6
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.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -638,12 +638,14 @@ function useChat(options = {}) {
|
|
|
638
638
|
agentId: targetAgentId,
|
|
639
639
|
threadId: threadId ?? overrideOptions?.threadId,
|
|
640
640
|
hasResume: !!overrideOptions?.resume,
|
|
641
|
+
hasContextOverride: !!overrideOptions?.contextOverride,
|
|
641
642
|
messageCount: messages.length
|
|
642
643
|
});
|
|
643
644
|
chatLogger.trace("sendMessage details", {
|
|
644
645
|
agentId: targetAgentId,
|
|
645
646
|
promptPreview: prompt.slice(0, 200),
|
|
646
|
-
hasResume: !!overrideOptions?.resume
|
|
647
|
+
hasResume: !!overrideOptions?.resume,
|
|
648
|
+
hasContextOverride: !!overrideOptions?.contextOverride
|
|
647
649
|
});
|
|
648
650
|
const userMessage = {
|
|
649
651
|
id: `user-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
@@ -698,7 +700,8 @@ function useChat(options = {}) {
|
|
|
698
700
|
agentId: targetAgentId,
|
|
699
701
|
messages: payloadMessages,
|
|
700
702
|
threadId: resolvedThreadId,
|
|
701
|
-
resume: overrideOptions?.resume
|
|
703
|
+
resume: overrideOptions?.resume,
|
|
704
|
+
contextOverride: overrideOptions?.contextOverride
|
|
702
705
|
}),
|
|
703
706
|
signal: controller.signal
|
|
704
707
|
});
|
|
@@ -1432,6 +1435,7 @@ function useVoice(options = {}) {
|
|
|
1432
1435
|
const voiceLogger = (0, import_react5.useMemo)(() => logger.child("voice"), [logger]);
|
|
1433
1436
|
const agentId = options.agentId || defaultAgentId;
|
|
1434
1437
|
const threadId = options.threadId;
|
|
1438
|
+
const contextOverride = options.contextOverride;
|
|
1435
1439
|
const [state, setState] = (0, import_react5.useState)("idle");
|
|
1436
1440
|
const [isMuted, setIsMuted] = (0, import_react5.useState)(false);
|
|
1437
1441
|
const [transcript, setTranscript] = (0, import_react5.useState)(
|
|
@@ -1701,14 +1705,19 @@ function useVoice(options = {}) {
|
|
|
1701
1705
|
setToolCalls([]);
|
|
1702
1706
|
acceptedTurnSeqRef.current = 0;
|
|
1703
1707
|
setState("connecting");
|
|
1704
|
-
voiceLogger.debug("start() called", {
|
|
1708
|
+
voiceLogger.debug("start() called", {
|
|
1709
|
+
agentId,
|
|
1710
|
+
threadId,
|
|
1711
|
+
hasContextOverride: !!contextOverride
|
|
1712
|
+
});
|
|
1705
1713
|
try {
|
|
1706
1714
|
const res = await fetchWithAuth("/voice/sessions", {
|
|
1707
1715
|
method: "POST",
|
|
1708
1716
|
headers: { "Content-Type": "application/json" },
|
|
1709
1717
|
body: JSON.stringify({
|
|
1710
1718
|
agentId,
|
|
1711
|
-
...threadId ? { threadId } : {}
|
|
1719
|
+
...threadId ? { threadId } : {},
|
|
1720
|
+
...contextOverride ? { contextOverride } : {}
|
|
1712
1721
|
})
|
|
1713
1722
|
});
|
|
1714
1723
|
if (!res.ok) {
|
|
@@ -1744,7 +1753,7 @@ function useVoice(options = {}) {
|
|
|
1744
1753
|
}
|
|
1745
1754
|
teardownAudio();
|
|
1746
1755
|
}
|
|
1747
|
-
}, [agentId, threadId, fetchWithAuth, handleMessage, teardownAudio, voiceLogger]);
|
|
1756
|
+
}, [agentId, threadId, contextOverride, fetchWithAuth, handleMessage, teardownAudio, voiceLogger]);
|
|
1748
1757
|
const mute = (0, import_react5.useCallback)((muted) => {
|
|
1749
1758
|
setIsMuted(muted);
|
|
1750
1759
|
streamRef.current?.getAudioTracks().forEach((track) => {
|