Skip to content

Commit

Permalink
fix: ensure message status is set on runResultStream flush (#1257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Dec 19, 2024
1 parent 2b1007b commit 87c69c1
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/react-ai-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"zustand": "^5.0.2"
},
"peerDependencies": {
"@assistant-ui/react": "^0.7.12",
"@assistant-ui/react": "^0.7.16",
"@types/react": "*",
"react": "^18 || ^19 || ^19.0.0-rc"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-hook-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"zod": "^3.24.1"
},
"peerDependencies": {
"@assistant-ui/react": "^0.7.12",
"@assistant-ui/react": "^0.7.16",
"@types/react": "*",
"react": "^18 || ^19 || ^19.0.0-rc",
"react-hook-form": "^7"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-langgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"zod": "^3.24.1"
},
"peerDependencies": {
"@assistant-ui/react": "^0.7.12",
"@assistant-ui/react": "^0.7.16",
"@types/react": "*",
"react": "^18 || ^19 || ^19.0.0-rc"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"react-markdown": "^9.0.1"
},
"peerDependencies": {
"@assistant-ui/react": "^0.7.12",
"@assistant-ui/react": "^0.7.16",
"@types/react": "*",
"react": "^18 || ^19 || ^19.0.0-rc",
"tailwindcss": "^3.4.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"zustand": "^5.0.2"
},
"peerDependencies": {
"@assistant-ui/react": "^0.7.12",
"@assistant-ui/react": "^0.7.16",
"@types/react": "*",
"react": "^18 || ^19 || ^19.0.0-rc",
"tailwindcss": "^3.4.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-syntax-highlighter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"build": "tsup src/index.ts --format cjs,esm --dts --sourcemap --clean"
},
"peerDependencies": {
"@assistant-ui/react": "^0.7.12",
"@assistant-ui/react": "^0.7.16",
"@assistant-ui/react-markdown": "^0.7.5",
"@types/react": "*",
"@types/react-syntax-highlighter": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-trieve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"unist-util-visit": "^5.0.0"
},
"peerDependencies": {
"@assistant-ui/react": "^0.7.12",
"@assistant-ui/react": "^0.7.16",
"@assistant-ui/react-markdown": "^0.7.5",
"@types/react": "*",
"react": "^18 || ^19 || ^19.0.0-rc",
Expand Down
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @assistant-ui/react

## 0.7.16

### Patch Changes

- fix: ensure message status is set on runResultStream flush

## 0.7.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"conversational-ui",
"conversational-ai"
],
"version": "0.7.15",
"version": "0.7.16",
"license": "MIT",
"exports": {
".": {
Expand Down
14 changes: 14 additions & 0 deletions packages/react/src/runtimes/edge/streams/runResultStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ export function runResultStream() {
}
}
},
flush(controller) {
if (message.status?.type === "running") {
const requiresAction = message.content?.at(-1)?.type === "tool-call";
message = appendOrUpdateFinish(message, {
type: "finish",
finishReason: requiresAction ? "tool-calls" : "unknown",
usage: {
promptTokens: 0,
completionTokens: 0,
},
});
controller.enqueue(message);
}
},
});
}

Expand Down

0 comments on commit 87c69c1

Please sign in to comment.