@assistant-ui/react 0.5.28 → 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-KIP52R4W.js → chunk-CTVBRM6C.js} +12 -13
- package/dist/chunk-CTVBRM6C.js.map +1 -0
- package/dist/{chunk-NLH52OUL.mjs → chunk-DXLSOE2J.mjs} +12 -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 +15 -13
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +15 -13
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +14 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-KIP52R4W.js.map +0 -1
- package/dist/chunk-NLH52OUL.mjs.map +0 -1
package/dist/index.mjs
CHANGED
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
toLanguageModelMessages,
|
10
10
|
toLanguageModelTools,
|
11
11
|
toolResultStream
|
12
|
-
} from "./chunk-
|
12
|
+
} from "./chunk-DXLSOE2J.mjs";
|
13
13
|
import {
|
14
14
|
__export
|
15
15
|
} from "./chunk-BJPOCE4O.mjs";
|
@@ -166,13 +166,11 @@ var getThreadStateFromRuntime = (runtime) => {
|
|
166
166
|
if (lastMessage?.role !== "assistant")
|
167
167
|
return Object.freeze({
|
168
168
|
isDisabled: runtime.isDisabled,
|
169
|
-
isRunning: false
|
170
|
-
unstable_canAppendNew: !runtime.isDisabled
|
169
|
+
isRunning: false
|
171
170
|
});
|
172
171
|
return Object.freeze({
|
173
172
|
isDisabled: runtime.isDisabled,
|
174
|
-
isRunning: lastMessage.status.type === "running"
|
175
|
-
unstable_canAppendNew: !runtime.isDisabled && lastMessage.status.type !== "running" && lastMessage.status.type !== "requires-action"
|
173
|
+
isRunning: lastMessage.status.type === "running"
|
176
174
|
});
|
177
175
|
};
|
178
176
|
var makeThreadStore = (runtimeRef) => {
|
@@ -276,7 +274,7 @@ var ThreadProvider = ({
|
|
276
274
|
const onThreadUpdate = () => {
|
277
275
|
const oldState = context.useThread.getState();
|
278
276
|
const state = getThreadStateFromRuntime(thread);
|
279
|
-
if (oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning
|
277
|
+
if (oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning) {
|
280
278
|
context.useThread.setState(
|
281
279
|
getThreadStateFromRuntime(thread),
|
282
280
|
true
|
@@ -682,7 +680,7 @@ var useComposerSend = () => {
|
|
682
680
|
const { useComposer } = useComposerContext();
|
683
681
|
const disabled = useCombinedStore(
|
684
682
|
[useThread, useComposer],
|
685
|
-
(t, c) =>
|
683
|
+
(t, c) => t.isRunning || !c.isEditing || c.value.length === 0
|
686
684
|
);
|
687
685
|
const callback = useCallback11(() => {
|
688
686
|
const composerState = useComposer.getState();
|
@@ -1580,8 +1578,8 @@ var ComposerPrimitiveInput = forwardRef12(
|
|
1580
1578
|
const handleKeyPress = (e) => {
|
1581
1579
|
if (isDisabled) return;
|
1582
1580
|
if (e.key === "Enter" && e.shiftKey === false) {
|
1583
|
-
const {
|
1584
|
-
if (
|
1581
|
+
const { isRunning } = useThread.getState();
|
1582
|
+
if (!isRunning) {
|
1585
1583
|
e.preventDefault();
|
1586
1584
|
textareaRef.current?.closest("form")?.requestSubmit();
|
1587
1585
|
}
|
@@ -2686,7 +2684,7 @@ var EdgeChatAdapter = class {
|
|
2686
2684
|
if (result.status !== 200) {
|
2687
2685
|
throw new Error(`Status ${result.status}: ${await result.text()}`);
|
2688
2686
|
}
|
2689
|
-
const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(toolResultStream(config.tools)).pipeThrough(runResultStream());
|
2687
|
+
const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(toolResultStream(config.tools, abortSignal)).pipeThrough(runResultStream());
|
2690
2688
|
let update;
|
2691
2689
|
for await (update of asAsyncIterable(stream)) {
|
2692
2690
|
yield update;
|