56 lines
1.4 KiB
Rust
56 lines
1.4 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>,
|
|
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 {}
|