Skip to content

Commit 4e3b978

Browse files
h3c-hexinqiuYliangM
andcommitted
fix(vision): make streaming opt-in and bounded
Preserve the existing non-streaming request shape by default while allowing callers to opt into SSE, a total request budget, and single-attempt behavior. Reuse the shared retry policy and HTTP error handling, reject empty analyses, bound response buffers, and report incomplete streams as truncated. Document the compatibility controls and cover streaming, JSON fallback, timeout, UTF-8 chunking, and empty-response paths. Co-authored-by: qiuYliangM <185303122+qiuYliangM@users.noreply.github.com> Signed-off-by: hexin <he.xin@h3c.com>
1 parent 4858849 commit 4e3b978

3 files changed

Lines changed: 528 additions & 69 deletions

File tree

crates/tui/src/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,6 +2967,19 @@ pub struct VisionModelConfig {
29672967
/// Base URL for the vision model API. Defaults to OpenAI.
29682968
#[serde(default)]
29692969
pub base_url: Option<String>,
2970+
/// Total request budget in seconds, including retries and response body
2971+
/// consumption. `None` or `0` preserves the 120-second default; larger
2972+
/// values are capped at one hour.
2973+
#[serde(default)]
2974+
pub request_timeout_secs: Option<u64>,
2975+
/// Whether to request an SSE response. `None` preserves the existing
2976+
/// non-streaming request shape; callers must opt in with `Some(true)`.
2977+
#[serde(default)]
2978+
pub stream: Option<bool>,
2979+
/// Whether the existing transient-error retry policy is enabled. `None`
2980+
/// preserves the current default; `Some(false)` makes one attempt.
2981+
#[serde(default)]
2982+
pub retry_on_transient_errors: Option<bool>,
29702983
}
29712984

29722985
/// `[runtime_api]` table — knobs for the local HTTP/SSE daemon.

0 commit comments

Comments
 (0)