@springbrand/chat-client 0.3.0-alpha.2 → 0.3.0-alpha.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@springbrand/chat-client",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@types/react-dom": "^19.2.5",
|
|
28
28
|
"react-dom": "^19.2.8",
|
|
29
29
|
"typescript": "^7.0.2",
|
|
30
|
-
"@springbrand/agent-runtime": "0.3.0-alpha.
|
|
30
|
+
"@springbrand/agent-runtime": "0.3.0-alpha.4"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"typecheck": "tsc --noEmit"
|
|
@@ -211,7 +211,7 @@ export function UniversalAgentChatProvider({
|
|
|
211
211
|
const agent = useAgent<RuntimeState>({
|
|
212
212
|
agent: routed ? connection.sessionAgent ?? "UniversalAgent" : inboxAgent,
|
|
213
213
|
...(routed
|
|
214
|
-
? { basePath: connection.sessionBasePath }
|
|
214
|
+
? { basePath: connection.sessionBasePath, name: chatId }
|
|
215
215
|
: connection.inboxName === undefined
|
|
216
216
|
? { basePath: connection.basePath ?? CURRENT_INBOX_AGENT_PATH }
|
|
217
217
|
: { name: connection.inboxName }),
|
|
@@ -603,6 +603,13 @@ export function useUniversalAgentChat(): ChatRuntime {
|
|
|
603
603
|
throw new Error("useUniversalAgentChat must be used within UniversalAgentChatProvider");
|
|
604
604
|
}
|
|
605
605
|
const { chatId, connection, agent, chatAgent } = context;
|
|
606
|
+
const routedHistoryUrl = connection.sessionBasePath !== undefined &&
|
|
607
|
+
connection.host !== undefined
|
|
608
|
+
? new URL(
|
|
609
|
+
`/${connection.sessionBasePath.replace(/^\/+/, "")}`,
|
|
610
|
+
connection.host,
|
|
611
|
+
).toString()
|
|
612
|
+
: undefined;
|
|
606
613
|
const [optimisticMessages, setOptimisticMessages] =
|
|
607
614
|
useState<ChatMessage[]>([]);
|
|
608
615
|
const [optimisticQueued, setOptimisticQueued] =
|
|
@@ -638,7 +645,10 @@ export function useUniversalAgentChat(): ChatRuntime {
|
|
|
638
645
|
agent: chatAgent,
|
|
639
646
|
getInitialMessages: connection.skipInitialMessages
|
|
640
647
|
? null
|
|
641
|
-
: ({ url }) => loadInitialMessages(
|
|
648
|
+
: ({ url }) => loadInitialMessages(
|
|
649
|
+
routedHistoryUrl ?? url,
|
|
650
|
+
connection.credentials,
|
|
651
|
+
),
|
|
642
652
|
...(connection.credentials === undefined
|
|
643
653
|
? {}
|
|
644
654
|
: { credentials: connection.credentials }),
|