|
|
@@ -310,31 +310,51 @@ When constructing the summary, try to stick to this template:
|
|
|
}
|
|
|
|
|
|
if (!replay) {
|
|
|
- const continueMsg = yield* session.updateMessage({
|
|
|
- id: MessageID.ascending(),
|
|
|
- role: "user",
|
|
|
- sessionID: input.sessionID,
|
|
|
- time: { created: Date.now() },
|
|
|
- agent: userMessage.agent,
|
|
|
- model: userMessage.model,
|
|
|
- })
|
|
|
- const text =
|
|
|
- (input.overflow
|
|
|
- ? "The previous request exceeded the provider's size limit due to large media attachments. The conversation was compacted and media files were removed from context. If the user was asking about attached images or files, explain that the attachments were too large to process and suggest they try again with smaller or fewer files.\n\n"
|
|
|
- : "") +
|
|
|
- "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed."
|
|
|
- yield* session.updatePart({
|
|
|
- id: PartID.ascending(),
|
|
|
- messageID: continueMsg.id,
|
|
|
- sessionID: input.sessionID,
|
|
|
- type: "text",
|
|
|
- synthetic: true,
|
|
|
- text,
|
|
|
- time: {
|
|
|
- start: Date.now(),
|
|
|
- end: Date.now(),
|
|
|
- },
|
|
|
- })
|
|
|
+ const info = yield* provider.getProvider(userMessage.model.providerID)
|
|
|
+ if (
|
|
|
+ (yield* plugin.trigger(
|
|
|
+ "experimental.compaction.autocontinue",
|
|
|
+ {
|
|
|
+ sessionID: input.sessionID,
|
|
|
+ agent: userMessage.agent,
|
|
|
+ model: yield* provider.getModel(userMessage.model.providerID, userMessage.model.modelID),
|
|
|
+ provider: {
|
|
|
+ source: info.source,
|
|
|
+ info,
|
|
|
+ options: info.options,
|
|
|
+ },
|
|
|
+ message: userMessage,
|
|
|
+ overflow: input.overflow === true,
|
|
|
+ },
|
|
|
+ { enabled: true },
|
|
|
+ )).enabled
|
|
|
+ ) {
|
|
|
+ const continueMsg = yield* session.updateMessage({
|
|
|
+ id: MessageID.ascending(),
|
|
|
+ role: "user",
|
|
|
+ sessionID: input.sessionID,
|
|
|
+ time: { created: Date.now() },
|
|
|
+ agent: userMessage.agent,
|
|
|
+ model: userMessage.model,
|
|
|
+ })
|
|
|
+ const text =
|
|
|
+ (input.overflow
|
|
|
+ ? "The previous request exceeded the provider's size limit due to large media attachments. The conversation was compacted and media files were removed from context. If the user was asking about attached images or files, explain that the attachments were too large to process and suggest they try again with smaller or fewer files.\n\n"
|
|
|
+ : "") +
|
|
|
+ "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed."
|
|
|
+ yield* session.updatePart({
|
|
|
+ id: PartID.ascending(),
|
|
|
+ messageID: continueMsg.id,
|
|
|
+ sessionID: input.sessionID,
|
|
|
+ type: "text",
|
|
|
+ synthetic: true,
|
|
|
+ text,
|
|
|
+ time: {
|
|
|
+ start: Date.now(),
|
|
|
+ end: Date.now(),
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|