feat(ai): 添加 ai_tenant_configs 迁移 + Entity
支持租户级 Provider 路由配置、月度 Token 预算、每日患者限制 unique 索引确保每租户一条配置,迁移号 000117
This commit is contained in:
27
crates/erp-ai/src/entity/ai_tenant_config.rs
Normal file
27
crates/erp-ai/src/entity/ai_tenant_config.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "ai_tenant_configs")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub tenant_id: Uuid,
|
||||
pub default_provider: String,
|
||||
pub fallback_provider: Option<String>,
|
||||
pub analysis_type_overrides: Option<Json>,
|
||||
pub monthly_token_budget: i64,
|
||||
pub daily_patient_limit: i32,
|
||||
pub is_enabled: bool,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
pub created_by: Option<Uuid>,
|
||||
pub updated_by: Option<Uuid>,
|
||||
pub deleted_at: Option<DateTimeUtc>,
|
||||
pub version_lock: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -2,4 +2,5 @@ pub mod ai_analysis;
|
||||
pub mod ai_prompt;
|
||||
pub mod ai_risk_threshold;
|
||||
pub mod ai_suggestion;
|
||||
pub mod ai_tenant_config;
|
||||
pub mod ai_usage;
|
||||
|
||||
Reference in New Issue
Block a user