tirea_protocol_ag_ui/
history_encoder.rs

1pub struct AgUiHistoryEncoder;
2
3impl AgUiHistoryEncoder {
4    pub fn encode_message(msg: &tirea_contract::Message) -> crate::Message {
5        crate::Message {
6            id: msg.id.clone(),
7            role: match msg.role {
8                tirea_contract::Role::System => crate::Role::System,
9                tirea_contract::Role::User => crate::Role::User,
10                tirea_contract::Role::Assistant => crate::Role::Assistant,
11                tirea_contract::Role::Tool => crate::Role::Tool,
12            },
13            content: msg.content.clone(),
14            tool_call_id: msg.tool_call_id.clone(),
15        }
16    }
17}