| 89 | |
| 90 | impl SessionMessage { |
| 91 | pub fn user(session_id: impl Into<String>, text: impl Into<String>) -> Self { |
| 92 | Self { |
| 93 | id: format!("msg_{}", uuid::Uuid::new_v4()), |
| 94 | session_id: session_id.into(), |
| 95 | role: MessageRole::User, |
| 96 | parts: vec![MessagePart { |
| 97 | id: format!("prt_{}", uuid::Uuid::new_v4()), |
| 98 | part_type: PartType::Text { text: text.into() }, |
| 99 | created_at: Utc::now(), |
| 100 | message_id: None, |
| 101 | }], |
| 102 | created_at: Utc::now(), |
| 103 | metadata: HashMap::new(), |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | pub fn assistant(session_id: impl Into<String>) -> Self { |
| 108 | Self { |