- Add gitignore and prettier configuration files for project scaffolding - Implement room access control service with project member verification - Create user access key management with CRUD operations and activity logging - Add accordion UI component for frontend expandable sections - Implement room AI configuration with list, upsert, and delete operations - Add AI event types for agent join/leave/status change tracking - Create streaming AI processing services for mode and react patterns - Build room AI service with model detection and idempotency handling - Integrate chat service orchestration for AI message processing - Add typing indicators and stream cancellation for AI interactions - Implement mention parsing and context extraction for AI agents
60 lines
1.7 KiB
Rust
60 lines
1.7 KiB
Rust
use crate::{DateTimeUtc, MessageId, RoomId, RoomThreadId, Seq, UserId};
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use super::{MessageContentType, MessageSenderType};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "room_message")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: MessageId,
|
|
pub seq: Seq,
|
|
pub room: RoomId,
|
|
pub sender_type: MessageSenderType,
|
|
pub sender_id: Option<UserId>,
|
|
/// AI model ID — set when sender_type = "ai", used for display name lookups.
|
|
pub model_id: Option<Uuid>,
|
|
pub thread: Option<RoomThreadId>,
|
|
pub in_reply_to: Option<MessageId>,
|
|
pub content: String,
|
|
pub content_type: MessageContentType,
|
|
/// Accumulated AI reasoning/thinking text.
|
|
pub thinking_content: Option<String>,
|
|
pub edited_at: Option<DateTimeUtc>,
|
|
pub send_at: DateTimeUtc,
|
|
pub revoked: Option<DateTimeUtc>,
|
|
pub revoked_by: Option<UserId>,
|
|
#[sea_orm(ignore)]
|
|
pub content_tsv: Option<String>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::room::Entity",
|
|
from = "Column::Room",
|
|
to = "super::room::Column::Id"
|
|
)]
|
|
Room,
|
|
#[sea_orm(
|
|
belongs_to = "super::room_thread::Entity",
|
|
from = "Column::Thread",
|
|
to = "super::room_thread::Column::Id"
|
|
)]
|
|
Thread,
|
|
}
|
|
|
|
impl Related<super::room::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Room.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::room_thread::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Thread.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {} |