forked from vhaudiquet/rhema-together
feat: add image attachments for vision models
A chat line can carry up to four images, each capped at 5 MB and sniffed from its bytes. Uploads go to a room route first, the message references the ids, and the bytes are served back to members; an upload no message claims within an hour is swept on the next send. Images only make sense when the model can look at them, and the catalog's answer is tri-state, so the gate is a stored fact, not a guess: the provider listing remembers supports_vision per kind and model, the upload and send routes refuse when the room's effective model is not a known vision model, and the composer hides the attach button on the same fact, which rides the room payload. At turn time the fact goes to the host agent, which sends the blocks on a vision model and leaves a note where each image was on the rest.
This commit is contained in:
1 parent
acc545ede7
commit
2e17e7463c
18 files changed
+624
-46
No files matched your search
@@ -15,6 +15,19 @@ pub struct Message {
|
||||
pub text: String,
|
||||
pub mentions: bool,
|
||||
pub created_at: i64,
|
||||
/// The images riding this line, metadata only: the bytes are served
|
||||
/// from the room's attachment route. Empty for older rows.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub attachments: Vec<Attachment>,
|
||||
}
|
||||
|
||||
/// An image attached to a chat line. `mime` comes from the stored
|
||||
/// bytes' magic, never from the uploader's header.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Attachment {
|
||||
pub id: String,
|
||||
pub mime: String,
|
||||
pub size: i64,
|
||||
}
|
||||
|
||||
/// A room as the sidebar needs it.
|
||||
@@ -40,6 +53,9 @@ pub struct Room {
|
||||
pub repo_url: Option<String>,
|
||||
pub model: Option<String>,
|
||||
pub max_turn_steps: i64,
|
||||
/// Whether the room's effective model is known to accept images.
|
||||
/// `None` is unknown, not no: facts arrive with a provider listing.
|
||||
pub model_vision: Option<bool>,
|
||||
pub created_at: i64,
|
||||
pub archived_at: Option<i64>,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user