#[path = "types_chat.rs"]
mod types_chat;
#[path = "types_data.rs"]
mod types_data;
pub use types_chat::*;
pub use types_data::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HealthResponse {
pub status: String,
pub circuit_breaker_state: String,
pub uptime_secs: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ModelInfo {
pub id: String,
pub object: String,
pub owned_by: String,
pub local: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ModelsResponse {
pub object: String,
pub data: Vec<ModelInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SystemResponse {
pub privacy_tier: String,
pub backends: Vec<String>,
pub gpu_available: bool,
pub version: String,
pub telemetry: bool,
pub model_loaded: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub model_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub hint: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tokenizer: Option<String>,
pub endpoints: u32,
pub files: usize,
pub conversations: usize,
pub rag_indexed: bool,
pub rag_chunks: usize,
pub training_runs: usize,
pub audit_entries: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ErrorResponse {
pub error: ErrorDetail,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ErrorDetail {
pub message: String,
#[serde(rename = "type")]
pub type_: String,
pub code: u16,
}
impl ErrorResponse {
#[must_use]
pub fn new(message: impl Into<String>, type_: impl Into<String>, code: u16) -> Self {
Self { error: ErrorDetail { message: message.into(), type_: type_.into(), code } }
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreateConversationRequest {
#[serde(default)]
pub model: Option<String>,
#[serde(default)]
pub title: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConversationsListResponse {
pub conversations: Vec<super::conversations::ConversationMeta>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConversationResponse {
#[serde(flatten)]
pub conversation: super::conversations::Conversation,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConversationCreatedResponse {
pub id: String,
pub title: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ModelLoadRequest {
pub model: String,
#[serde(default = "default_slot")]
pub slot: String,
}
fn default_slot() -> String {
"primary".to_string()
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ModelStatusResponse {
pub loaded: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<super::model_slot::ModelSlotInfo>,
#[serde(skip_serializing_if = "Option::is_none")]
pub uptime_secs: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tokenizer: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SavePromptRequest {
pub name: String,
pub content: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PromptsListResponse {
pub presets: Vec<super::prompts::PromptPreset>,
}