Additional cleanup of caching
This commit is contained in:
@@ -134,6 +134,9 @@ pub struct RequestParams {
|
||||
/// Full Bedrock conversation history for direct Bedrock calls.
|
||||
/// When present, the Bedrock path uses this instead of extracting from task_context.
|
||||
pub bedrock_message_history: Vec<crate::ai::bedrock::convert::ConversationMessage>,
|
||||
/// Compacted summary from a prior summarization pass. Injected into the system
|
||||
/// prompt so it benefits from system-level caching.
|
||||
pub bedrock_compact_summary: Option<String>,
|
||||
/// Populated by the Bedrock path after building the message list.
|
||||
/// Contains the full messages sent (old history + new input) so the controller
|
||||
/// can store them back into the conversation for the next request cycle.
|
||||
@@ -328,6 +331,7 @@ impl RequestParams {
|
||||
parent_agent_id: None,
|
||||
agent_name: None,
|
||||
bedrock_message_history: Vec::new(),
|
||||
bedrock_compact_summary: None,
|
||||
bedrock_messages_sent: std::sync::Arc::new(std::sync::Mutex::new(Vec::new())),
|
||||
is_summarization: false,
|
||||
}
|
||||
|
||||
@@ -153,6 +153,7 @@ pub async fn generate_multi_agent_output(
|
||||
model_id,
|
||||
root_task_id: params.root_task_id.clone(),
|
||||
bedrock_message_history: params.bedrock_message_history.clone(),
|
||||
bedrock_compact_summary: params.bedrock_compact_summary.clone(),
|
||||
bedrock_messages_sent: params.bedrock_messages_sent.clone(),
|
||||
is_summarization: params.is_summarization,
|
||||
};
|
||||
|
||||
@@ -41,6 +41,7 @@ fn request_params_with_ask_user_question_enabled(ask_user_question_enabled: bool
|
||||
parent_agent_id: None,
|
||||
agent_name: None,
|
||||
bedrock_message_history: Vec::new(),
|
||||
bedrock_compact_summary: None,
|
||||
bedrock_messages_sent: std::sync::Arc::new(std::sync::Mutex::new(Vec::new())),
|
||||
is_summarization: false,
|
||||
}
|
||||
|
||||
@@ -241,6 +241,11 @@ pub struct AIConversation {
|
||||
/// context window size, NOT a cumulative total.
|
||||
current_context_tokens: u32,
|
||||
|
||||
/// When set, contains the compacted summary of prior conversation history.
|
||||
/// Injected into the system prompt (not the messages array) so it benefits
|
||||
/// from system-level caching at the 1-hour TTL.
|
||||
compact_summary: Option<String>,
|
||||
|
||||
/// Guards against repeated auto-compact triggers within the same high-usage window.
|
||||
/// Set to true when auto-compact fires; reset when summarization completes.
|
||||
has_pending_auto_compact: bool,
|
||||
@@ -298,6 +303,7 @@ impl AIConversation {
|
||||
is_remote_child: false,
|
||||
last_event_sequence: None,
|
||||
bedrock_message_history: Vec::new(),
|
||||
compact_summary: None,
|
||||
current_context_tokens: 0,
|
||||
has_pending_auto_compact: false,
|
||||
subagent_retry_count: 0,
|
||||
@@ -498,6 +504,7 @@ impl AIConversation {
|
||||
is_remote_child: false,
|
||||
last_event_sequence,
|
||||
bedrock_message_history,
|
||||
compact_summary: None,
|
||||
current_context_tokens: 0,
|
||||
has_pending_auto_compact: false,
|
||||
subagent_retry_count: 0,
|
||||
@@ -525,6 +532,14 @@ impl AIConversation {
|
||||
self.bedrock_message_history.extend(messages);
|
||||
}
|
||||
|
||||
pub fn compact_summary(&self) -> Option<&str> {
|
||||
self.compact_summary.as_deref()
|
||||
}
|
||||
|
||||
pub fn set_compact_summary(&mut self, summary: Option<String>) {
|
||||
self.compact_summary = summary;
|
||||
}
|
||||
|
||||
/// Assigns fresh exchange IDs to all exchanges in this conversation.
|
||||
/// Used when forking conversations to avoid ID collisions with persisted blocks.
|
||||
pub fn reassign_exchange_ids(&mut self) {
|
||||
|
||||
Reference in New Issue
Block a user