@assistant-ui/react 0.5.27 → 0.5.29
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{AssistantTypes-BNB-knVq.d.mts → AssistantTypes-Bo5YKjhV.d.mts} +3 -1
- package/dist/{AssistantTypes-BNB-knVq.d.ts → AssistantTypes-Bo5YKjhV.d.ts} +3 -1
- package/dist/{chunk-NSPHKRLF.js → chunk-CTVBRM6C.js} +46 -14
- package/dist/chunk-CTVBRM6C.js.map +1 -0
- package/dist/{chunk-ZWRFAYHH.mjs → chunk-DXLSOE2J.mjs} +45 -13
- package/dist/chunk-DXLSOE2J.mjs.map +1 -0
- package/dist/edge.d.mts +3 -1
- package/dist/edge.d.ts +3 -1
- package/dist/edge.js +73 -44
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +73 -44
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +26 -4
- package/dist/index.d.ts +26 -4
- package/dist/index.js +65 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -43
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-NSPHKRLF.js.map +0 -1
- package/dist/chunk-ZWRFAYHH.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as react from 'react';
|
2
2
|
import { ComponentType, PropsWithChildren, ComponentPropsWithoutRef, FC, ElementType, ReactNode } from 'react';
|
3
|
-
import { T as ThreadAssistantContentPart, M as MessageStatus, a as ThreadRoundtrip, b as ThreadMessage, c as ModelConfig, d as ModelConfigProvider, e as TextContentPart, C as ContentPartStatus, I as ImageContentPart, U as UIContentPart, f as ToolCallContentPart, g as ToolCallContentPartStatus, h as CoreMessage, A as AppendMessage, i as Tool, j as CoreToolCallContentPart } from './AssistantTypes-
|
4
|
-
export { p as CoreAssistantContentPart, s as CoreAssistantMessage, q as CoreSystemMessage, o as CoreUserContentPart, r as CoreUserMessage, m as ThreadAssistantMessage, l as ThreadSystemMessage, k as ThreadUserContentPart, n as ThreadUserMessage } from './AssistantTypes-
|
3
|
+
import { T as ThreadAssistantContentPart, M as MessageStatus, a as ThreadRoundtrip, b as ThreadMessage, c as ModelConfig, d as ModelConfigProvider, e as TextContentPart, C as ContentPartStatus, I as ImageContentPart, U as UIContentPart, f as ToolCallContentPart, g as ToolCallContentPartStatus, h as CoreMessage, A as AppendMessage, i as Tool, j as CoreToolCallContentPart } from './AssistantTypes-Bo5YKjhV.js';
|
4
|
+
export { p as CoreAssistantContentPart, s as CoreAssistantMessage, q as CoreSystemMessage, o as CoreUserContentPart, r as CoreUserMessage, m as ThreadAssistantMessage, l as ThreadSystemMessage, k as ThreadUserContentPart, n as ThreadUserMessage } from './AssistantTypes-Bo5YKjhV.js';
|
5
5
|
import { UseBoundStore, StoreApi } from 'zustand';
|
6
6
|
import { Primitive } from '@radix-ui/react-primitive';
|
7
7
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
@@ -169,6 +169,29 @@ declare const fromLanguageModelTools: (tools: LanguageModelV1FunctionTool[]) =>
|
|
169
169
|
|
170
170
|
declare const toLanguageModelTools: (tools: Record<string, Tool<any, any>>) => LanguageModelV1FunctionTool[];
|
171
171
|
|
172
|
+
declare class PipeableTransformStream<I, O> extends TransformStream<I, O> {
|
173
|
+
constructor(transform: (readable: ReadableStream<I>) => ReadableStream<O>);
|
174
|
+
}
|
175
|
+
|
176
|
+
type StreamPart<T extends Record<string, unknown>> = {
|
177
|
+
[K in keyof T]: {
|
178
|
+
type: K;
|
179
|
+
value: T[K];
|
180
|
+
};
|
181
|
+
}[keyof T];
|
182
|
+
|
183
|
+
declare function streamPartDecoderStream<T extends Record<string, unknown>>(): PipeableTransformStream<unknown, StreamPart<T>>;
|
184
|
+
|
185
|
+
declare function streamPartEncoderStream<T extends Record<string, unknown>>(): PipeableTransformStream<unknown, Uint8Array>;
|
186
|
+
|
187
|
+
declare namespace StreamUtils {
|
188
|
+
export type { StreamPart };
|
189
|
+
}
|
190
|
+
declare const streamUtils: {
|
191
|
+
streamPartEncoderStream: typeof streamPartEncoderStream;
|
192
|
+
streamPartDecoderStream: typeof streamPartDecoderStream;
|
193
|
+
};
|
194
|
+
|
172
195
|
type EdgeChatAdapterOptions = {
|
173
196
|
api: string;
|
174
197
|
};
|
@@ -653,7 +676,6 @@ declare function useAssistantContext(options: {
|
|
653
676
|
type ThreadState = Readonly<{
|
654
677
|
isRunning: boolean;
|
655
678
|
isDisabled: boolean;
|
656
|
-
unstable_canAppendNew: boolean;
|
657
679
|
}>;
|
658
680
|
|
659
681
|
type ThreadViewportState = Readonly<{
|
@@ -1379,4 +1401,4 @@ declare const exports: {
|
|
1379
1401
|
Text: FC;
|
1380
1402
|
};
|
1381
1403
|
|
1382
|
-
export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AddToolResultOptions, AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, EdgeChatAdapter, type EdgeRuntimeOptions, type EdgeRuntimeRequestOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, type ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useEdgeRuntime, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
|
1404
|
+
export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AddToolResultOptions, AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, EdgeChatAdapter, type EdgeRuntimeOptions, type EdgeRuntimeRequestOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, type ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useEdgeRuntime, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
|
package/dist/index.js
CHANGED
@@ -7,7 +7,9 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
-
|
10
|
+
|
11
|
+
|
12
|
+
var _chunkCTVBRM6Cjs = require('./chunk-CTVBRM6C.js');
|
11
13
|
|
12
14
|
|
13
15
|
var _chunkDCHYNTHIjs = require('./chunk-DCHYNTHI.js');
|
@@ -39,7 +41,7 @@ var _zustand = require('zustand');
|
|
39
41
|
var ProxyConfigProvider = (_class = class {constructor() { _class.prototype.__init.call(this); }
|
40
42
|
__init() {this._providers = /* @__PURE__ */ new Set()}
|
41
43
|
getModelConfig() {
|
42
|
-
return
|
44
|
+
return _chunkCTVBRM6Cjs.mergeModelConfigs.call(void 0, this._providers);
|
43
45
|
}
|
44
46
|
registerModelConfigProvider(provider) {
|
45
47
|
this._providers.add(provider);
|
@@ -164,13 +166,11 @@ var getThreadStateFromRuntime = (runtime) => {
|
|
164
166
|
if (_optionalChain([lastMessage, 'optionalAccess', _11 => _11.role]) !== "assistant")
|
165
167
|
return Object.freeze({
|
166
168
|
isDisabled: runtime.isDisabled,
|
167
|
-
isRunning: false
|
168
|
-
unstable_canAppendNew: !runtime.isDisabled
|
169
|
+
isRunning: false
|
169
170
|
});
|
170
171
|
return Object.freeze({
|
171
172
|
isDisabled: runtime.isDisabled,
|
172
|
-
isRunning: lastMessage.status.type === "running"
|
173
|
-
unstable_canAppendNew: !runtime.isDisabled && lastMessage.status.type !== "running" && lastMessage.status.type !== "requires-action"
|
173
|
+
isRunning: lastMessage.status.type === "running"
|
174
174
|
});
|
175
175
|
};
|
176
176
|
var makeThreadStore = (runtimeRef) => {
|
@@ -274,7 +274,7 @@ var ThreadProvider = ({
|
|
274
274
|
const onThreadUpdate = () => {
|
275
275
|
const oldState = context.useThread.getState();
|
276
276
|
const state = getThreadStateFromRuntime(thread);
|
277
|
-
if (oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning
|
277
|
+
if (oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning) {
|
278
278
|
context.useThread.setState(
|
279
279
|
getThreadStateFromRuntime(thread),
|
280
280
|
true
|
@@ -680,7 +680,7 @@ var useComposerSend = () => {
|
|
680
680
|
const { useComposer } = useComposerContext();
|
681
681
|
const disabled = useCombinedStore(
|
682
682
|
[useThread, useComposer],
|
683
|
-
(t, c) =>
|
683
|
+
(t, c) => t.isRunning || !c.isEditing || c.value.length === 0
|
684
684
|
);
|
685
685
|
const callback = _react.useCallback.call(void 0, () => {
|
686
686
|
const composerState = useComposer.getState();
|
@@ -1578,8 +1578,8 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
|
|
1578
1578
|
const handleKeyPress = (e) => {
|
1579
1579
|
if (isDisabled) return;
|
1580
1580
|
if (e.key === "Enter" && e.shiftKey === false) {
|
1581
|
-
const {
|
1582
|
-
if (
|
1581
|
+
const { isRunning } = useThread.getState();
|
1582
|
+
if (!isRunning) {
|
1583
1583
|
e.preventDefault();
|
1584
1584
|
_optionalChain([textareaRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.closest, 'call', _49 => _49("form"), 'optionalAccess', _50 => _50.requestSubmit, 'call', _51 => _51()]);
|
1585
1585
|
}
|
@@ -2524,6 +2524,52 @@ var fromLanguageModelTools = (tools) => {
|
|
2524
2524
|
);
|
2525
2525
|
};
|
2526
2526
|
|
2527
|
+
// src/runtimes/edge/streams/utils/chunkByLineStream.ts
|
2528
|
+
function chunkByLineStream() {
|
2529
|
+
let buffer = "";
|
2530
|
+
return new TransformStream({
|
2531
|
+
transform(chunk, controller) {
|
2532
|
+
buffer += chunk;
|
2533
|
+
const lines = buffer.split("\n");
|
2534
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
2535
|
+
controller.enqueue(lines[i]);
|
2536
|
+
}
|
2537
|
+
buffer = lines[lines.length - 1];
|
2538
|
+
},
|
2539
|
+
flush(controller) {
|
2540
|
+
if (buffer) {
|
2541
|
+
controller.enqueue(buffer);
|
2542
|
+
}
|
2543
|
+
}
|
2544
|
+
});
|
2545
|
+
}
|
2546
|
+
|
2547
|
+
// src/runtimes/edge/streams/utils/streamPartDecoderStream.ts
|
2548
|
+
var decodeStreamPart = (part) => {
|
2549
|
+
const index = part.indexOf(":");
|
2550
|
+
if (index === -1) throw new Error("Invalid stream part");
|
2551
|
+
return {
|
2552
|
+
type: part.slice(0, index),
|
2553
|
+
value: JSON.parse(part.slice(index + 1))
|
2554
|
+
};
|
2555
|
+
};
|
2556
|
+
function streamPartDecoderStream() {
|
2557
|
+
const decodeStream = new TransformStream({
|
2558
|
+
transform(chunk, controller) {
|
2559
|
+
controller.enqueue(decodeStreamPart(chunk));
|
2560
|
+
}
|
2561
|
+
});
|
2562
|
+
return new (0, _chunkCTVBRM6Cjs.PipeableTransformStream)((readable) => {
|
2563
|
+
return readable.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(decodeStream);
|
2564
|
+
});
|
2565
|
+
}
|
2566
|
+
|
2567
|
+
// src/runtimes/edge/streams/utils/index.ts
|
2568
|
+
var streamUtils = {
|
2569
|
+
streamPartEncoderStream: _chunkCTVBRM6Cjs.streamPartEncoderStream,
|
2570
|
+
streamPartDecoderStream
|
2571
|
+
};
|
2572
|
+
|
2527
2573
|
// src/runtimes/edge/useEdgeRuntime.ts
|
2528
2574
|
|
2529
2575
|
|
@@ -2532,9 +2578,8 @@ function assistantDecoderStream() {
|
|
2532
2578
|
const toolCallNames = /* @__PURE__ */ new Map();
|
2533
2579
|
let currentToolCall;
|
2534
2580
|
return new TransformStream({
|
2535
|
-
transform(
|
2536
|
-
|
2537
|
-
if (currentToolCall && code !== "2" /* ToolCallArgsTextDelta */ && code !== "E" /* Error */) {
|
2581
|
+
transform({ type, value }, controller) {
|
2582
|
+
if (currentToolCall && type !== "2" /* ToolCallArgsTextDelta */ && type !== "E" /* Error */) {
|
2538
2583
|
controller.enqueue({
|
2539
2584
|
type: "tool-call",
|
2540
2585
|
toolCallType: "function",
|
@@ -2544,7 +2589,7 @@ function assistantDecoderStream() {
|
|
2544
2589
|
});
|
2545
2590
|
currentToolCall = void 0;
|
2546
2591
|
}
|
2547
|
-
switch (
|
2592
|
+
switch (type) {
|
2548
2593
|
case "0" /* TextDelta */: {
|
2549
2594
|
controller.enqueue({
|
2550
2595
|
type: "text-delta",
|
@@ -2595,41 +2640,13 @@ function assistantDecoderStream() {
|
|
2595
2640
|
break;
|
2596
2641
|
}
|
2597
2642
|
default: {
|
2598
|
-
const unhandledType =
|
2643
|
+
const unhandledType = type;
|
2599
2644
|
throw new Error(`Unhandled chunk type: ${unhandledType}`);
|
2600
2645
|
}
|
2601
2646
|
}
|
2602
2647
|
}
|
2603
2648
|
});
|
2604
2649
|
}
|
2605
|
-
var parseStreamPart = (part) => {
|
2606
|
-
const index = part.indexOf(":");
|
2607
|
-
if (index === -1) throw new Error("Invalid stream part");
|
2608
|
-
return [
|
2609
|
-
part.slice(0, index),
|
2610
|
-
JSON.parse(part.slice(index + 1))
|
2611
|
-
];
|
2612
|
-
};
|
2613
|
-
|
2614
|
-
// src/runtimes/edge/streams/chunkByLineStream.ts
|
2615
|
-
function chunkByLineStream() {
|
2616
|
-
let buffer = "";
|
2617
|
-
return new TransformStream({
|
2618
|
-
transform(chunk, controller) {
|
2619
|
-
buffer += chunk;
|
2620
|
-
const lines = buffer.split("\n");
|
2621
|
-
for (let i = 0; i < lines.length - 1; i++) {
|
2622
|
-
controller.enqueue(lines[i]);
|
2623
|
-
}
|
2624
|
-
buffer = lines[lines.length - 1];
|
2625
|
-
},
|
2626
|
-
flush(controller) {
|
2627
|
-
if (buffer) {
|
2628
|
-
controller.enqueue(buffer);
|
2629
|
-
}
|
2630
|
-
}
|
2631
|
-
});
|
2632
|
-
}
|
2633
2650
|
|
2634
2651
|
// src/runtimes/edge/EdgeChatAdapter.ts
|
2635
2652
|
function asAsyncIterable(source) {
|
@@ -2657,8 +2674,8 @@ var EdgeChatAdapter = class {
|
|
2657
2674
|
},
|
2658
2675
|
body: JSON.stringify({
|
2659
2676
|
system: config.system,
|
2660
|
-
messages:
|
2661
|
-
tools: config.tools ?
|
2677
|
+
messages: _chunkCTVBRM6Cjs.toCoreMessages.call(void 0, messages),
|
2678
|
+
tools: config.tools ? _chunkCTVBRM6Cjs.toLanguageModelTools.call(void 0, config.tools) : [],
|
2662
2679
|
...config.callSettings,
|
2663
2680
|
...config.config
|
2664
2681
|
}),
|
@@ -2667,7 +2684,7 @@ var EdgeChatAdapter = class {
|
|
2667
2684
|
if (result.status !== 200) {
|
2668
2685
|
throw new Error(`Status ${result.status}: ${await result.text()}`);
|
2669
2686
|
}
|
2670
|
-
const stream = result.body.pipeThrough(
|
2687
|
+
const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkCTVBRM6Cjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkCTVBRM6Cjs.runResultStream.call(void 0, ));
|
2671
2688
|
let update;
|
2672
2689
|
for await (update of asAsyncIterable(stream)) {
|
2673
2690
|
yield update;
|
@@ -3937,5 +3954,6 @@ var assistant_modal_default = Object.assign(AssistantModal, exports11);
|
|
3937
3954
|
|
3938
3955
|
|
3939
3956
|
|
3940
|
-
|
3957
|
+
|
3958
|
+
exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerPrimitive = composer_exports; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.ExternalStoreRuntime = ExternalStoreRuntime; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.toCoreMessage = _chunkCTVBRM6Cjs.toCoreMessage; exports.toCoreMessages = _chunkCTVBRM6Cjs.toCoreMessages; exports.toLanguageModelMessages = _chunkCTVBRM6Cjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkCTVBRM6Cjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; exports.useAppendMessage = useAppendMessage; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerSend = useComposerSend; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartText = useContentPartText; exports.useEdgeRuntime = useEdgeRuntime; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadSuggestion = useThreadSuggestion;
|
3941
3959
|
//# sourceMappingURL=index.js.map
|