gitdataai/libs/service/agent/model_parameter_profile.rs

64 lines
2.2 KiB
Rust

//! Parameter profile management — delegates to agent crate.
use crate::AppService;
use crate::error::AppError;
use session::Session;
use uuid::Uuid;
pub use agent::model::parameter_profile::{
CreateModelParameterProfileRequest, ModelParameterProfileResponse,
UpdateModelParameterProfileRequest,
};
impl AppService {
pub async fn agent_model_parameter_profile_list(
&self,
model_version_id: Uuid,
_ctx: &Session,
) -> Result<Vec<agent::model::parameter_profile::ModelParameterProfileResponse>, AppError> {
Ok(
agent::model::parameter_profile::list_parameter_profiles(&self.db, model_version_id)
.await?,
)
}
pub async fn agent_model_parameter_profile_get(
&self,
id: i64,
_ctx: &Session,
) -> Result<agent::model::parameter_profile::ModelParameterProfileResponse, AppError> {
Ok(agent::model::parameter_profile::get_parameter_profile(&self.db, id).await?)
}
pub async fn agent_model_parameter_profile_create(
&self,
request: agent::model::parameter_profile::CreateModelParameterProfileRequest,
ctx: &Session,
) -> Result<agent::model::parameter_profile::ModelParameterProfileResponse, AppError> {
super::provider::require_system_caller(ctx)?;
Ok(agent::model::parameter_profile::create_parameter_profile(&self.db, request).await?)
}
pub async fn agent_model_parameter_profile_update(
&self,
id: i64,
request: agent::model::parameter_profile::UpdateModelParameterProfileRequest,
ctx: &Session,
) -> Result<agent::model::parameter_profile::ModelParameterProfileResponse, AppError> {
super::provider::require_system_caller(ctx)?;
Ok(
agent::model::parameter_profile::update_parameter_profile(&self.db, id, request)
.await?,
)
}
pub async fn agent_model_parameter_profile_delete(
&self,
id: i64,
ctx: &Session,
) -> Result<(), AppError> {
super::provider::require_system_caller(ctx)?;
Ok(agent::model::parameter_profile::delete_parameter_profile(&self.db, id).await?)
}
}