@tanstack/ai-svelte 0.4.0 → 0.5.1

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/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { AnyClientTool, ModelMessage } from '@tanstack/ai';
2
- import type { ChatClientOptions, ChatClientState, ChatRequestBody, UIMessage } from '@tanstack/ai-client';
3
- export type { ChatRequestBody, UIMessage };
2
+ import type { ChatClientOptions, ChatClientState, ChatRequestBody, MultimodalContent, UIMessage } from '@tanstack/ai-client';
3
+ export type { ChatRequestBody, MultimodalContent, UIMessage };
4
4
  /**
5
5
  * Options for the createChat function.
6
6
  *
@@ -24,9 +24,10 @@ export interface CreateChatReturn<TTools extends ReadonlyArray<AnyClientTool> =
24
24
  */
25
25
  readonly messages: Array<UIMessage<TTools>>;
26
26
  /**
27
- * Send a message and get a response
27
+ * Send a message and get a response.
28
+ * Can be a simple string or multimodal content with images, audio, etc.
28
29
  */
29
- sendMessage: (content: string) => Promise<void>;
30
+ sendMessage: (content: string | MultimodalContent) => Promise<void>;
30
31
  /**
31
32
  * Append a message to the conversation
32
33
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/ai-svelte",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Svelte bindings for TanStack AI",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -33,11 +33,11 @@
33
33
  "streaming"
34
34
  ],
35
35
  "dependencies": {
36
- "@tanstack/ai-client": "0.4.0"
36
+ "@tanstack/ai-client": "0.4.2"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "svelte": "^5.0.0",
40
- "@tanstack/ai": "^0.3.1"
40
+ "@tanstack/ai": "^0.4.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@sveltejs/package": "^2.3.10",
@@ -49,7 +49,7 @@
49
49
  "svelte-check": "^4.2.0",
50
50
  "typescript": "5.9.3",
51
51
  "vite": "^7.2.7",
52
- "@tanstack/ai": "0.3.1"
52
+ "@tanstack/ai": "0.4.1"
53
53
  },
54
54
  "scripts": {
55
55
  "clean": "rm -rf ./dist",
@@ -1,7 +1,12 @@
1
1
  import { ChatClient } from '@tanstack/ai-client'
2
2
  import type { ChatClientState } from '@tanstack/ai-client'
3
3
  import type { AnyClientTool, ModelMessage } from '@tanstack/ai'
4
- import type { CreateChatOptions, CreateChatReturn, UIMessage } from './types'
4
+ import type {
5
+ CreateChatOptions,
6
+ CreateChatReturn,
7
+ MultimodalContent,
8
+ UIMessage,
9
+ } from './types'
5
10
 
6
11
  /**
7
12
  * Creates a reactive chat instance for Svelte 5.
@@ -83,7 +88,7 @@ export function createChat<TTools extends ReadonlyArray<AnyClientTool> = any>(
83
88
  // Users should call chat.stop() in their component's cleanup if needed.
84
89
 
85
90
  // Define methods
86
- const sendMessage = async (content: string) => {
91
+ const sendMessage = async (content: string | MultimodalContent) => {
87
92
  await client.sendMessage(content)
88
93
  }
89
94
 
package/src/types.ts CHANGED
@@ -3,11 +3,12 @@ import type {
3
3
  ChatClientOptions,
4
4
  ChatClientState,
5
5
  ChatRequestBody,
6
+ MultimodalContent,
6
7
  UIMessage,
7
8
  } from '@tanstack/ai-client'
8
9
 
9
10
  // Re-export types from ai-client
10
- export type { ChatRequestBody, UIMessage }
11
+ export type { ChatRequestBody, MultimodalContent, UIMessage }
11
12
 
12
13
  /**
13
14
  * Options for the createChat function.
@@ -41,9 +42,10 @@ export interface CreateChatReturn<
41
42
  readonly messages: Array<UIMessage<TTools>>
42
43
 
43
44
  /**
44
- * Send a message and get a response
45
+ * Send a message and get a response.
46
+ * Can be a simple string or multimodal content with images, audio, etc.
45
47
  */
46
- sendMessage: (content: string) => Promise<void>
48
+ sendMessage: (content: string | MultimodalContent) => Promise<void>
47
49
 
48
50
  /**
49
51
  * Append a message to the conversation