chore: code cleanup and documentation overhaul
- Remove debug header dump from MITM proxy (was temp debugging code) - Suppress dead_code warnings for intentional OpenAI compat fields - Rewrite README with styled mermaid architecture diagrams, full feature listing, usage examples, and CLI reference - Update endpoint-gap-analysis: images implemented, audio only stretch - Update mitm-interception-status: add request modification and error capture components - Update standalone-ls-todo: add new endpoints to test results - Zero compiler warnings
This commit is contained in:
@@ -87,8 +87,9 @@ pub(crate) struct CompletionRequest {
|
||||
/// Max completion tokens — forwarded to Google as maxOutputTokens via MITM.
|
||||
#[serde(default)]
|
||||
pub max_completion_tokens: Option<u64>,
|
||||
/// User identifier — accepted, not used.
|
||||
/// User identifier -- accepted, not used.
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
pub user: Option<String>,
|
||||
/// Frequency penalty — forwarded to Google via MITM.
|
||||
#[serde(default)]
|
||||
@@ -111,8 +112,9 @@ pub(crate) struct CompletionRequest {
|
||||
/// Session/conversation ID for multi-turn reuse (custom extension).
|
||||
#[serde(default)]
|
||||
pub conversation: Option<serde_json::Value>,
|
||||
/// Metadata — accepted and ignored (no upstream equivalent).
|
||||
/// Metadata -- accepted and ignored (no upstream equivalent).
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
/// Number of completions to generate. Each uses a separate cascade (costs N× quota).
|
||||
/// Defaults to 1. Only supported in sync mode; streaming always uses n=1.
|
||||
@@ -163,12 +165,14 @@ pub(crate) struct ResponseFormat {
|
||||
pub(crate) struct JsonSchemaFormat {
|
||||
/// Schema name (for client identification).
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
pub name: Option<String>,
|
||||
/// The actual JSON schema object — forwarded as Gemini's responseSchema.
|
||||
#[serde(default)]
|
||||
pub schema: Option<serde_json::Value>,
|
||||
/// Whether to enable strict schema adherence.
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
pub strict: Option<bool>,
|
||||
}
|
||||
|
||||
|
||||
@@ -633,16 +633,6 @@ async fn handle_http_over_tls(
|
||||
};
|
||||
|
||||
// Forward the request — if write fails, reconnect and retry once
|
||||
// DEBUG: dump headers and total size
|
||||
if req_path.contains("streamGenerateContent") {
|
||||
let hdr_end = find_headers_end(&request_buf).unwrap_or(request_buf.len());
|
||||
let hdr_str = String::from_utf8_lossy(&request_buf[..hdr_end.min(request_buf.len())]);
|
||||
info!(
|
||||
total_buf_len = request_buf.len(),
|
||||
body_len = request_buf.len() - hdr_end,
|
||||
"MITM: sending request to upstream\n{hdr_str}"
|
||||
);
|
||||
}
|
||||
if let Err(e) = conn.write_all(&request_buf).await {
|
||||
debug!(domain, error = %e, "MITM: upstream write failed, reconnecting");
|
||||
let c = connect_upstream(domain, &upstream_config).await?;
|
||||
|
||||
@@ -68,6 +68,7 @@ pub struct UpstreamError {
|
||||
/// HTTP status code from Google (e.g. 400, 429, 500).
|
||||
pub status: u16,
|
||||
/// Raw error body from Google (usually JSON).
|
||||
#[allow(dead_code)]
|
||||
pub body: String,
|
||||
/// Parsed error message, if available.
|
||||
pub message: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user