Skip to content

Commit

Permalink
fix: toLanguageModelMessages should include attachments (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Dec 20, 2024
1 parent 87c69c1 commit 85696fb
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 9 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.16",
"@assistant-ui/react": "^0.7.17",
"@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.16",
"@assistant-ui/react": "^0.7.17",
"@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.16",
"@assistant-ui/react": "^0.7.17",
"@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.16",
"@assistant-ui/react": "^0.7.17",
"@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.16",
"@assistant-ui/react": "^0.7.17",
"@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.16",
"@assistant-ui/react": "^0.7.17",
"@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.16",
"@assistant-ui/react": "^0.7.17",
"@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.17

### Patch Changes

- fix: toLanguageModelMessages should include attachments

## 0.7.16

### 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.16",
"version": "0.7.17",
"license": "MIT",
"exports": {
".": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ export function toLanguageModelMessages(
}

case "user": {
const attachments = "attachments" in message ? message.attachments : [];
const content = [
...message.content,
...attachments.map((a) => a.content).flat(),
];
const msg: LanguageModelV1Message = {
role: "user",
content: message.content.map(
content: content.map(
(part): LanguageModelV1TextPart | LanguageModelV1ImagePart => {
const type = part.type;
switch (type) {
Expand Down

0 comments on commit 85696fb

Please sign in to comment.