mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: dont auto continue if compaction was manual
This commit is contained in:
parent
87b295bc3d
commit
020ee56f25
5 changed files with 9 additions and 1 deletions
|
|
@ -830,6 +830,7 @@ export namespace Server {
|
|||
providerID: body.providerID,
|
||||
modelID: body.modelID,
|
||||
},
|
||||
auto: false,
|
||||
})
|
||||
await SessionPrompt.loop(id)
|
||||
return c.json(true)
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ export namespace SessionCompaction {
|
|||
}
|
||||
agent: string
|
||||
abort: AbortSignal
|
||||
auto: boolean
|
||||
}) {
|
||||
const model = await Provider.getModel(input.model.providerID, input.model.modelID)
|
||||
const system = [...SystemPrompt.compaction(model.providerID)]
|
||||
|
|
@ -198,7 +199,7 @@ export namespace SessionCompaction {
|
|||
}),
|
||||
}),
|
||||
)
|
||||
if (result === "continue") {
|
||||
if (result === "continue" && input.auto) {
|
||||
const continueMsg = await Session.updateMessage({
|
||||
id: Identifier.ascending("message"),
|
||||
role: "user",
|
||||
|
|
@ -234,6 +235,7 @@ export namespace SessionCompaction {
|
|||
providerID: z.string(),
|
||||
modelID: z.string(),
|
||||
}),
|
||||
auto: z.boolean(),
|
||||
}),
|
||||
async (input) => {
|
||||
const msg = await Session.updateMessage({
|
||||
|
|
@ -251,6 +253,7 @@ export namespace SessionCompaction {
|
|||
messageID: msg.id,
|
||||
sessionID: msg.sessionID,
|
||||
type: "compaction",
|
||||
auto: input.auto,
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ export namespace MessageV2 {
|
|||
|
||||
export const CompactionPart = PartBase.extend({
|
||||
type: z.literal("compaction"),
|
||||
auto: z.boolean(),
|
||||
}).meta({
|
||||
ref: "CompactionPart",
|
||||
})
|
||||
|
|
|
|||
|
|
@ -408,6 +408,7 @@ export namespace SessionPrompt {
|
|||
modelID: model.modelID,
|
||||
},
|
||||
sessionID,
|
||||
auto: task.auto,
|
||||
})
|
||||
if (result === "stop") break
|
||||
continue
|
||||
|
|
@ -423,6 +424,7 @@ export namespace SessionPrompt {
|
|||
sessionID,
|
||||
agent: lastUser.agent,
|
||||
model: lastUser.model,
|
||||
auto: true,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,6 +371,7 @@ export type CompactionPart = {
|
|||
sessionID: string
|
||||
messageID: string
|
||||
type: "compaction"
|
||||
auto: boolean
|
||||
}
|
||||
|
||||
export type Part =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue