58 lines
1.8 KiB
Rust
58 lines
1.8 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// AI tool call execution status. Stored as `"pending"`, `"running"`, `"success"`,
|
|
/// `"failed"`, or `"retrying"`.
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum ToolCallStatus {
|
|
Pending,
|
|
Running,
|
|
Success,
|
|
Failed,
|
|
Retrying,
|
|
}
|
|
|
|
impl std::fmt::Display for ToolCallStatus {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
ToolCallStatus::Pending => write!(f, "pending"),
|
|
ToolCallStatus::Running => write!(f, "running"),
|
|
ToolCallStatus::Success => write!(f, "success"),
|
|
ToolCallStatus::Failed => write!(f, "failed"),
|
|
ToolCallStatus::Retrying => write!(f, "retrying"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::str::FromStr for ToolCallStatus {
|
|
type Err = &'static str;
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
"pending" => Ok(ToolCallStatus::Pending),
|
|
"running" => Ok(ToolCallStatus::Running),
|
|
"success" => Ok(ToolCallStatus::Success),
|
|
"failed" => Ok(ToolCallStatus::Failed),
|
|
"retrying" => Ok(ToolCallStatus::Retrying),
|
|
_ => Err("unknown tool call status"),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub use ai_conversation::Entity as AiConversation;
|
|
pub use ai_message::Entity as AiMessage;
|
|
pub use ai_message_fork::Entity as AiMessageFork;
|
|
pub use ai_shared_conversation::Entity as AiSharedConversation;
|
|
pub use ai_token_usage::Entity as AiTokenUsage;
|
|
pub use billing_error::Entity as BillingError;
|
|
pub use subscription::Entity as Subscription;
|
|
|
|
pub mod ai_conversation;
|
|
pub mod ai_message;
|
|
pub mod ai_message_fork;
|
|
pub mod ai_session;
|
|
pub mod ai_shared_conversation;
|
|
pub mod ai_tool_auth;
|
|
pub mod ai_tool_call;
|
|
pub mod ai_token_usage;
|
|
pub mod billing_error;
|
|
pub mod subscription;
|