mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
fix(client): regenerate model compatibility type (#49204)
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b76e56eca3
commit
c921067eb8
@@ -1342,6 +1342,7 @@ export type ModelCompatibility = {
|
||||
maxTokensField?: ModelMaxTokensField
|
||||
requireFinishReason?: boolean
|
||||
requireAssistantAfterTool?: boolean
|
||||
supportsPromptCacheKey?: boolean
|
||||
}
|
||||
|
||||
export type ProviderInfo = {
|
||||
|
||||
@@ -87,8 +87,9 @@ test("custom commands commit the captured agent, model and variant before execut
|
||||
expect(mutations).toEqual([{ type: "agent", body: { agent: "plan" } }])
|
||||
|
||||
// A later local edit must not change the in-flight command's selection.
|
||||
await waitForFrame(setup, (frame) => frame.includes("Plan · second model Demo · low"))
|
||||
setup.mockInput.pressKey("F7")
|
||||
await setup.waitForFrame((frame) => frame.includes("high"))
|
||||
await waitForFrame(setup, (frame) => frame.includes("high"))
|
||||
agent.resolve(new Response(null, { status: 204 }))
|
||||
await setup.waitFor(() => mutations.length === 2)
|
||||
expect(mutations[1]).toEqual({
|
||||
@@ -106,3 +107,11 @@ test("custom commands commit the captured agent, model and variant before execut
|
||||
model.resolve(new Response(null, { status: 204 }))
|
||||
}
|
||||
})
|
||||
|
||||
async function waitForFrame(setup: Awaited<ReturnType<typeof createAppFixture>>, matches: (frame: string) => boolean) {
|
||||
const started = Date.now()
|
||||
while (!matches(setup.captureCharFrame())) {
|
||||
if (Date.now() - started > 2_000) throw new Error("Timed out waiting for command selection frame")
|
||||
await Bun.sleep(10)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export async function renderLocal(
|
||||
),
|
||||
{ width: 100, height: 30, kittyKeyboard: true },
|
||||
)
|
||||
await setup.waitFor(() => local !== undefined && local.model.ready)
|
||||
await waitForModel(() => local !== undefined && local.model.ready)
|
||||
await data.location.sync()
|
||||
return {
|
||||
...setup,
|
||||
@@ -106,6 +106,14 @@ export async function renderLocal(
|
||||
}
|
||||
}
|
||||
|
||||
async function waitForModel(ready: () => boolean) {
|
||||
const started = Date.now()
|
||||
while (!ready()) {
|
||||
if (Date.now() - started > 2_000) throw new Error("Timed out waiting for local model data")
|
||||
await Bun.sleep(10)
|
||||
}
|
||||
}
|
||||
|
||||
export function model(id: string, variants: string[] = []): ModelInfo {
|
||||
return {
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user