@hilbras/sdk 0.26.6 → 1.0.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/README.md +1 -1
- package/dist/client/client.d.ts +5 -10
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +125 -26
- package/dist/client/client.js.map +1 -1
- package/dist/frameworks/angular/chat.service.d.ts +22 -1
- package/dist/frameworks/angular/chat.service.d.ts.map +1 -1
- package/dist/frameworks/angular/chat.service.js +119 -10
- package/dist/frameworks/angular/chat.service.js.map +1 -1
- package/dist/frameworks/astro/endpoints.d.ts +4 -0
- package/dist/frameworks/astro/endpoints.d.ts.map +1 -1
- package/dist/frameworks/astro/endpoints.js +37 -34
- package/dist/frameworks/astro/endpoints.js.map +1 -1
- package/dist/frameworks/nextjs/route-handlers.d.ts +7 -0
- package/dist/frameworks/nextjs/route-handlers.d.ts.map +1 -1
- package/dist/frameworks/nextjs/route-handlers.js +39 -32
- package/dist/frameworks/nextjs/route-handlers.js.map +1 -1
- package/dist/frameworks/qwik/index.d.ts +1 -1
- package/dist/frameworks/qwik/index.d.ts.map +1 -1
- package/dist/frameworks/qwik/index.js.map +1 -1
- package/dist/frameworks/qwik/stream-parser.d.ts +8 -0
- package/dist/frameworks/qwik/stream-parser.d.ts.map +1 -0
- package/dist/frameworks/qwik/stream-parser.js +42 -0
- package/dist/frameworks/qwik/stream-parser.js.map +1 -0
- package/dist/frameworks/qwik/use-chat.d.ts +20 -11
- package/dist/frameworks/qwik/use-chat.d.ts.map +1 -1
- package/dist/frameworks/qwik/use-chat.js +147 -33
- package/dist/frameworks/qwik/use-chat.js.map +1 -1
- package/dist/frameworks/react/generative-ui.d.ts +122 -0
- package/dist/frameworks/react/generative-ui.d.ts.map +1 -0
- package/dist/frameworks/react/generative-ui.js +120 -0
- package/dist/frameworks/react/generative-ui.js.map +1 -0
- package/dist/frameworks/react/index.d.ts +3 -1
- package/dist/frameworks/react/index.d.ts.map +1 -1
- package/dist/frameworks/react/index.js +1 -0
- package/dist/frameworks/react/index.js.map +1 -1
- package/dist/frameworks/react/use-chat.d.ts +28 -3
- package/dist/frameworks/react/use-chat.d.ts.map +1 -1
- package/dist/frameworks/react/use-chat.js +126 -5
- package/dist/frameworks/react/use-chat.js.map +1 -1
- package/dist/frameworks/remix/actions.d.ts +4 -0
- package/dist/frameworks/remix/actions.d.ts.map +1 -1
- package/dist/frameworks/remix/actions.js +37 -33
- package/dist/frameworks/remix/actions.js.map +1 -1
- package/dist/frameworks/solid/index.d.ts +1 -1
- package/dist/frameworks/solid/index.d.ts.map +1 -1
- package/dist/frameworks/solid/index.js.map +1 -1
- package/dist/frameworks/solid/stream-parser.d.ts +8 -0
- package/dist/frameworks/solid/stream-parser.d.ts.map +1 -0
- package/dist/frameworks/solid/stream-parser.js +42 -0
- package/dist/frameworks/solid/stream-parser.js.map +1 -0
- package/dist/frameworks/solid/use-chat.d.ts +20 -10
- package/dist/frameworks/solid/use-chat.d.ts.map +1 -1
- package/dist/frameworks/solid/use-chat.js +147 -35
- package/dist/frameworks/solid/use-chat.js.map +1 -1
- package/dist/frameworks/svelte/use-chat.d.ts +24 -1
- package/dist/frameworks/svelte/use-chat.d.ts.map +1 -1
- package/dist/frameworks/svelte/use-chat.js +140 -10
- package/dist/frameworks/svelte/use-chat.js.map +1 -1
- package/dist/frameworks/vue/use-chat.d.ts +44 -1
- package/dist/frameworks/vue/use-chat.d.ts.map +1 -1
- package/dist/frameworks/vue/use-chat.js +160 -31
- package/dist/frameworks/vue/use-chat.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types/schema.d.ts +38 -0
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/streams.d.ts +25 -1
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/streams.js +4 -0
- package/dist/types/streams.js.map +1 -1
- package/dist/types/ui-protocol.d.ts +34 -2
- package/dist/types/ui-protocol.d.ts.map +1 -1
- package/dist/utils/sse-writer.d.ts +68 -0
- package/dist/utils/sse-writer.d.ts.map +1 -0
- package/dist/utils/sse-writer.js +233 -0
- package/dist/utils/sse-writer.js.map +1 -0
- package/package.json +1 -1
|
@@ -2,51 +2,140 @@
|
|
|
2
2
|
* @hilbras/solid — useChat
|
|
3
3
|
*
|
|
4
4
|
* Signal-based chat hook for SolidJS.
|
|
5
|
+
* Handles all protocol events including tool calls.
|
|
5
6
|
*/
|
|
6
7
|
import { createSignal } from "./solid-shim.js";
|
|
8
|
+
import { parseUIStream } from "./stream-parser.js";
|
|
9
|
+
let _idCounter = 0;
|
|
10
|
+
function generateId() {
|
|
11
|
+
return `msg_${Date.now()}_${_idCounter++}`;
|
|
12
|
+
}
|
|
7
13
|
export function useChat(options = {}) {
|
|
8
|
-
const { api = "/api/chat", onFinish, onError, initialMessages = [] } = options;
|
|
14
|
+
const { api = "/api/chat", onFinish, onError, initialMessages = [], provider, model, maxSteps = 1, onToolCall, headers = {}, body = {}, } = options;
|
|
9
15
|
const [messages, setMessages] = createSignal(initialMessages);
|
|
10
16
|
const [isLoading, setIsLoading] = createSignal(false);
|
|
11
17
|
const [error, setError] = createSignal(null);
|
|
12
18
|
let abortController = null;
|
|
13
|
-
async function
|
|
19
|
+
async function sendRequest(messageHistory, assistantMessage) {
|
|
14
20
|
setIsLoading(true);
|
|
15
21
|
setError(null);
|
|
16
22
|
abortController = new AbortController();
|
|
17
23
|
try {
|
|
18
|
-
const
|
|
24
|
+
const res = await fetch(api, {
|
|
19
25
|
method: "POST",
|
|
20
|
-
headers: { "Content-Type": "application/json" },
|
|
21
|
-
body: JSON.stringify({
|
|
26
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
messages: messageHistory.map((m) => ({ role: m.role, content: m.content })),
|
|
29
|
+
provider,
|
|
30
|
+
model,
|
|
31
|
+
stream: true,
|
|
32
|
+
maxSteps,
|
|
33
|
+
...body,
|
|
34
|
+
}),
|
|
22
35
|
signal: abortController.signal,
|
|
23
36
|
});
|
|
24
|
-
if (!
|
|
25
|
-
throw new Error(`HTTP ${
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
if (!res.ok)
|
|
38
|
+
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
|
|
39
|
+
if (!res.body)
|
|
40
|
+
throw new Error("Response body is null");
|
|
41
|
+
let content = "";
|
|
42
|
+
const toolInvocations = [];
|
|
43
|
+
const pendingToolCalls = new Map();
|
|
44
|
+
for await (const msg of parseUIStream(res.body)) {
|
|
45
|
+
switch (msg.type) {
|
|
46
|
+
case "text_delta":
|
|
47
|
+
content += msg.text;
|
|
48
|
+
setMessages((prev) => prev.map((m) => m.id === assistantMessage.id ? { ...m, content } : m));
|
|
49
|
+
break;
|
|
50
|
+
case "tool_call_start": {
|
|
51
|
+
const invocation = {
|
|
52
|
+
id: msg.id,
|
|
53
|
+
name: msg.name,
|
|
54
|
+
args: {},
|
|
55
|
+
state: "call",
|
|
56
|
+
};
|
|
57
|
+
toolInvocations.push(invocation);
|
|
58
|
+
pendingToolCalls.set(msg.id, { name: msg.name, argsBuffer: "" });
|
|
59
|
+
setMessages((prev) => prev.map((m) => m.id === assistantMessage.id
|
|
60
|
+
? { ...m, toolInvocations: [...toolInvocations] }
|
|
61
|
+
: m));
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "tool_call_delta": {
|
|
65
|
+
const pending = pendingToolCalls.get(msg.id);
|
|
66
|
+
if (pending) {
|
|
67
|
+
pending.argsBuffer += msg.args;
|
|
68
|
+
try {
|
|
69
|
+
const partialArgs = JSON.parse(pending.argsBuffer);
|
|
70
|
+
const invocation = toolInvocations.find((t) => t.id === msg.id);
|
|
71
|
+
if (invocation) {
|
|
72
|
+
invocation.args = partialArgs;
|
|
73
|
+
setMessages((prev) => prev.map((m) => m.id === assistantMessage.id
|
|
74
|
+
? { ...m, toolInvocations: [...toolInvocations] }
|
|
75
|
+
: m));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Partial JSON not parseable yet
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case "tool_call_end": {
|
|
85
|
+
const pending = pendingToolCalls.get(msg.id);
|
|
86
|
+
const invocation = toolInvocations.find((t) => t.id === msg.id);
|
|
87
|
+
if (invocation && pending) {
|
|
88
|
+
try {
|
|
89
|
+
invocation.args = JSON.parse(pending.argsBuffer || "{}");
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
invocation.args = { raw: pending.argsBuffer };
|
|
93
|
+
}
|
|
94
|
+
pendingToolCalls.delete(msg.id);
|
|
95
|
+
if (onToolCall) {
|
|
96
|
+
try {
|
|
97
|
+
invocation.state = "call";
|
|
98
|
+
const result = await onToolCall({
|
|
99
|
+
id: msg.id,
|
|
100
|
+
name: invocation.name,
|
|
101
|
+
args: invocation.args,
|
|
102
|
+
});
|
|
103
|
+
invocation.result = result;
|
|
104
|
+
invocation.state = "result";
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
invocation.state = "error";
|
|
108
|
+
invocation.error = err.message;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
invocation.state = "call";
|
|
113
|
+
}
|
|
114
|
+
setMessages((prev) => prev.map((m) => m.id === assistantMessage.id
|
|
115
|
+
? { ...m, toolInvocations: [...toolInvocations] }
|
|
116
|
+
: m));
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case "message_end":
|
|
121
|
+
if (msg.usage) {
|
|
122
|
+
setMessages((prev) => prev.map((m) => m.id === assistantMessage.id ? { ...m, usage: msg.usage } : m));
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case "error":
|
|
126
|
+
throw new Error(msg.error);
|
|
127
|
+
}
|
|
44
128
|
}
|
|
45
|
-
|
|
129
|
+
const finalMessage = {
|
|
130
|
+
...assistantMessage,
|
|
131
|
+
content,
|
|
132
|
+
toolInvocations: toolInvocations.length > 0 ? toolInvocations : undefined,
|
|
133
|
+
};
|
|
134
|
+
onFinish?.(finalMessage);
|
|
46
135
|
}
|
|
47
136
|
catch (err) {
|
|
48
137
|
if (err.name !== "AbortError") {
|
|
49
|
-
const e = err;
|
|
138
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
50
139
|
setError(e);
|
|
51
140
|
onError?.(e);
|
|
52
141
|
}
|
|
@@ -56,18 +145,41 @@ export function useChat(options = {}) {
|
|
|
56
145
|
}
|
|
57
146
|
}
|
|
58
147
|
async function append(message) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
148
|
+
const userMessage = {
|
|
149
|
+
id: generateId(),
|
|
150
|
+
role: "user",
|
|
151
|
+
content: message.content,
|
|
152
|
+
createdAt: Date.now(),
|
|
153
|
+
};
|
|
154
|
+
const assistantMessage = {
|
|
155
|
+
id: generateId(),
|
|
156
|
+
role: "assistant",
|
|
157
|
+
content: "",
|
|
158
|
+
createdAt: Date.now(),
|
|
159
|
+
provider,
|
|
160
|
+
model,
|
|
161
|
+
};
|
|
162
|
+
setMessages((prev) => [...prev, userMessage, assistantMessage]);
|
|
163
|
+
await sendRequest([...messages().slice(0, -1), userMessage], assistantMessage);
|
|
62
164
|
}
|
|
63
165
|
async function reload() {
|
|
64
166
|
const msgs = messages();
|
|
65
|
-
if (msgs.length === 0)
|
|
167
|
+
if (msgs.length === 0 || isLoading())
|
|
168
|
+
return;
|
|
169
|
+
const lastUserIdx = msgs.findLastIndex((m) => m.role === "user");
|
|
170
|
+
if (lastUserIdx === -1)
|
|
66
171
|
return;
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
172
|
+
const messagesUpToLastUser = msgs.slice(0, lastUserIdx + 1);
|
|
173
|
+
const assistantMessage = {
|
|
174
|
+
id: generateId(),
|
|
175
|
+
role: "assistant",
|
|
176
|
+
content: "",
|
|
177
|
+
createdAt: Date.now(),
|
|
178
|
+
provider,
|
|
179
|
+
model,
|
|
180
|
+
};
|
|
181
|
+
setMessages([...messagesUpToLastUser, assistantMessage]);
|
|
182
|
+
await sendRequest(messagesUpToLastUser, assistantMessage);
|
|
71
183
|
}
|
|
72
184
|
function stop() {
|
|
73
185
|
abortController?.abort();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat.js","sourceRoot":"","sources":["../../../src/frameworks/solid/use-chat.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-chat.js","sourceRoot":"","sources":["../../../src/frameworks/solid/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,SAAS,UAAU;IACjB,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,UAAU,EAAE,EAAE,CAAC;AAC7C,CAAC;AA0BD,MAAM,UAAU,OAAO,CAAC,OAAO,GAAmB,EAAE;IAClD,MAAM,EACJ,GAAG,GAAG,WAAW,EACjB,QAAQ,EACR,OAAO,EACP,eAAe,GAAG,EAAE,EACpB,QAAQ,EACR,KAAK,EACL,QAAQ,GAAG,CAAC,EACZ,UAAU,EACV,OAAO,GAAG,EAAE,EACZ,IAAI,GAAG,EAAE,GACV,GAAG,OAAO,CAAC;IAEZ,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,YAAY,CAAc,eAA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ChB,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IAED,OAAO;QACL,QAAQ;QACR,SAAS;QACT,KAAK;QACL,WAAW;QACX,MAAM;QACN,MAAM;QACN,IAAI;QACJ,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -9,13 +9,31 @@
|
|
|
9
9
|
* $: messages = chat.messages;
|
|
10
10
|
*/
|
|
11
11
|
import type { UIMessage, UseChatOptions } from "../../index.js";
|
|
12
|
+
/** Extended options with tool calling support */
|
|
13
|
+
export interface UseChatToolOptions extends UseChatOptions {
|
|
14
|
+
maxSteps?: number;
|
|
15
|
+
onToolCall?: (toolCall: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
args: Record<string, unknown>;
|
|
19
|
+
}) => Promise<unknown> | unknown;
|
|
20
|
+
onStepFinish?: (step: {
|
|
21
|
+
step: number;
|
|
22
|
+
text: string;
|
|
23
|
+
toolCalls: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
args: Record<string, unknown>;
|
|
26
|
+
result: unknown;
|
|
27
|
+
}>;
|
|
28
|
+
}) => void;
|
|
29
|
+
}
|
|
12
30
|
export interface ChatState {
|
|
13
31
|
messages: UIMessage[];
|
|
14
32
|
input: string;
|
|
15
33
|
isLoading: boolean;
|
|
16
34
|
error: Error | null;
|
|
17
35
|
}
|
|
18
|
-
export declare function useChat(options:
|
|
36
|
+
export declare function useChat(options: UseChatToolOptions): {
|
|
19
37
|
readonly messages: UIMessage[];
|
|
20
38
|
input: string;
|
|
21
39
|
readonly isLoading: boolean;
|
|
@@ -23,6 +41,11 @@ export declare function useChat(options: UseChatOptions): {
|
|
|
23
41
|
handleSubmit: (e?: {
|
|
24
42
|
preventDefault: () => void;
|
|
25
43
|
}) => Promise<void>;
|
|
44
|
+
append: (message: UIMessage | {
|
|
45
|
+
role: "user";
|
|
46
|
+
content: string;
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
reload: () => Promise<void>;
|
|
26
49
|
setMessages: (newMessages: UIMessage[]) => void;
|
|
27
50
|
stop: () => void;
|
|
28
51
|
clear: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../../src/frameworks/svelte/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../../src/frameworks/svelte/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQlF,iDAAiD;AACjD,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAAC,MAAM,EAAE,OAAO,CAAA;SAAE,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;CACnJ;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,kBAAkB;;WA8RlC,MAAM;;;uBA3OW;QAAE,cAAc,EAAE,MAAM,IAAI,CAAA;KAAE;sBA0K/B,SAAS,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;;+BAkD1C,SAAS,EAAE;;;oBAlPtB,MAAM,IAAI;EA4QlC"}
|
|
@@ -14,7 +14,7 @@ function generateId() {
|
|
|
14
14
|
return `msg_${Date.now()}_${_idCounter++}`;
|
|
15
15
|
}
|
|
16
16
|
export function useChat(options) {
|
|
17
|
-
const { api, initialMessages = [], provider, model, onFinish, onError, headers = {}, body = {}, } = options;
|
|
17
|
+
const { api, initialMessages = [], provider, model, onFinish, onError, headers = {}, body = {}, maxSteps = 1, onToolCall, onStepFinish, } = options;
|
|
18
18
|
const state = {
|
|
19
19
|
messages: [...initialMessages],
|
|
20
20
|
input: "",
|
|
@@ -41,6 +41,10 @@ export function useChat(options) {
|
|
|
41
41
|
state.isLoading = false;
|
|
42
42
|
notify();
|
|
43
43
|
}
|
|
44
|
+
function updateAssistantMessage(id, updater) {
|
|
45
|
+
state.messages = state.messages.map((m) => m.id === id ? updater(m) : m);
|
|
46
|
+
notify();
|
|
47
|
+
}
|
|
44
48
|
async function handleSubmit(e) {
|
|
45
49
|
e?.preventDefault();
|
|
46
50
|
const trimmed = state.input.trim();
|
|
@@ -65,6 +69,9 @@ export function useChat(options) {
|
|
|
65
69
|
state.isLoading = true;
|
|
66
70
|
state.error = null;
|
|
67
71
|
notify();
|
|
72
|
+
await sendRequest([...state.messages.slice(0, -2), userMessage], assistantMessage);
|
|
73
|
+
}
|
|
74
|
+
async function sendRequest(messageHistory, assistantMessage) {
|
|
68
75
|
const controller = new AbortController();
|
|
69
76
|
abortController = controller;
|
|
70
77
|
try {
|
|
@@ -72,13 +79,11 @@ export function useChat(options) {
|
|
|
72
79
|
method: "POST",
|
|
73
80
|
headers: { "Content-Type": "application/json", ...headers },
|
|
74
81
|
body: JSON.stringify({
|
|
75
|
-
messages:
|
|
76
|
-
role: m.role,
|
|
77
|
-
content: m.content,
|
|
78
|
-
})),
|
|
82
|
+
messages: messageHistory.map((m) => ({ role: m.role, content: m.content })),
|
|
79
83
|
provider,
|
|
80
84
|
model,
|
|
81
85
|
stream: true,
|
|
86
|
+
maxSteps,
|
|
82
87
|
...body,
|
|
83
88
|
}),
|
|
84
89
|
signal: controller.signal,
|
|
@@ -88,24 +93,105 @@ export function useChat(options) {
|
|
|
88
93
|
if (!res.body)
|
|
89
94
|
throw new Error("Response body is null");
|
|
90
95
|
let content = "";
|
|
96
|
+
const toolInvocations = [];
|
|
97
|
+
const pendingToolCalls = new Map();
|
|
91
98
|
for await (const msg of parseUIStream(res.body)) {
|
|
92
99
|
switch (msg.type) {
|
|
93
100
|
case "text_delta":
|
|
94
101
|
content += msg.text;
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
updateAssistantMessage(assistantMessage.id, (m) => ({ ...m, content }));
|
|
103
|
+
break;
|
|
104
|
+
case "tool_call_start": {
|
|
105
|
+
const invocation = {
|
|
106
|
+
id: msg.id,
|
|
107
|
+
name: msg.name,
|
|
108
|
+
args: {},
|
|
109
|
+
state: "call",
|
|
110
|
+
};
|
|
111
|
+
toolInvocations.push(invocation);
|
|
112
|
+
pendingToolCalls.set(msg.id, { name: msg.name, argsBuffer: "" });
|
|
113
|
+
updateAssistantMessage(assistantMessage.id, (m) => ({
|
|
114
|
+
...m,
|
|
115
|
+
toolInvocations: [...toolInvocations],
|
|
116
|
+
}));
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case "tool_call_delta": {
|
|
120
|
+
const pending = pendingToolCalls.get(msg.id);
|
|
121
|
+
if (pending) {
|
|
122
|
+
pending.argsBuffer += msg.args;
|
|
123
|
+
try {
|
|
124
|
+
const partialArgs = JSON.parse(pending.argsBuffer);
|
|
125
|
+
const invocation = toolInvocations.find((t) => t.id === msg.id);
|
|
126
|
+
if (invocation) {
|
|
127
|
+
invocation.args = partialArgs;
|
|
128
|
+
updateAssistantMessage(assistantMessage.id, (m) => ({
|
|
129
|
+
...m,
|
|
130
|
+
toolInvocations: [...toolInvocations],
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// Partial JSON not parseable yet
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
case "tool_call_end": {
|
|
141
|
+
const pending = pendingToolCalls.get(msg.id);
|
|
142
|
+
const invocation = toolInvocations.find((t) => t.id === msg.id);
|
|
143
|
+
if (invocation && pending) {
|
|
144
|
+
try {
|
|
145
|
+
invocation.args = JSON.parse(pending.argsBuffer || "{}");
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
invocation.args = { raw: pending.argsBuffer };
|
|
149
|
+
}
|
|
150
|
+
pendingToolCalls.delete(msg.id);
|
|
151
|
+
if (onToolCall) {
|
|
152
|
+
try {
|
|
153
|
+
invocation.state = "call";
|
|
154
|
+
const result = await onToolCall({
|
|
155
|
+
id: msg.id,
|
|
156
|
+
name: invocation.name,
|
|
157
|
+
args: invocation.args,
|
|
158
|
+
});
|
|
159
|
+
invocation.result = result;
|
|
160
|
+
invocation.state = "result";
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
invocation.state = "error";
|
|
164
|
+
invocation.error = err.message;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
invocation.state = "call";
|
|
169
|
+
}
|
|
170
|
+
updateAssistantMessage(assistantMessage.id, (m) => ({
|
|
171
|
+
...m,
|
|
172
|
+
toolInvocations: [...toolInvocations],
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
97
175
|
break;
|
|
176
|
+
}
|
|
98
177
|
case "message_end":
|
|
99
178
|
if (msg.usage) {
|
|
100
|
-
|
|
101
|
-
|
|
179
|
+
updateAssistantMessage(assistantMessage.id, (m) => ({
|
|
180
|
+
...m,
|
|
181
|
+
usage: msg.usage,
|
|
182
|
+
}));
|
|
102
183
|
}
|
|
103
184
|
break;
|
|
104
185
|
case "error":
|
|
105
186
|
throw new Error(msg.error);
|
|
106
187
|
}
|
|
107
188
|
}
|
|
108
|
-
|
|
189
|
+
const finalMessage = {
|
|
190
|
+
...assistantMessage,
|
|
191
|
+
content,
|
|
192
|
+
toolInvocations: toolInvocations.length > 0 ? toolInvocations : undefined,
|
|
193
|
+
};
|
|
194
|
+
onFinish?.(finalMessage);
|
|
109
195
|
}
|
|
110
196
|
catch (err) {
|
|
111
197
|
if (err.name === "AbortError")
|
|
@@ -120,6 +206,48 @@ export function useChat(options) {
|
|
|
120
206
|
notify();
|
|
121
207
|
}
|
|
122
208
|
}
|
|
209
|
+
async function append(message) {
|
|
210
|
+
const userMessage = {
|
|
211
|
+
id: generateId(),
|
|
212
|
+
role: "user",
|
|
213
|
+
content: message.content,
|
|
214
|
+
createdAt: Date.now(),
|
|
215
|
+
};
|
|
216
|
+
const assistantMessage = {
|
|
217
|
+
id: generateId(),
|
|
218
|
+
role: "assistant",
|
|
219
|
+
content: "",
|
|
220
|
+
createdAt: Date.now(),
|
|
221
|
+
provider,
|
|
222
|
+
model,
|
|
223
|
+
};
|
|
224
|
+
state.messages = [...state.messages, userMessage, assistantMessage];
|
|
225
|
+
state.isLoading = true;
|
|
226
|
+
state.error = null;
|
|
227
|
+
notify();
|
|
228
|
+
await sendRequest([...state.messages.slice(0, -2), userMessage], assistantMessage);
|
|
229
|
+
}
|
|
230
|
+
async function reload() {
|
|
231
|
+
if (state.isLoading || state.messages.length === 0)
|
|
232
|
+
return;
|
|
233
|
+
const lastUserIdx = state.messages.findLastIndex((m) => m.role === "user");
|
|
234
|
+
if (lastUserIdx === -1)
|
|
235
|
+
return;
|
|
236
|
+
const messagesUpToLastUser = state.messages.slice(0, lastUserIdx + 1);
|
|
237
|
+
const assistantMessage = {
|
|
238
|
+
id: generateId(),
|
|
239
|
+
role: "assistant",
|
|
240
|
+
content: "",
|
|
241
|
+
createdAt: Date.now(),
|
|
242
|
+
provider,
|
|
243
|
+
model,
|
|
244
|
+
};
|
|
245
|
+
state.messages = [...messagesUpToLastUser, assistantMessage];
|
|
246
|
+
state.isLoading = true;
|
|
247
|
+
state.error = null;
|
|
248
|
+
notify();
|
|
249
|
+
await sendRequest(messagesUpToLastUser, assistantMessage);
|
|
250
|
+
}
|
|
123
251
|
function setMessages(newMessages) {
|
|
124
252
|
state.messages = [...newMessages];
|
|
125
253
|
notify();
|
|
@@ -137,6 +265,8 @@ export function useChat(options) {
|
|
|
137
265
|
get isLoading() { return state.isLoading; },
|
|
138
266
|
get error() { return state.error; },
|
|
139
267
|
handleSubmit,
|
|
268
|
+
append,
|
|
269
|
+
reload,
|
|
140
270
|
setMessages,
|
|
141
271
|
stop,
|
|
142
272
|
clear,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat.js","sourceRoot":"","sources":["../../../src/frameworks/svelte/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,SAAS,UAAU;IACjB,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,UAAU,EAAE,EAAE,CAAC;AAC7C,CAAC;
|
|
1
|
+
{"version":3,"file":"use-chat.js","sourceRoot":"","sources":["../../../src/frameworks/svelte/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,SAAS,UAAU;IACjB,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,UAAU,EAAE,EAAE,CAAC;AAC7C,CAAC;AAgBD,MAAM,UAAU,OAAO,CAAC,OAA2B;IACjD,MAAM,EACJ,GAAG,EACH,eAAe,GAAG,EAAE,EACpB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Extended options with tool calling support */
|
|
9
|
+
export interface UseChatToolOptions extends UseChatOptions {
|
|
10
|
+
maxSteps?: number;
|
|
11
|
+
onToolCall?: (toolCall: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
args: Record<string, unknown>;
|
|
15
|
+
}) => Promise<unknown> | unknown;
|
|
16
|
+
onStepFinish?: (step: {
|
|
17
|
+
step: number;
|
|
18
|
+
text: string;
|
|
19
|
+
toolCalls: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
args: Record<string, unknown>;
|
|
22
|
+
result: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
}) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function useChat(options: UseChatToolOptions): {
|
|
9
27
|
messages: Readonly<import("vue").Ref<readonly {
|
|
10
28
|
readonly id: string;
|
|
11
29
|
readonly role: "user" | "assistant" | "system";
|
|
@@ -20,6 +38,16 @@ export declare function useChat(options: UseChatOptions): {
|
|
|
20
38
|
readonly result?: Readonly<unknown> | undefined;
|
|
21
39
|
readonly state: "call" | "result" | "error";
|
|
22
40
|
readonly error?: string;
|
|
41
|
+
readonly rendered?: Readonly<unknown> | undefined;
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
readonly data?: readonly Readonly<unknown>[] | undefined;
|
|
44
|
+
readonly annotations?: readonly {
|
|
45
|
+
readonly type: string;
|
|
46
|
+
readonly data: Readonly<unknown>;
|
|
47
|
+
readonly range?: {
|
|
48
|
+
readonly start: number;
|
|
49
|
+
readonly end: number;
|
|
50
|
+
} | undefined;
|
|
23
51
|
}[] | undefined;
|
|
24
52
|
readonly provider?: string;
|
|
25
53
|
readonly model?: string;
|
|
@@ -42,6 +70,16 @@ export declare function useChat(options: UseChatOptions): {
|
|
|
42
70
|
readonly result?: Readonly<unknown> | undefined;
|
|
43
71
|
readonly state: "call" | "result" | "error";
|
|
44
72
|
readonly error?: string;
|
|
73
|
+
readonly rendered?: Readonly<unknown> | undefined;
|
|
74
|
+
}[] | undefined;
|
|
75
|
+
readonly data?: readonly Readonly<unknown>[] | undefined;
|
|
76
|
+
readonly annotations?: readonly {
|
|
77
|
+
readonly type: string;
|
|
78
|
+
readonly data: Readonly<unknown>;
|
|
79
|
+
readonly range?: {
|
|
80
|
+
readonly start: number;
|
|
81
|
+
readonly end: number;
|
|
82
|
+
} | undefined;
|
|
45
83
|
}[] | undefined;
|
|
46
84
|
readonly provider?: string;
|
|
47
85
|
readonly model?: string;
|
|
@@ -57,6 +95,11 @@ export declare function useChat(options: UseChatOptions): {
|
|
|
57
95
|
handleSubmit: (e?: {
|
|
58
96
|
preventDefault: () => void;
|
|
59
97
|
}) => Promise<void>;
|
|
98
|
+
append: (message: UIMessage | {
|
|
99
|
+
role: "user";
|
|
100
|
+
content: string;
|
|
101
|
+
}) => Promise<void>;
|
|
102
|
+
reload: () => Promise<void>;
|
|
60
103
|
setMessages: (newMessages: UIMessage[]) => void;
|
|
61
104
|
stop: () => void;
|
|
62
105
|
clear: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../../src/frameworks/vue/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../../src/frameworks/vue/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAoB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQlF,iDAAiD;AACjD,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAAC,MAAM,EAAE,OAAO,CAAA;SAAE,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;CACnJ;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA2KjB;QAAE,cAAc,EAAE,MAAM,IAAI,CAAA;KAAE;sBA8B/B,SAAS,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;;+BAgD1C,SAAS,EAAE;;;EAsB9C"}
|