fix build warnings
This commit is contained in:
@@ -106,7 +106,7 @@ struct TerminalState {
|
|||||||
/// SSE rate tracking for wave animation
|
/// SSE rate tracking for wave animation
|
||||||
sse_wave_history: VecDeque<f64>, // Wave animation values for SSEs
|
sse_wave_history: VecDeque<f64>, // Wave animation values for SSEs
|
||||||
/// Start time for token tracking
|
/// Start time for token tracking
|
||||||
session_start: Instant,
|
_session_start: Instant, // Prefixed with _ to indicate it's intentionally unused for now
|
||||||
/// SSE counter (including pings)
|
/// SSE counter (including pings)
|
||||||
sse_count: u32,
|
sse_count: u32,
|
||||||
/// Last token count for rate calculation
|
/// Last token count for rate calculation
|
||||||
@@ -147,7 +147,7 @@ impl TerminalState {
|
|||||||
last_tool_header_index: None,
|
last_tool_header_index: None,
|
||||||
token_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation
|
token_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation
|
||||||
sse_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation
|
sse_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation
|
||||||
session_start: Instant::now(),
|
_session_start: Instant::now(),
|
||||||
last_token_count: 0,
|
last_token_count: 0,
|
||||||
sse_count: 0,
|
sse_count: 0,
|
||||||
}
|
}
|
||||||
@@ -459,18 +459,6 @@ impl TerminalState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add padding lines to ensure content can be scrolled fully into view
|
|
||||||
fn add_padding(&mut self) {
|
|
||||||
// Add enough blank lines to ensure the last content can be scrolled into view
|
|
||||||
// This is a workaround for the scrolling calculation issues
|
|
||||||
let padding_lines = 5; // Add 5 blank lines for padding
|
|
||||||
for _ in 0..padding_lines {
|
|
||||||
self.output_history.push(String::new());
|
|
||||||
}
|
|
||||||
// Reset scroll to show the actual content (not the padding)
|
|
||||||
// This keeps the view focused on the last real content
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Public interface for the retro terminal
|
/// Public interface for the retro terminal
|
||||||
@@ -1571,43 +1559,6 @@ impl RetroTui {
|
|||||||
state.manual_scroll = false;
|
state.manual_scroll = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Scroll tool activity up
|
|
||||||
pub fn tool_scroll_up(&self) {
|
|
||||||
if let Ok(mut state) = self.state.lock() {
|
|
||||||
if state.tool_activity_scroll > 0 {
|
|
||||||
state.tool_activity_auto_scroll = false;
|
|
||||||
state.tool_activity_scroll -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Scroll tool activity down
|
|
||||||
pub fn tool_scroll_down(&self) {
|
|
||||||
if let Ok(mut state) = self.state.lock() {
|
|
||||||
let total_lines = state.tool_activity.len();
|
|
||||||
let visible_height = 6; // Tool detail area height minus borders
|
|
||||||
|
|
||||||
if total_lines > visible_height {
|
|
||||||
let max_scroll = total_lines.saturating_sub(visible_height);
|
|
||||||
if state.tool_activity_scroll < max_scroll {
|
|
||||||
state.tool_activity_auto_scroll = false;
|
|
||||||
state.tool_activity_scroll = (state.tool_activity_scroll + 1).min(max_scroll);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Reset tool activity scroll to auto-scroll mode
|
|
||||||
pub fn tool_scroll_auto(&self) {
|
|
||||||
if let Ok(mut state) = self.state.lock() {
|
|
||||||
state.tool_activity_auto_scroll = true;
|
|
||||||
let visible_height = 6;
|
|
||||||
if state.tool_activity.len() > visible_height {
|
|
||||||
state.tool_activity_scroll = state.tool_activity.len().saturating_sub(visible_height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for RetroTui {
|
impl Drop for RetroTui {
|
||||||
|
|||||||
@@ -87,13 +87,6 @@ impl ColorTheme {
|
|||||||
Ok(theme)
|
Ok(theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Save a theme to a JSON file
|
|
||||||
pub fn to_file<P: AsRef<Path>>(&self, path: P) -> Result<()> {
|
|
||||||
let content = serde_json::to_string_pretty(self)?;
|
|
||||||
fs::write(path, content)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the default retro sci-fi theme (inspired by Alien terminals)
|
/// Get the default retro sci-fi theme (inspired by Alien terminals)
|
||||||
pub fn default() -> Self {
|
pub fn default() -> Self {
|
||||||
ColorTheme {
|
ColorTheme {
|
||||||
@@ -151,41 +144,4 @@ impl ColorTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Create example theme files in the user's config directory
|
|
||||||
pub fn create_example_themes() -> Result<()> {
|
|
||||||
let home = dirs::home_dir().ok_or_else(|| anyhow::anyhow!("Could not find home directory"))?;
|
|
||||||
let themes_dir = home.join(".config").join("g3").join("themes");
|
|
||||||
|
|
||||||
// Create directory if it doesn't exist
|
|
||||||
fs::create_dir_all(&themes_dir)?;
|
|
||||||
|
|
||||||
// Save default theme
|
|
||||||
let default_theme = ColorTheme::default();
|
|
||||||
default_theme.to_file(themes_dir.join("retro.json"))?;
|
|
||||||
|
|
||||||
// Save Dracula theme
|
|
||||||
let dracula_theme = ColorTheme::dracula();
|
|
||||||
dracula_theme.to_file(themes_dir.join("dracula.json"))?;
|
|
||||||
|
|
||||||
// Create a custom example theme (Matrix-inspired)
|
|
||||||
let matrix_theme = ColorTheme {
|
|
||||||
name: "Matrix".to_string(),
|
|
||||||
terminal_green: ColorValue::Rgb { r: 0, g: 255, b: 0 },
|
|
||||||
terminal_amber: ColorValue::Rgb { r: 0, g: 200, b: 0 },
|
|
||||||
terminal_dim_green: ColorValue::Rgb { r: 0, g: 100, b: 0 },
|
|
||||||
terminal_bg: ColorValue::Rgb { r: 0, g: 0, b: 0 },
|
|
||||||
terminal_cyan: ColorValue::Rgb { r: 0, g: 255, b: 128 },
|
|
||||||
terminal_red: ColorValue::Rgb { r: 255, g: 0, b: 0 },
|
|
||||||
terminal_pale_blue: ColorValue::Rgb { r: 0, g: 255, b: 200 },
|
|
||||||
terminal_dark_amber: ColorValue::Rgb { r: 0, g: 150, b: 0 },
|
|
||||||
terminal_white: ColorValue::Rgb { r: 200, g: 255, b: 200 },
|
|
||||||
terminal_success: ColorValue::Rgb { r: 0, g: 255, b: 0 }, // Bright green for Matrix theme
|
|
||||||
};
|
|
||||||
matrix_theme.to_file(themes_dir.join("matrix.json"))?;
|
|
||||||
|
|
||||||
println!("Example theme files created in: {}", themes_dir.display());
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
//! - Detailed error logging with context information
|
//! - Detailed error logging with context information
|
||||||
//! - Request/response capture for debugging
|
//! - Request/response capture for debugging
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::Result;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
@@ -27,11 +27,7 @@ const DEFAULT_MAX_RETRY_DELAY_MS: u64 = 10000;
|
|||||||
/// Spread over 10 minutes (600 seconds) with 6 retries
|
/// Spread over 10 minutes (600 seconds) with 6 retries
|
||||||
const AUTONOMOUS_MAX_RETRY_DELAY_MS: u64 = 120000; // 2 minutes max per retry
|
const AUTONOMOUS_MAX_RETRY_DELAY_MS: u64 = 120000; // 2 minutes max per retry
|
||||||
|
|
||||||
/// Total time budget for autonomous mode retries (10 minutes)
|
// Removed unused constants AUTONOMOUS_RETRY_BUDGET_MS and DEFAULT_JITTER_FACTOR
|
||||||
const AUTONOMOUS_RETRY_BUDGET_MS: u64 = 600000;
|
|
||||||
|
|
||||||
/// Jitter factor (0.0 to 1.0) to randomize retry delays (default)
|
|
||||||
const DEFAULT_JITTER_FACTOR: f64 = 0.3;
|
|
||||||
|
|
||||||
/// Jitter factor for autonomous mode (higher for better distribution)
|
/// Jitter factor for autonomous mode (higher for better distribution)
|
||||||
const JITTER_FACTOR: f64 = 0.3;
|
const JITTER_FACTOR: f64 = 0.3;
|
||||||
|
|||||||
Reference in New Issue
Block a user