Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/react

Package Overview
Dependencies
Maintainers
2
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/react - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

8

CHANGELOG.md
# @ai-sdk/react
## 1.0.11
### Patch Changes
- 37f4510: feat (ui): expose useChat id and send it to the server
- Updated dependencies [37f4510]
- @ai-sdk/ui-utils@1.0.10
## 1.0.10

@@ -4,0 +12,0 @@

2

dist/index.d.ts

@@ -110,2 +110,4 @@ import { Message, CreateMessage, AssistantStatus, UseAssistantOptions, ChatRequestOptions, JSONValue, UseChatOptions, RequestOptions, UseCompletionOptions, Schema, DeepPartial } from '@ai-sdk/ui-utils';

setData: (data: JSONValue[] | undefined | ((data: JSONValue[] | undefined) => JSONValue[] | undefined)) => void;
/** The id of the chat */
id: string;
};

@@ -112,0 +114,0 @@ declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, onToolCall, experimental_prepareRequestBody, maxSteps, streamProtocol, onResponse, onFinish, onError, credentials, headers, body, generateId, fetch, keepLastMessageOnError, experimental_throttle: throttleWaitMs, }?: UseChatOptions & {

17

dist/index.js

@@ -216,3 +216,3 @@ "use strict";

// src/use-chat.ts
var processResponseStream = async (api, chatRequest, mutate, mutateStreamData, existingDataRef, extraMetadataRef, messagesRef, abortControllerRef, generateId2, streamProtocol, onFinish, onResponse, onToolCall, sendExtraMessageFields, experimental_prepareRequestBody, fetch2, keepLastMessageOnError) => {
var processResponseStream = async (api, chatRequest, mutate, mutateStreamData, existingDataRef, extraMetadataRef, messagesRef, abortControllerRef, generateId2, streamProtocol, onFinish, onResponse, onToolCall, sendExtraMessageFields, experimental_prepareRequestBody, fetch2, keepLastMessageOnError, id) => {
var _a;

@@ -244,2 +244,3 @@ const previousMessages = messagesRef.current;

body: (_a = experimental_prepareRequestBody == null ? void 0 : experimental_prepareRequestBody({
id,
messages: chatRequest.messages,

@@ -249,2 +250,3 @@ requestData: chatRequest.data,

})) != null ? _a : {
id,
messages: constructedMessagesPayload,

@@ -301,5 +303,5 @@ data: chatRequest.data,

} = {}) {
const hookId = (0, import_react2.useId)();
const idKey = id != null ? id : hookId;
const chatKey = typeof api === "string" ? [api, idKey] : idKey;
const [hookId] = (0, import_react2.useState)(generateId2);
const chatId = id != null ? id : hookId;
const chatKey = typeof api === "string" ? [api, chatId] : chatId;
const [initialMessagesFallback] = (0, import_react2.useState)([]);

@@ -364,3 +366,4 @@ const { data: messages, mutate } = (0, import_swr.default)(

fetch2,
keepLastMessageOnError
keepLastMessageOnError,
chatId
);

@@ -414,3 +417,4 @@ abortControllerRef.current = null;

keepLastMessageOnError,
throttleWaitMs
throttleWaitMs,
chatId
]

@@ -545,2 +549,3 @@ );

messages: messages || [],
id: chatId,
setMessages,

@@ -547,0 +552,0 @@ data: streamData,

{
"name": "@ai-sdk/react",
"version": "1.0.10",
"version": "1.0.11",
"license": "Apache-2.0",

@@ -23,3 +23,3 @@ "sideEffects": false,

"@ai-sdk/provider-utils": "2.0.7",
"@ai-sdk/ui-utils": "1.0.9",
"@ai-sdk/ui-utils": "1.0.10",
"swr": "^2.2.5",

@@ -26,0 +26,0 @@ "throttleit": "2.1.0"

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc