gitdataai/libs/models/rooms/room_ai.rs
ZhenYi c7cee8c344 misc: polish git hooks, billing services, fctool, and API/WebSocket
- git: clean up hook pool worker, commit sync, HTTP rate limiting
- billing: tighten workspace/project/agent billing logic
- fctool: add project boards and issues management tools
- api/ws: minor room WebSocket protocol adjustments
- frontend: add RoomSettingsPanel component
2026-04-30 19:16:57 +08:00

60 lines
1.7 KiB
Rust

use crate::{DateTimeUtc, ModelId, ModelVersionId, RoomId};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "room_ai")]
pub struct Model {
#[sea_orm(primary_key)]
pub room: RoomId,
#[sea_orm(primary_key)]
pub model: ModelId,
pub version: Option<ModelVersionId>,
pub call_count: i64,
pub last_call_at: Option<DateTimeUtc>,
pub history_limit: Option<i64>,
pub system_prompt: Option<String>,
pub temperature: Option<f64>,
pub max_tokens: Option<i64>,
pub use_exact: bool,
pub think: bool,
pub stream: bool,
pub min_score: Option<f32>,
/// Agent type: "chat" (default), "react" (ReAct reasoning),
/// "cot" (Chain-of-Thought), "rewoo" (Plan→Execute→Synthesize),
/// or "reflexion" (Generate→Critique→Revise).
pub agent_type: Option<String>,
pub created_at: DateTimeUtc,
pub updated_at: DateTimeUtc,
}
#[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::super::agents::model::Entity",
from = "Column::Model",
to = "super::super::agents::model::Column::Id"
)]
AiModel,
}
impl Related<super::room::Entity> for Entity {
fn to() -> RelationDef {
Relation::Room.def()
}
}
impl Related<super::super::agents::model::Entity> for Entity {
fn to() -> RelationDef {
Relation::AiModel.def()
}
}
impl ActiveModelBehavior for ActiveModel {}