mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
fix(core): default public users to Big Pickle
This commit is contained in:
committed by
opencode-agent[bot]
parent
702a73d91a
commit
fa64a4ccc0
@@ -208,7 +208,12 @@ const layer = Layer.effect(
|
||||
const all = Array.from(byProvider.values())
|
||||
.flatMap((models) => Array.from(models.values()))
|
||||
.sort((left, right) => right.time.released - left.time.released)
|
||||
cached = freeze({ data, all, available: all.filter((model) => model.enabled), byProvider }, true)
|
||||
const requested = data.defaultModel
|
||||
const preferred = requested && byProvider.get(requested.providerID)?.get(requested.modelID)
|
||||
const available = preferred?.enabled
|
||||
? [preferred, ...all.filter((model) => model.enabled && model !== preferred)]
|
||||
: all.filter((model) => model.enabled)
|
||||
cached = freeze({ data, all, available, byProvider }, true)
|
||||
return cached
|
||||
}
|
||||
})
|
||||
|
||||
@@ -7,12 +7,14 @@ import { Bus } from "../../bus.js"
|
||||
import { Credential } from "../../credential.js"
|
||||
import { Integration } from "../../integration.js"
|
||||
import { IntegrationConnection } from "../../integration/connection.js"
|
||||
import { Model } from "../../model.js"
|
||||
import { Provider } from "../../provider.js"
|
||||
import { WebSearch } from "../../websearch.js"
|
||||
import { ConfigProvider } from "@opencode/schema/config/provider"
|
||||
import { Money } from "@opencode/schema/money"
|
||||
|
||||
const defaultServer = "https://opencode.ai/console"
|
||||
const publicDefaultModelID = Model.ID.make("big-pickle")
|
||||
const clientID = "opencode-cli"
|
||||
const methodID = Integration.MethodID.make("device")
|
||||
const RemoteResponse = Schema.Struct({
|
||||
@@ -255,6 +257,9 @@ export const OpencodePlugin = define<HttpClient.HttpClient | Bus.Service | Scope
|
||||
draft.enabled = false
|
||||
})
|
||||
}
|
||||
if (models.get(item.provider.id, publicDefaultModelID)?.enabled) {
|
||||
models.default.set(item.provider.id, publicDefaultModelID)
|
||||
}
|
||||
})
|
||||
|
||||
yield* ctx.websearch.transform((editor) => {
|
||||
|
||||
@@ -1122,6 +1122,29 @@ describe("OpencodePlugin", () => {
|
||||
),
|
||||
)
|
||||
|
||||
it.effect("defaults public users to Big Pickle", () =>
|
||||
withEnv({ OPENCODE_API_KEY: undefined }, () =>
|
||||
Effect.gen(function* () {
|
||||
const catalog = yield* Provider.Service
|
||||
const models = yield* Model.Service
|
||||
yield* catalog.transform((catalog) => {
|
||||
catalog.update(Provider.ID.opencode, () => {})
|
||||
catalog.models.update(Provider.ID.opencode, Model.ID.make("jev-1.13-free"), (draft) => {
|
||||
draft.cost = cost(0)
|
||||
draft.time.released = Date.UTC(2026, 8, 15)
|
||||
})
|
||||
catalog.models.update(Provider.ID.opencode, Model.ID.make("big-pickle"), (draft) => {
|
||||
draft.cost = cost(0)
|
||||
draft.time.released = Date.UTC(2025, 9, 17)
|
||||
})
|
||||
})
|
||||
yield* addPlugin()
|
||||
expect((yield* models.default())?.id).toBe(Model.ID.make("big-pickle"))
|
||||
expect((yield* models.available())[0]?.id).toBe(Model.ID.make("big-pickle"))
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
it.effect("treats output-only cost as free without credentials", () =>
|
||||
withEnv({ OPENCODE_API_KEY: undefined }, () =>
|
||||
Effect.gen(function* () {
|
||||
|
||||
Reference in New Issue
Block a user