Skip to main content

subspace_agent_model/
image_attachment.rs

1use std::sync::Arc;
2
3/// An image kept in the chat draft until the user explicitly submits it.
4/// Shared bytes let the UI retain a rejected draft without copying its payload.
5#[derive(Clone, PartialEq, Eq)]
6pub struct ImageAttachment {
7    pub id: u64,
8    pub data: Arc<[u8]>,
9    pub mime_type: String,
10    pub display_name: String,
11}
12
13impl std::fmt::Debug for ImageAttachment {
14    fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15        formatter
16            .debug_struct("ImageAttachment")
17            .field("id", &self.id)
18            .field("bytes", &self.data.len())
19            .field("mime_type", &self.mime_type)
20            .field("display_name", &self.display_name)
21            .finish()
22    }
23}
24
25/// One draft's total encoded image budget, matching the existing private
26/// attachment-workspace budget.
27pub const DRAFT_ATTACHMENT_LIMIT: usize = 20 * 1024 * 1024;