1#[path = "types_chat.rs"]
4mod types_chat;
5#[path = "types_data.rs"]
6mod types_data;
7
8pub use types_chat::*;
10pub use types_data::*;
11
12use serde::{Deserialize, Serialize};
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct HealthResponse {
21 pub status: String,
22 pub circuit_breaker_state: String,
23 pub uptime_secs: u64,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct ModelInfo {
29 pub id: String,
30 pub object: String,
31 pub owned_by: String,
32 pub local: bool,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct ModelsResponse {
38 pub object: String,
39 pub data: Vec<ModelInfo>,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44pub struct SystemResponse {
45 pub privacy_tier: String,
46 pub backends: Vec<String>,
47 pub gpu_available: bool,
48 pub version: String,
49 pub telemetry: bool,
50 pub model_loaded: bool,
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub model_id: Option<String>,
53 #[serde(skip_serializing_if = "Option::is_none")]
55 pub hint: Option<String>,
56 #[serde(skip_serializing_if = "Option::is_none")]
58 pub tokenizer: Option<String>,
59 pub endpoints: u32,
61 pub files: usize,
62 pub conversations: usize,
63 pub rag_indexed: bool,
64 pub rag_chunks: usize,
65 pub training_runs: usize,
66 pub audit_entries: usize,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct ErrorResponse {
76 pub error: ErrorDetail,
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81pub struct ErrorDetail {
82 pub message: String,
83 #[serde(rename = "type")]
84 pub type_: String,
85 pub code: u16,
86}
87
88impl ErrorResponse {
89 #[must_use]
90 pub fn new(message: impl Into<String>, type_: impl Into<String>, code: u16) -> Self {
91 Self { error: ErrorDetail { message: message.into(), type_: type_.into(), code } }
92 }
93}
94
95#[derive(Debug, Clone, Default, Serialize, Deserialize)]
101pub struct CreateConversationRequest {
102 #[serde(default)]
103 pub model: Option<String>,
104 #[serde(default)]
105 pub title: Option<String>,
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110pub struct ConversationsListResponse {
111 pub conversations: Vec<super::conversations::ConversationMeta>,
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116pub struct ConversationResponse {
117 #[serde(flatten)]
118 pub conversation: super::conversations::Conversation,
119}
120
121#[derive(Debug, Clone, Serialize, Deserialize)]
123pub struct ConversationCreatedResponse {
124 pub id: String,
125 pub title: String,
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
134pub struct ModelLoadRequest {
135 pub model: String,
136 #[serde(default = "default_slot")]
137 pub slot: String,
138}
139
140fn default_slot() -> String {
141 "primary".to_string()
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146pub struct ModelStatusResponse {
147 pub loaded: bool,
148 #[serde(skip_serializing_if = "Option::is_none")]
149 pub model: Option<super::model_slot::ModelSlotInfo>,
150 #[serde(skip_serializing_if = "Option::is_none")]
151 pub uptime_secs: Option<u64>,
152 #[serde(skip_serializing_if = "Option::is_none")]
154 pub tokenizer: Option<String>,
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize)]
163pub struct SavePromptRequest {
164 pub name: String,
165 pub content: String,
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize)]
170pub struct PromptsListResponse {
171 pub presets: Vec<super::prompts::PromptPreset>,
172}