Skip to content

Commit ccdc8d9

Browse files
rmk40schneiderlo
authored andcommitted
fix(core): remove unnecessary per-message title LLM calls (anomalyco#13804)
1 parent 0ce16c8 commit ccdc8d9

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

packages/opencode/src/session/summary.ts

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { Provider } from "@/provider/provider"
2-
31
import { fn } from "@/util/fn"
42
import z from "zod"
53
import { Session } from "."
@@ -8,16 +6,10 @@ import { MessageV2 } from "./message-v2"
86
import { Identifier } from "@/id/id"
97
import { Snapshot } from "@/snapshot"
108

11-
import { Log } from "@/util/log"
129
import { Storage } from "@/storage/storage"
1310
import { Bus } from "@/bus"
1411

15-
import { LLM } from "./llm"
16-
import { Agent } from "@/agent/agent"
17-
1812
export namespace SessionSummary {
19-
const log = Log.create({ service: "session.summary" })
20-
2113
function unquoteGitPath(input: string) {
2214
if (!input.startsWith('"')) return input
2315
if (!input.endsWith('"')) return input
@@ -117,41 +109,6 @@ export namespace SessionSummary {
117109
diffs,
118110
}
119111
await Session.updateMessage(userMsg)
120-
121-
const textPart = msgWithParts.parts.find((p) => p.type === "text" && !p.synthetic) as MessageV2.TextPart
122-
if (textPart && !userMsg.summary?.title) {
123-
const agent = await Agent.get("title")
124-
if (!agent) return
125-
const stream = await LLM.stream({
126-
agent,
127-
user: userMsg,
128-
tools: {},
129-
model: agent.model
130-
? await Provider.getModel(agent.model.providerID, agent.model.modelID)
131-
: ((await Provider.getSmallModel(userMsg.model.providerID)) ??
132-
(await Provider.getModel(userMsg.model.providerID, userMsg.model.modelID))),
133-
small: true,
134-
messages: [
135-
{
136-
role: "user" as const,
137-
content: `
138-
The following is the text to summarize:
139-
<text>
140-
${textPart?.text ?? ""}
141-
</text>
142-
`,
143-
},
144-
],
145-
abort: new AbortController().signal,
146-
sessionID: userMsg.sessionID,
147-
system: [],
148-
retries: 3,
149-
})
150-
const result = await stream.text
151-
log.info("title", { title: result })
152-
userMsg.summary.title = result
153-
await Session.updateMessage(userMsg)
154-
}
155112
}
156113

157114
export const diff = fn(

0 commit comments

Comments
 (0)