@tanstack/ai-svelte 0.2.1 → 0.3.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/dist/create-chat.svelte.js +4 -0
- package/dist/types.d.ts +4 -0
- package/package.json +8 -8
- package/src/create-chat.svelte.ts +5 -0
- package/src/types.ts +5 -0
|
@@ -88,6 +88,9 @@ export function createChat(options) {
|
|
|
88
88
|
const addToolApprovalResponse = async (response) => {
|
|
89
89
|
await client.addToolApprovalResponse(response);
|
|
90
90
|
};
|
|
91
|
+
const updateBody = (newBody) => {
|
|
92
|
+
client.updateOptions({ body: newBody });
|
|
93
|
+
};
|
|
91
94
|
// Return the chat interface with reactive getters
|
|
92
95
|
// Using getters allows Svelte to track reactivity without needing $ prefix
|
|
93
96
|
return {
|
|
@@ -108,5 +111,6 @@ export function createChat(options) {
|
|
|
108
111
|
clear,
|
|
109
112
|
addToolResult,
|
|
110
113
|
addToolApprovalResponse,
|
|
114
|
+
updateBody,
|
|
111
115
|
};
|
|
112
116
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -71,4 +71,8 @@ export interface CreateChatReturn<TTools extends ReadonlyArray<AnyClientTool> =
|
|
|
71
71
|
* Clear all messages
|
|
72
72
|
*/
|
|
73
73
|
clear: () => void;
|
|
74
|
+
/**
|
|
75
|
+
* Update the body sent with requests (e.g., for changing model selection)
|
|
76
|
+
*/
|
|
77
|
+
updateBody: (body: Record<string, any>) => void;
|
|
74
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/ai-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Svelte bindings for TanStack AI",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,8 +33,11 @@
|
|
|
33
33
|
"streaming"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
|
|
36
|
+
"@tanstack/ai-client": "0.3.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"svelte": "^5.0.0",
|
|
40
|
+
"@tanstack/ai": "^0.3.0"
|
|
38
41
|
},
|
|
39
42
|
"devDependencies": {
|
|
40
43
|
"@sveltejs/package": "^2.3.10",
|
|
@@ -45,11 +48,8 @@
|
|
|
45
48
|
"svelte": "^5.20.0",
|
|
46
49
|
"svelte-check": "^4.2.0",
|
|
47
50
|
"typescript": "5.9.3",
|
|
48
|
-
"vite": "^7.2.7"
|
|
49
|
-
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"svelte": "^5.0.0",
|
|
52
|
-
"@tanstack/ai": "^0.2.1"
|
|
51
|
+
"vite": "^7.2.7",
|
|
52
|
+
"@tanstack/ai": "0.3.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"clean": "rm -rf ./dist",
|
|
@@ -115,6 +115,10 @@ export function createChat<TTools extends ReadonlyArray<AnyClientTool> = any>(
|
|
|
115
115
|
await client.addToolApprovalResponse(response)
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
const updateBody = (newBody: Record<string, any>) => {
|
|
119
|
+
client.updateOptions({ body: newBody })
|
|
120
|
+
}
|
|
121
|
+
|
|
118
122
|
// Return the chat interface with reactive getters
|
|
119
123
|
// Using getters allows Svelte to track reactivity without needing $ prefix
|
|
120
124
|
return {
|
|
@@ -135,5 +139,6 @@ export function createChat<TTools extends ReadonlyArray<AnyClientTool> = any>(
|
|
|
135
139
|
clear,
|
|
136
140
|
addToolResult,
|
|
137
141
|
addToolApprovalResponse,
|
|
142
|
+
updateBody,
|
|
138
143
|
}
|
|
139
144
|
}
|
package/src/types.ts
CHANGED
|
@@ -96,6 +96,11 @@ export interface CreateChatReturn<
|
|
|
96
96
|
* Clear all messages
|
|
97
97
|
*/
|
|
98
98
|
clear: () => void
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Update the body sent with requests (e.g., for changing model selection)
|
|
102
|
+
*/
|
|
103
|
+
updateBody: (body: Record<string, any>) => void
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
// Note: createChatClientOptions and InferChatMessages are now in @tanstack/ai-client
|