36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
use crate::{DateTimeUtc, Uuid};
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel)]
|
|
#[sea_orm(table_name = "ai_message")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: Uuid,
|
|
pub conversation_id: Uuid,
|
|
pub parent_message_id: Option<Uuid>,
|
|
pub role: String,
|
|
pub content: Json,
|
|
pub model: Option<String>,
|
|
pub is_fork_origin: bool,
|
|
pub stop_reason: Option<String>,
|
|
pub input_tokens: Option<i32>,
|
|
pub output_tokens: Option<i32>,
|
|
pub latency_ms: Option<i32>,
|
|
pub metadata: Option<Json>,
|
|
pub room_id: Option<Uuid>,
|
|
/// Groups all versions of the same message (original + edits).
|
|
/// For new messages, this equals the message id itself.
|
|
pub version_group_id: Option<Uuid>,
|
|
/// Sequential version number within the group (1 = original, 2 = first edit, etc.)
|
|
pub version_number: i32,
|
|
/// Whether this is the current active version in the group.
|
|
pub is_latest: bool,
|
|
pub created_at: DateTimeUtc,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|