Skip to content

Commit 5af75a1

Browse files
committed
fix: make Copilot Responses probe valid on /responses
1 parent d1f5544 commit 5af75a1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

packages/opencode/script/verify-copilot-responses.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import path from "path"
44
import { fileURLToPath } from "url"
5-
import { streamText, type ModelMessage } from "ai"
5+
import { generateText, type ModelMessage } from "ai"
66

77
const __filename = fileURLToPath(import.meta.url)
88
const __dirname = path.dirname(__filename)
@@ -169,20 +169,14 @@ async function probeModel(input: {
169169
const model = await Provider.getModel(input.providerID, input.modelID)
170170
const language = await Provider.getLanguage(model)
171171

172-
const stream = await streamText({
172+
// GitHub Copilot Responses API currently requires max_output_tokens >= 16.
173+
await generateText({
173174
model: language,
174175
messages,
175-
maxOutputTokens: 8,
176+
maxOutputTokens: 16,
176177
abortSignal: AbortSignal.timeout(input.timeoutMs),
177178
})
178179

179-
for await (const part of stream.fullStream) {
180-
// Any successful stream event is enough to consider the route supported.
181-
if (part.type === "text-delta" || part.type === "reasoning-delta" || part.type === "start") {
182-
break
183-
}
184-
}
185-
186180
return { ok: true }
187181
} catch (e: any) {
188182
const message = e?.message ? String(e.message) : String(e)

0 commit comments

Comments
 (0)