@assistant-ui/react 0.5.71 → 0.5.73

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Attachment, P as PendingAttachment, T as ThreadMessage, C as CoreMessage, a as AppendMessage, M as ModelConfig, b as ModelConfigProvider, c as ThreadAssistantContentPart, d as MessageStatus, e as ThreadRoundtrip, f as PendingAttachmentStatus, g as CompleteAttachment, h as CompleteAttachmentStatus, i as Tool, j as TextContentPart, I as ImageContentPart, k as ToolCallContentPart, l as CoreToolCallContentPart, U as UIContentPart, m as CreateEdgeRuntimeAPIOptions, n as ThreadUserContentPart, o as ContentPartStatus, p as ToolCallContentPartStatus } from './edge-DRioHVD9.js';
2
- export { q as AttachmentStatus, v as CoreAssistantContentPart, y as CoreAssistantMessage, w as CoreSystemMessage, u as CoreUserContentPart, x as CoreUserMessage, E as EdgeRuntimeRequestOptions, s as ThreadAssistantMessage, r as ThreadSystemMessage, t as ThreadUserMessage } from './edge-DRioHVD9.js';
1
+ import { A as Attachment, P as PendingAttachment, T as ThreadMessage, C as CoreMessage, a as AppendMessage, M as ModelConfig, b as ModelConfigProvider, c as ThreadAssistantContentPart, d as MessageStatus, e as ThreadStep, f as PendingAttachmentStatus, g as CompleteAttachment, h as CompleteAttachmentStatus, i as Tool, j as TextContentPart, I as ImageContentPart, k as ToolCallContentPart, l as CoreToolCallContentPart, U as UIContentPart, m as CreateEdgeRuntimeAPIOptions, n as ThreadUserContentPart, o as ContentPartStatus, p as ToolCallContentPartStatus } from './edge-rTP-G718.js';
2
+ export { q as AttachmentStatus, v as CoreAssistantContentPart, y as CoreAssistantMessage, w as CoreSystemMessage, u as CoreUserContentPart, x as CoreUserMessage, E as EdgeRuntimeRequestOptions, s as ThreadAssistantMessage, r as ThreadSystemMessage, t as ThreadUserMessage } from './edge-rTP-G718.js';
3
3
  import * as react from 'react';
4
4
  import { ComponentType, PropsWithChildren, FC, ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
5
5
  import { StoreApi, UseBoundStore } from 'zustand';
@@ -159,7 +159,11 @@ type ChatModelRunResult = {
159
159
  content?: ThreadAssistantContentPart[];
160
160
  status?: MessageStatus;
161
161
  metadata?: {
162
- roundtrips?: ThreadRoundtrip[];
162
+ /**
163
+ * @deprecated Use `steps` instead. This field will be removed in v0.6.
164
+ */
165
+ roundtrips?: ThreadStep[];
166
+ steps?: ThreadStep[];
163
167
  custom?: Record<string, unknown>;
164
168
  };
165
169
  };
@@ -280,6 +284,10 @@ type FeedbackAdapter = {
280
284
 
281
285
  type LocalRuntimeOptions = {
282
286
  initialMessages?: readonly CoreMessage[] | undefined;
287
+ maxSteps?: number | undefined;
288
+ /**
289
+ * @deprecated Use `maxSteps` (which is `maxToolRoundtrips` + 1; if you set `maxToolRoundtrips` to 2, set `maxSteps` to 3) instead. This field will be removed in v0.6.
290
+ */
283
291
  maxToolRoundtrips?: number | undefined;
284
292
  adapters?: {
285
293
  attachments?: AttachmentAdapter | undefined;
@@ -401,9 +409,9 @@ declare const useLocalRuntime: (adapter: ChatModelAdapter, options?: LocalRuntim
401
409
  declare function toLanguageModelMessages(message: readonly CoreMessage[] | readonly ThreadMessage[]): LanguageModelV1Message[];
402
410
 
403
411
  type fromLanguageModelMessagesOptions = {
404
- mergeRoundtrips: boolean;
412
+ mergeSteps: boolean;
405
413
  };
406
- declare const fromLanguageModelMessages: (lm: LanguageModelV1Message[], { mergeRoundtrips }: fromLanguageModelMessagesOptions) => CoreMessage[];
414
+ declare const fromLanguageModelMessages: (lm: LanguageModelV1Message[], { mergeSteps }: fromLanguageModelMessagesOptions) => CoreMessage[];
407
415
 
408
416
  declare const fromCoreMessages: (message: readonly CoreMessage[]) => ThreadMessage[];
409
417
  declare const fromCoreMessage: (message: CoreMessage, { id, status, attachments, }?: {
@@ -455,7 +463,7 @@ declare class EdgeChatAdapter implements ChatModelAdapter {
455
463
  }
456
464
 
457
465
  type EdgeRuntimeOptions = EdgeChatAdapterOptions & LocalRuntimeOptions;
458
- declare const useEdgeRuntime: ({ initialMessages, maxToolRoundtrips, adapters, ...options }: EdgeRuntimeOptions) => LocalRuntime;
466
+ declare const useEdgeRuntime: (options: EdgeRuntimeOptions) => LocalRuntime;
459
467
 
460
468
  type ThreadMessageLike = {
461
469
  role: "assistant" | "user" | "system";
@@ -519,7 +527,7 @@ declare const useExternalMessageConverter: <T extends WeakKey>({ callback, messa
519
527
  type DangerousInBrowserAdapterOptions = CreateEdgeRuntimeAPIOptions;
520
528
 
521
529
  type DangerousInBrowserRuntimeOptions = DangerousInBrowserAdapterOptions & LocalRuntimeOptions;
522
- declare const useDangerousInBrowserRuntime: ({ initialMessages, ...options }: DangerousInBrowserRuntimeOptions) => LocalRuntime;
530
+ declare const useDangerousInBrowserRuntime: (options: DangerousInBrowserRuntimeOptions) => LocalRuntime;
523
531
 
524
532
  type Subscribable = {
525
533
  subscribe: (callback: () => void) => Unsubscribe;
@@ -2165,7 +2173,7 @@ type AvatarProps = {
2165
2173
  };
2166
2174
 
2167
2175
  type SuggestionConfig = {
2168
- text?: ReactNode;
2176
+ text?: ReactNode | undefined;
2169
2177
  prompt: string;
2170
2178
  };
2171
2179
  type ThreadWelcomeConfig = {
@@ -2279,18 +2287,19 @@ type StringsConfig = {
2279
2287
  };
2280
2288
  };
2281
2289
  type ThreadConfig = {
2282
- runtime?: AssistantRuntime;
2283
- assistantAvatar?: AvatarProps;
2284
- welcome?: ThreadWelcomeConfig;
2285
- assistantMessage?: AssistantMessageConfig;
2286
- userMessage?: UserMessageConfig;
2287
- branchPicker?: BranchPickerConfig;
2288
- composer?: ComposerConfig;
2289
- strings?: StringsConfig;
2290
- tools?: AssistantToolUI[];
2290
+ runtime?: AssistantRuntime | undefined;
2291
+ assistantAvatar?: AvatarProps | undefined;
2292
+ welcome?: ThreadWelcomeConfig | undefined;
2293
+ assistantMessage?: AssistantMessageConfig | undefined;
2294
+ userMessage?: UserMessageConfig | undefined;
2295
+ branchPicker?: BranchPickerConfig | undefined;
2296
+ composer?: ComposerConfig | undefined;
2297
+ strings?: StringsConfig | undefined;
2298
+ tools?: AssistantToolUI[] | undefined;
2291
2299
  components?: {
2292
- Composer: ComponentType;
2293
- };
2300
+ Composer?: ComponentType | undefined;
2301
+ ThreadWelcome?: ComponentType | undefined;
2302
+ } | undefined;
2294
2303
  };
2295
2304
  declare const useThreadConfig: () => Omit<ThreadConfig, "runtime">;
2296
2305
  type ThreadConfigProviderProps = PropsWithChildren<{