Skip to content

Commit 189a67a

Browse files
committed
Disable title generation by default
1 parent 364e993 commit 189a67a

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

packages/opencode/src/config/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,12 @@ export namespace Config {
894894
small_model: ModelId.describe(
895895
"Small model to use for tasks like title generation in the format of provider/model",
896896
).optional(),
897+
small_model_enabled: z
898+
.boolean()
899+
.optional()
900+
.describe(
901+
"Enable small-model requests such as session title generation. Defaults to false; set to true to opt in.",
902+
),
897903
default_agent: z
898904
.string()
899905
.optional()

packages/opencode/src/session/prompt.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import * as CrossSpawnSpawner from "@/effect/cross-spawn-spawner"
3232
import * as Stream from "effect/Stream"
3333
import { Command } from "../command"
3434
import { pathToFileURL, fileURLToPath } from "url"
35+
import { Config } from "../config/config"
3536
import { ConfigMarkdown } from "../config/markdown"
3637
import { SessionSummary } from "./summary"
3738
import { NamedError } from "@opencode-ai/util/error"
@@ -86,6 +87,7 @@ export namespace SessionPrompt {
8687
const sessions = yield* Session.Service
8788
const agents = yield* Agent.Service
8889
const provider = yield* Provider.Service
90+
const config = yield* Config.Service
8991
const processor = yield* SessionProcessor.Service
9092
const compaction = yield* SessionCompaction.Service
9193
const plugin = yield* Plugin.Service
@@ -1400,13 +1402,17 @@ NOTE: At any point in time through this workflow you should feel free to ask the
14001402
}
14011403

14021404
step++
1403-
if (step === 1)
1404-
yield* title({
1405-
session,
1406-
modelID: lastUser.model.modelID,
1407-
providerID: lastUser.model.providerID,
1408-
history: msgs,
1409-
}).pipe(Effect.ignore, Effect.forkIn(scope))
1405+
if (step === 1) {
1406+
const cfg = yield* config.get()
1407+
if (cfg.small_model_enabled) {
1408+
yield* title({
1409+
session,
1410+
modelID: lastUser.model.modelID,
1411+
providerID: lastUser.model.providerID,
1412+
history: msgs,
1413+
}).pipe(Effect.ignore, Effect.forkIn(scope))
1414+
}
1415+
}
14101416

14111417
const model = yield* getModel(lastUser.model.providerID, lastUser.model.modelID, sessionID)
14121418
const task = tasks.pop()
@@ -1750,6 +1756,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
17501756
Layer.provide(Plugin.defaultLayer),
17511757
Layer.provide(Session.defaultLayer),
17521758
Layer.provide(Agent.defaultLayer),
1759+
Layer.provide(Config.defaultLayer),
17531760
Layer.provide(Bus.layer),
17541761
Layer.provide(CrossSpawnSpawner.defaultLayer),
17551762
),

0 commit comments

Comments
 (0)