first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+25 -7
View File
@@ -3,13 +3,10 @@
use galaxyui::{Entity, SingletonEntity};
use std::collections::HashMap;
use crate::{
ai::{
agent::conversation::{AIConversation, AIConversationId},
blocklist::history_model::convert_persisted_conversation_to_ai_conversation_with_metadata,
},
persistence::model::AgentConversation,
};
use crate::ai::agent::conversation::{AIConversation, AIConversationId};
use crate::ai::blocklist::history_model::convert_persisted_conversation_to_ai_conversation_with_metadata;
use crate::persistence::model::AgentConversation;
/// Singleton model that holds restored agent conversations on app startup.
///
@@ -52,6 +49,27 @@ impl RestoredAgentConversations {
pub fn take_conversation(&mut self, id: &AIConversationId) -> Option<AIConversation> {
self.conversations.remove(id)
}
/// Takes and returns AIConversations for the given IDs, sorted by first exchange start time.
pub fn take_conversations(
&mut self,
conversation_ids: &[AIConversationId],
) -> Vec<AIConversation> {
let mut conversations = Vec::new();
for &conversation_id in conversation_ids {
if let Some(conversation) = self.take_conversation(&conversation_id) {
conversations.push(conversation);
}
}
// Sort by first exchange start time (oldest first)
conversations.sort_by_key(|conversation| {
conversation
.first_exchange()
.map(|exchange| exchange.start_time)
});
conversations
}
}
impl Entity for RestoredAgentConversations {