- service now delegates model/provider/pricing logic to agent crate - ChatService built at startup with EmbedService (graceful degradation) - RoomService wired with EmbedService for Qdrant embedding - Add error types for embedding service
55 lines
1.8 KiB
Rust
55 lines
1.8 KiB
Rust
//! Pricing management — delegates to agent crate.
|
|
|
|
use crate::AppService;
|
|
use crate::error::AppError;
|
|
use session::Session;
|
|
use uuid::Uuid;
|
|
|
|
pub use agent::model::pricing::{CreateModelPricingRequest, ModelPricingResponse, UpdateModelPricingRequest};
|
|
|
|
impl AppService {
|
|
pub async fn agent_model_pricing_list(
|
|
&self,
|
|
model_version_id: Uuid,
|
|
_ctx: &Session,
|
|
) -> Result<Vec<agent::model::pricing::ModelPricingResponse>, AppError> {
|
|
Ok(agent::model::pricing::list_pricing(&self.db, model_version_id).await?)
|
|
}
|
|
|
|
pub async fn agent_model_pricing_get(
|
|
&self,
|
|
id: i64,
|
|
_ctx: &Session,
|
|
) -> Result<agent::model::pricing::ModelPricingResponse, AppError> {
|
|
Ok(agent::model::pricing::get_pricing(&self.db, id).await?)
|
|
}
|
|
|
|
pub async fn agent_model_pricing_create(
|
|
&self,
|
|
request: agent::model::pricing::CreateModelPricingRequest,
|
|
ctx: &Session,
|
|
) -> Result<agent::model::pricing::ModelPricingResponse, AppError> {
|
|
super::provider::require_system_caller(ctx)?;
|
|
Ok(agent::model::pricing::create_pricing(&self.db, request).await?)
|
|
}
|
|
|
|
pub async fn agent_model_pricing_update(
|
|
&self,
|
|
id: i64,
|
|
request: agent::model::pricing::UpdateModelPricingRequest,
|
|
ctx: &Session,
|
|
) -> Result<agent::model::pricing::ModelPricingResponse, AppError> {
|
|
super::provider::require_system_caller(ctx)?;
|
|
Ok(agent::model::pricing::update_pricing(&self.db, id, request).await?)
|
|
}
|
|
|
|
pub async fn agent_model_pricing_delete(
|
|
&self,
|
|
id: i64,
|
|
ctx: &Session,
|
|
) -> Result<(), AppError> {
|
|
super::provider::require_system_caller(ctx)?;
|
|
Ok(agent::model::pricing::delete_pricing(&self.db, id).await?)
|
|
}
|
|
}
|