GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(opencode): patch empty Gemini replay messages (#30463) · moonug/opencode@70a2e84

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • bun.lock
  • package.json
  • packages/opencode/test/session
    • llm.test.ts
  • patches
    • @ai-sdk%[email protected]
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bun.lock‎

Copy file name to clipboardExpand all lines: bun.lock
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
"[email protected]": "patches/[email protected]",
147147
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]",
148148
"[email protected]": "patches/[email protected]",
149-
"[email protected]": "patches/[email protected]"
149+
"[email protected]": "patches/[email protected]",
150+
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]"
150151
}
151152
}
Collapse file

‎packages/opencode/test/session/llm.test.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/test/session/llm.test.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,10 @@ describe("session.llm.stream", () => {
19001900
model: resolved,
19011901
agent,
19021902
system: ["You are a helpful assistant."],
1903-
messages: [{ role: "user", content: "Hello" }],
1903+
messages: [
1904+
{ role: "user", content: "Hello" },
1905+
{ role: "assistant", content: [{ type: "reasoning", text: "" }] },
1906+
],
19041907
tools: {},
19051908
})
19061909

@@ -1911,6 +1914,9 @@ describe("session.llm.stream", () => {
19111914
| undefined
19121915

19131916
expect(capture.url.pathname).toBe(pathSuffix)
1917+
expect(body.contents).toEqual([
1918+
{ role: "user", parts: [{ text: "Hello" }] },
1919+
])
19141920
expect(config?.temperature).toBe(0.3)
19151921
expect(config?.topP).toBe(0.8)
19161922
expect(config?.maxOutputTokens).toBe(ProviderTransform.maxOutputTokens(resolved))
Collapse file

‎patches/@ai-sdk%[email protected]‎

Copy file name to clipboard
+69Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
diff --git a/dist/index.js b/dist/index.js
2+
index 546bf5509004510b023212d70b4c0875a24eb302..f211dcb23e01a393f7d5c6221bfb0ef52276520a 100644
3+
--- a/dist/index.js
4+
+++ b/dist/index.js
5+
@@ -636,6 +636,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
6+
}
7+
}).filter((part) => part !== void 0)
8+
});
9+
+ if (contents[contents.length - 1].parts.length === 0) {
10+
+ contents.pop();
11+
+ }
12+
break;
13+
}
14+
case "tool": {
15+
diff --git a/dist/index.mjs b/dist/index.mjs
16+
index 5c8c20cbbcd4d398523602dd80ae8c3fa10a84ea..f89dc53b3b9cd83653a66b0900ff0bc34d3d6c9f 100644
17+
--- a/dist/index.mjs
18+
+++ b/dist/index.mjs
19+
@@ -642,6 +642,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
20+
}
21+
}).filter((part) => part !== void 0)
22+
});
23+
+ if (contents[contents.length - 1].parts.length === 0) {
24+
+ contents.pop();
25+
+ }
26+
break;
27+
}
28+
case "tool": {
29+
diff --git a/dist/internal/index.js b/dist/internal/index.js
30+
index 947af6f4282f1bb9b46a76fdf199d7155600b550..22c2faa4122069d868a3232bbb708fdc808bf6e8 100644
31+
--- a/dist/internal/index.js
32+
+++ b/dist/internal/index.js
33+
@@ -419,6 +419,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
34+
}
35+
}).filter((part) => part !== void 0)
36+
});
37+
+ if (contents[contents.length - 1].parts.length === 0) {
38+
+ contents.pop();
39+
+ }
40+
break;
41+
}
42+
case "tool": {
43+
diff --git a/dist/internal/index.mjs b/dist/internal/index.mjs
44+
index 28853288c1ff8f589448e7ddcddfd8ed36c4d995..4ef91ed90008d2cf7a5f24bb1927a9884e352393 100644
45+
--- a/dist/internal/index.mjs
46+
+++ b/dist/internal/index.mjs
47+
@@ -402,6 +402,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
48+
}
49+
}).filter((part) => part !== void 0)
50+
});
51+
+ if (contents[contents.length - 1].parts.length === 0) {
52+
+ contents.pop();
53+
+ }
54+
break;
55+
}
56+
case "tool": {
57+
diff --git a/src/convert-to-google-generative-ai-messages.ts b/src/convert-to-google-generative-ai-messages.ts
58+
index 4bf83e3768d4ccc8ff96e7d683abb4ccf60387ea..f257d2af8f178b7ac36771296eaa6c60c92e04ab 100644
59+
--- a/src/convert-to-google-generative-ai-messages.ts
60+
+++ b/src/convert-to-google-generative-ai-messages.ts
61+
@@ -350,3 +350,8 @@ export function convertToGoogleGenerativeAIMessages(
62+
})
63+
.filter(part => part !== undefined),
64+
});
65+
+ // Empty text and reasoning parts, including signature-bearing ones, are
66+
+ // filtered above. Do not emit a model entry that Gemini rejects.
67+
+ if (contents[contents.length - 1].parts.length === 0) {
68+
+ contents.pop();
69+
+ }

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.