@ai-sdk/solid
Advanced tools
Comparing version 0.0.23 to 0.0.24
# @ai-sdk/solid | ||
## 0.0.24 | ||
### Patch Changes | ||
- c450fcf7: feat (ui): invoke useChat onFinish with finishReason and tokens | ||
- e4a1719f: chore (ai/ui): rename streamMode to streamProtocol | ||
- Updated dependencies [c450fcf7] | ||
- Updated dependencies [e4a1719f] | ||
- @ai-sdk/ui-utils@0.0.21 | ||
## 0.0.23 | ||
@@ -4,0 +14,0 @@ |
@@ -32,3 +32,3 @@ "use strict"; | ||
var import_store = require("solid-js/store"); | ||
var getStreamedResponse = async (api, chatRequest, mutate, setStreamData, streamData, extraMetadata, messagesRef, abortController, generateId, streamMode, onFinish, onResponse, onToolCall, sendExtraMessageFields, fetch, keepLastMessageOnError) => { | ||
var getStreamedResponse = async (api, chatRequest, mutate, setStreamData, streamData, extraMetadata, messagesRef, abortController, generateId, streamProtocol, onFinish, onResponse, onToolCall, sendExtraMessageFields, fetch, keepLastMessageOnError) => { | ||
var _a; | ||
@@ -56,3 +56,3 @@ const previousMessages = messagesRef; | ||
}, | ||
streamMode, | ||
streamProtocol, | ||
credentials: extraMetadata.credentials, | ||
@@ -142,3 +142,3 @@ headers: { | ||
getStreamedResponse: () => { | ||
var _a3, _b3, _c3, _d3, _e3, _f3, _g3, _h2, _i, _j, _k, _l, _m, _n, _o; | ||
var _a3, _b3, _c3, _d3, _e3, _f3, _g3, _h2, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r; | ||
return getStreamedResponse( | ||
@@ -154,9 +154,10 @@ api(), | ||
generateId(), | ||
(_b3 = (_a3 = useChatOptions()).streamMode) == null ? void 0 : _b3.call(_a3), | ||
(_d3 = (_c3 = useChatOptions()).onFinish) == null ? void 0 : _d3.call(_c3), | ||
(_f3 = (_e3 = useChatOptions()).onResponse) == null ? void 0 : _f3.call(_e3), | ||
(_h2 = (_g3 = useChatOptions()).onToolCall) == null ? void 0 : _h2.call(_g3), | ||
(_j = (_i = useChatOptions()).sendExtraMessageFields) == null ? void 0 : _j.call(_i), | ||
(_l = (_k = useChatOptions()).fetch) == null ? void 0 : _l.call(_k), | ||
(_o = (_n = (_m = useChatOptions()).keepLastMessageOnError) == null ? void 0 : _n.call(_m)) != null ? _o : false | ||
// streamMode is deprecated, use streamProtocol instead: | ||
((_e3 = (_b3 = (_a3 = useChatOptions()).streamProtocol) == null ? void 0 : _b3.call(_a3)) != null ? _e3 : ((_d3 = (_c3 = useChatOptions()).streamMode) == null ? void 0 : _d3.call(_c3)) === "text") ? "text" : void 0, | ||
(_g3 = (_f3 = useChatOptions()).onFinish) == null ? void 0 : _g3.call(_f3), | ||
(_i = (_h2 = useChatOptions()).onResponse) == null ? void 0 : _i.call(_h2), | ||
(_k = (_j = useChatOptions()).onToolCall) == null ? void 0 : _k.call(_j), | ||
(_m = (_l = useChatOptions()).sendExtraMessageFields) == null ? void 0 : _m.call(_l), | ||
(_o = (_n = useChatOptions()).fetch) == null ? void 0 : _o.call(_n), | ||
(_r = (_q = (_p = useChatOptions()).keepLastMessageOnError) == null ? void 0 : _q.call(_p)) != null ? _r : false | ||
); | ||
@@ -415,3 +416,3 @@ }, | ||
const complete = async (prompt, options) => { | ||
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m; | ||
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p; | ||
const existingData = (_a2 = streamData()) != null ? _a2 : []; | ||
@@ -427,3 +428,4 @@ return (0, import_ui_utils2.callCompletionApi)({ | ||
}, | ||
streamMode: (_e2 = (_d2 = useCompletionOptions()).streamMode) == null ? void 0 : _e2.call(_d2), | ||
// streamMode is deprecated, use streamProtocol instead: | ||
streamProtocol: ((_h2 = (_e2 = (_d2 = useCompletionOptions()).streamProtocol) == null ? void 0 : _e2.call(_d2)) != null ? _h2 : ((_g2 = (_f2 = useCompletionOptions()).streamMode) == null ? void 0 : _g2.call(_f2)) === "text") ? "text" : void 0, | ||
setCompletion: mutate, | ||
@@ -433,9 +435,9 @@ setLoading: setIsLoading, | ||
setAbortController, | ||
onResponse: (_g2 = (_f2 = useCompletionOptions()).onResponse) == null ? void 0 : _g2.call(_f2), | ||
onFinish: (_i2 = (_h2 = useCompletionOptions()).onFinish) == null ? void 0 : _i2.call(_h2), | ||
onError: (_k = (_j = useCompletionOptions()).onError) == null ? void 0 : _k.call(_j), | ||
onResponse: (_j = (_i2 = useCompletionOptions()).onResponse) == null ? void 0 : _j.call(_i2), | ||
onFinish: (_l = (_k = useCompletionOptions()).onFinish) == null ? void 0 : _l.call(_k), | ||
onError: (_n = (_m = useCompletionOptions()).onError) == null ? void 0 : _n.call(_m), | ||
onData: (data) => { | ||
setStreamData([...existingData, ...data != null ? data : []]); | ||
}, | ||
fetch: (_m = (_l = useCompletionOptions()).fetch) == null ? void 0 : _m.call(_l) | ||
fetch: (_p = (_o = useCompletionOptions()).fetch) == null ? void 0 : _p.call(_o) | ||
}); | ||
@@ -442,0 +444,0 @@ }; |
{ | ||
"name": "@ai-sdk/solid", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"license": "Apache-2.0", | ||
@@ -19,3 +19,3 @@ "sideEffects": false, | ||
"@ai-sdk/provider-utils": "1.0.5", | ||
"@ai-sdk/ui-utils": "0.0.20" | ||
"@ai-sdk/ui-utils": "0.0.21" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
@@ -100,4 +100,4 @@ import type { | ||
generateId: IdGenerator, | ||
streamMode: 'stream-data' | 'text' | undefined, | ||
onFinish: UseChatOptions['onFinish'] | undefined, | ||
streamProtocol: UseChatOptions['streamProtocol'], | ||
onFinish: UseChatOptions['onFinish'], | ||
onResponse: UseChatOptions['onResponse'] | undefined, | ||
@@ -138,3 +138,3 @@ onToolCall: UseChatOptions['onToolCall'] | undefined, | ||
}, | ||
streamMode, | ||
streamProtocol, | ||
credentials: extraMetadata.credentials, | ||
@@ -262,3 +262,7 @@ headers: { | ||
generateId(), | ||
useChatOptions().streamMode?.(), | ||
// streamMode is deprecated, use streamProtocol instead: | ||
useChatOptions().streamProtocol?.() ?? | ||
useChatOptions().streamMode?.() === 'text' | ||
? 'text' | ||
: undefined, | ||
useChatOptions().onFinish?.(), | ||
@@ -265,0 +269,0 @@ useChatOptions().onResponse?.(), |
@@ -138,3 +138,8 @@ import type { | ||
}, | ||
streamMode: useCompletionOptions().streamMode?.(), | ||
// streamMode is deprecated, use streamProtocol instead: | ||
streamProtocol: | ||
useCompletionOptions().streamProtocol?.() ?? | ||
useCompletionOptions().streamMode?.() === 'text' | ||
? 'text' | ||
: undefined, | ||
setCompletion: mutate, | ||
@@ -141,0 +146,0 @@ setLoading: setIsLoading, |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165669
2640
+ Added@ai-sdk/ui-utils@0.0.21(transitive)
- Removed@ai-sdk/ui-utils@0.0.20(transitive)
Updated@ai-sdk/ui-utils@0.0.21