- 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
25 lines
544 B
Rust
25 lines
544 B
Rust
//! Billing — delegates to agent crate.
|
|
|
|
use crate::AppService;
|
|
use crate::error::AppError;
|
|
use uuid::Uuid;
|
|
|
|
impl AppService {
|
|
pub async fn record_ai_usage(
|
|
&self,
|
|
project_uid: Uuid,
|
|
model_id: Uuid,
|
|
input_tokens: i64,
|
|
output_tokens: i64,
|
|
) -> Result<agent::billing::BillingRecord, AppError> {
|
|
Ok(agent::billing::record_ai_usage(
|
|
&self.db,
|
|
project_uid,
|
|
model_id,
|
|
input_tokens,
|
|
output_tokens,
|
|
)
|
|
.await?)
|
|
}
|
|
}
|