38 lines
1.0 KiB
Rust
38 lines
1.0 KiB
Rust
use crate::{AiSessionId, DateTimeUtc, UserId};
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use super::ToolCallStatus;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "ai_tool_call")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub tool_call_id: String,
|
|
#[sea_orm(primary_key)]
|
|
pub session: AiSessionId,
|
|
pub tool_name: String,
|
|
pub caller: UserId,
|
|
pub arguments: sea_orm::JsonValue,
|
|
pub result: sea_orm::JsonValue,
|
|
pub status: String,
|
|
pub execution_time_ms: Option<i64>,
|
|
pub error_message: Option<String>,
|
|
pub error_stack: Option<String>,
|
|
pub retry_count: i32,
|
|
pub created_at: DateTimeUtc,
|
|
pub completed_at: Option<DateTimeUtc>,
|
|
pub updated_at: DateTimeUtc,
|
|
}
|
|
|
|
impl Model {
|
|
pub fn status_enum(&self) -> Result<ToolCallStatus, &'static str> {
|
|
self.status.parse()
|
|
}
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|