@merit-systems/echo-react-sdk 1.0.27 → 1.0.29
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/index.cjs +2 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -7
- package/dist/index.d.ts +3 -7
- package/dist/index.js +2 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ import * as _merit_systems_echo_typescript_sdk from '@merit-systems/echo-typescr
|
|
|
6
6
|
import { EchoConfig, Balance, EchoClient, FreeBalance } from '@merit-systems/echo-typescript-sdk';
|
|
7
7
|
import * as openai from 'openai';
|
|
8
8
|
import * as ai from 'ai';
|
|
9
|
-
import { ChatTransport, UIMessage,
|
|
9
|
+
import { ChatTransport, UIMessage, UIMessageChunk } from 'ai';
|
|
10
10
|
import * as _ai_sdk_react from '@ai-sdk/react';
|
|
11
11
|
|
|
12
12
|
interface EchoAuthConfig extends EchoConfig {
|
|
@@ -129,11 +129,7 @@ declare const useEchoModelProviders: () => {
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
type ChatSendParams = Parameters<ChatTransport<UIMessage>['sendMessages']>[0];
|
|
132
|
-
type
|
|
133
|
-
uiMessages: UIMessage[];
|
|
134
|
-
modelMessages: ModelMessage[];
|
|
135
|
-
};
|
|
136
|
-
type EchoChatFn = (ctx: EchoChatBuildContext) => Promise<ReadableStream<UIMessageChunk>> | ReadableStream<UIMessageChunk>;
|
|
132
|
+
type EchoChatFn = (ctx: ChatSendParams) => Promise<ReadableStream<UIMessageChunk>> | ReadableStream<UIMessageChunk>;
|
|
137
133
|
declare function EchoChatProvider({ chatFn, children, }: {
|
|
138
134
|
chatFn: EchoChatFn;
|
|
139
135
|
children: React.ReactNode;
|
|
@@ -161,4 +157,4 @@ interface EchoContextValue {
|
|
|
161
157
|
}
|
|
162
158
|
declare const EchoContext: React$1.Context<EchoContextValue | null>;
|
|
163
159
|
|
|
164
|
-
export { type EchoBalance, EchoChatProvider, type EchoAuthConfig as EchoConfig, EchoContext, type EchoContextValue, EchoProvider, EchoProviderRaw, type EchoProviderRawProps, EchoSignIn, type EchoSignInProps, EchoSignOut, type EchoSignOutProps, EchoTokens, type EchoTokensProps, type EchoUser, InsufficientFundsModal, Logo, useChat, useEcho, useEchoClient, useEchoModelProviders, useEchoOpenAI };
|
|
160
|
+
export { type ChatSendParams, type EchoBalance, EchoChatProvider, type EchoAuthConfig as EchoConfig, EchoContext, type EchoContextValue, EchoProvider, EchoProviderRaw, type EchoProviderRawProps, EchoSignIn, type EchoSignInProps, EchoSignOut, type EchoSignOutProps, EchoTokens, type EchoTokensProps, type EchoUser, InsufficientFundsModal, Logo, useChat, useEcho, useEchoClient, useEchoModelProviders, useEchoOpenAI };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as _merit_systems_echo_typescript_sdk from '@merit-systems/echo-typescr
|
|
|
6
6
|
import { EchoConfig, Balance, EchoClient, FreeBalance } from '@merit-systems/echo-typescript-sdk';
|
|
7
7
|
import * as openai from 'openai';
|
|
8
8
|
import * as ai from 'ai';
|
|
9
|
-
import { ChatTransport, UIMessage,
|
|
9
|
+
import { ChatTransport, UIMessage, UIMessageChunk } from 'ai';
|
|
10
10
|
import * as _ai_sdk_react from '@ai-sdk/react';
|
|
11
11
|
|
|
12
12
|
interface EchoAuthConfig extends EchoConfig {
|
|
@@ -129,11 +129,7 @@ declare const useEchoModelProviders: () => {
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
type ChatSendParams = Parameters<ChatTransport<UIMessage>['sendMessages']>[0];
|
|
132
|
-
type
|
|
133
|
-
uiMessages: UIMessage[];
|
|
134
|
-
modelMessages: ModelMessage[];
|
|
135
|
-
};
|
|
136
|
-
type EchoChatFn = (ctx: EchoChatBuildContext) => Promise<ReadableStream<UIMessageChunk>> | ReadableStream<UIMessageChunk>;
|
|
132
|
+
type EchoChatFn = (ctx: ChatSendParams) => Promise<ReadableStream<UIMessageChunk>> | ReadableStream<UIMessageChunk>;
|
|
137
133
|
declare function EchoChatProvider({ chatFn, children, }: {
|
|
138
134
|
chatFn: EchoChatFn;
|
|
139
135
|
children: React.ReactNode;
|
|
@@ -161,4 +157,4 @@ interface EchoContextValue {
|
|
|
161
157
|
}
|
|
162
158
|
declare const EchoContext: React$1.Context<EchoContextValue | null>;
|
|
163
159
|
|
|
164
|
-
export { type EchoBalance, EchoChatProvider, type EchoAuthConfig as EchoConfig, EchoContext, type EchoContextValue, EchoProvider, EchoProviderRaw, type EchoProviderRawProps, EchoSignIn, type EchoSignInProps, EchoSignOut, type EchoSignOutProps, EchoTokens, type EchoTokensProps, type EchoUser, InsufficientFundsModal, Logo, useChat, useEcho, useEchoClient, useEchoModelProviders, useEchoOpenAI };
|
|
160
|
+
export { type ChatSendParams, type EchoBalance, EchoChatProvider, type EchoAuthConfig as EchoConfig, EchoContext, type EchoContextValue, EchoProvider, EchoProviderRaw, type EchoProviderRawProps, EchoSignIn, type EchoSignInProps, EchoSignOut, type EchoSignOutProps, EchoTokens, type EchoTokensProps, type EchoUser, InsufficientFundsModal, Logo, useChat, useEcho, useEchoClient, useEchoModelProviders, useEchoOpenAI };
|
package/dist/index.js
CHANGED
|
@@ -136337,21 +136337,11 @@ function useEchoChatConfig() {
|
|
|
136337
136337
|
|
|
136338
136338
|
// src/hooks/useChat.ts
|
|
136339
136339
|
import { useChat as useChatBase } from "@ai-sdk/react";
|
|
136340
|
-
import { convertToModelMessages } from "ai";
|
|
136341
136340
|
function createInMemoryChatTransport() {
|
|
136342
136341
|
const chatFn = useEchoChatConfig();
|
|
136343
136342
|
return {
|
|
136344
|
-
async
|
|
136345
|
-
|
|
136346
|
-
const coreMessages = convertToModelMessages(
|
|
136347
|
-
messages.map(({ role, parts, metadata }) => ({ role, parts, metadata }))
|
|
136348
|
-
);
|
|
136349
|
-
return await chatFn({
|
|
136350
|
-
uiMessages: messages,
|
|
136351
|
-
modelMessages: coreMessages,
|
|
136352
|
-
abortSignal,
|
|
136353
|
-
...rest
|
|
136354
|
-
});
|
|
136343
|
+
sendMessages: async (options) => {
|
|
136344
|
+
return chatFn(options);
|
|
136355
136345
|
},
|
|
136356
136346
|
async reconnectToStream() {
|
|
136357
136347
|
return null;
|