@ai-sdk/svelte
Advanced tools
Comparing version 0.0.51 to 0.0.52
@@ -313,2 +313,8 @@ "use strict"; | ||
}; | ||
const setData = (dataArg) => { | ||
if (typeof dataArg === "function") { | ||
dataArg = dataArg((0, import_store.get)(streamData)); | ||
} | ||
streamData.set(dataArg); | ||
}; | ||
const input = (0, import_store.writable)(initialInput); | ||
@@ -380,2 +386,3 @@ const handleSubmit = (event, options = {}) => { | ||
data: streamData, | ||
setData, | ||
addToolResult | ||
@@ -382,0 +389,0 @@ }; |
# @ai-sdk/svelte | ||
## 0.0.52 | ||
### Patch Changes | ||
- caedcda: feat (ai/ui): add setData helper to useChat | ||
## 0.0.51 | ||
@@ -4,0 +10,0 @@ |
@@ -69,2 +69,4 @@ import { UseChatOptions as UseChatOptions$1, Message, CreateMessage, ChatRequestOptions, JSONValue, RequestOptions, UseCompletionOptions, AssistantStatus, UseAssistantOptions } from '@ai-sdk/ui-utils'; | ||
data: Readable<JSONValue[] | undefined>; | ||
/** Set the data of the chat. You can use this to transform or clear the chat data. */ | ||
setData: (data: JSONValue[] | undefined | ((data: JSONValue[] | undefined) => JSONValue[] | undefined)) => void; | ||
}; | ||
@@ -71,0 +73,0 @@ declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, experimental_onFunctionCall, experimental_onToolCall, streamMode, streamProtocol, onResponse, onFinish, onError, onToolCall, credentials, headers, body, generateId, fetch, keepLastMessageOnError, maxToolRoundtrips, maxSteps, }?: UseChatOptions): UseChatHelpers & { |
@@ -313,2 +313,8 @@ "use strict"; | ||
}; | ||
const setData = (dataArg) => { | ||
if (typeof dataArg === "function") { | ||
dataArg = dataArg((0, import_store.get)(streamData)); | ||
} | ||
streamData.set(dataArg); | ||
}; | ||
const input = (0, import_store.writable)(initialInput); | ||
@@ -380,2 +386,3 @@ const handleSubmit = (event, options = {}) => { | ||
data: streamData, | ||
setData, | ||
addToolResult | ||
@@ -382,0 +389,0 @@ }; |
{ | ||
"name": "@ai-sdk/svelte", | ||
"version": "0.0.51", | ||
"version": "0.0.52", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
163098
2111