Simplify crossterm imports (#2545)
This commit is contained in:
parent
03263f5e88
commit
8024ded58f
|
@ -16,7 +16,6 @@ path = "src/main.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
average = "0.14"
|
average = "0.14"
|
||||||
clap = { version = "4.4.5", features = ["derive", "env"] }
|
clap = { version = "4.4.5", features = ["derive", "env"] }
|
||||||
crossterm = "0.28.1"
|
|
||||||
float-ord = "0.3.2"
|
float-ord = "0.3.2"
|
||||||
serde = {version = "1.0.188", features = ["derive"]}
|
serde = {version = "1.0.188", features = ["derive"]}
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -25,7 +24,7 @@ text-generation-client = { path = "../backends/client" }
|
||||||
thiserror = "1.0.48"
|
thiserror = "1.0.48"
|
||||||
tokenizers = { workspace = true }
|
tokenizers = { workspace = true }
|
||||||
tokio = { version = "1.32.0", features = ["rt", "rt-multi-thread", "parking_lot", "signal", "sync", "macros"] }
|
tokio = { version = "1.32.0", features = ["rt", "rt-multi-thread", "parking_lot", "signal", "sync", "macros"] }
|
||||||
ratatui = { version = "0.28.1", default-features = false, features = ["crossterm"] }
|
ratatui = "0.28.1"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter"] }
|
tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter"] }
|
||||||
hf-hub = { workspace = true }
|
hf-hub = { workspace = true }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// Inspired by https://github.com/hatoo/oha/blob/bb989ea3cd77727e7743e7daa60a19894bb5e901/src/monitor.rs
|
/// Inspired by https://github.com/hatoo/oha/blob/bb989ea3cd77727e7743e7daa60a19894bb5e901/src/monitor.rs
|
||||||
use crate::generation::{Decode, Message, Prefill};
|
use crate::generation::{Decode, Message, Prefill};
|
||||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||||
use ratatui::layout::{Alignment, Constraint, Direction, Layout};
|
use ratatui::layout::{Alignment, Constraint, Direction, Layout};
|
||||||
use ratatui::style::{Color, Modifier, Style};
|
use ratatui::style::{Color, Modifier, Style};
|
||||||
use ratatui::text::{Line, Span};
|
use ratatui::text::{Line, Span};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/// Inspired by https://github.com/orhun/rust-tui-template/blob/472aa515119d4c94903eac12d9784417281dc7f5/src/event.rs
|
/// Inspired by https://github.com/orhun/rust-tui-template/blob/472aa515119d4c94903eac12d9784417281dc7f5/src/event.rs
|
||||||
use crossterm::event;
|
use ratatui::crossterm::event;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use tokio::sync::{broadcast, mpsc};
|
use tokio::sync::{broadcast, mpsc};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ mod utils;
|
||||||
|
|
||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
use crate::event::Event;
|
use crate::event::Event;
|
||||||
use crossterm::ExecutableCommand;
|
use ratatui::crossterm::ExecutableCommand;
|
||||||
use ratatui::backend::CrosstermBackend;
|
use ratatui::backend::CrosstermBackend;
|
||||||
use ratatui::Terminal;
|
use ratatui::Terminal;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -50,9 +50,9 @@ pub async fn run(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize terminal properties
|
// Initialize terminal properties
|
||||||
crossterm::terminal::enable_raw_mode()?;
|
ratatui::crossterm::terminal::enable_raw_mode()?;
|
||||||
io::stdout().execute(crossterm::terminal::EnterAlternateScreen)?;
|
io::stdout().execute(ratatui::crossterm::terminal::EnterAlternateScreen)?;
|
||||||
io::stdout().execute(crossterm::cursor::Hide)?;
|
io::stdout().execute(ratatui::crossterm::cursor::Hide)?;
|
||||||
|
|
||||||
// Initialize terminal
|
// Initialize terminal
|
||||||
let mut terminal = {
|
let mut terminal = {
|
||||||
|
@ -128,9 +128,9 @@ pub async fn run(
|
||||||
let _ = shutdown_guard_receiver.recv().await;
|
let _ = shutdown_guard_receiver.recv().await;
|
||||||
|
|
||||||
// Revert terminal to original view
|
// Revert terminal to original view
|
||||||
io::stdout().execute(crossterm::terminal::LeaveAlternateScreen)?;
|
io::stdout().execute(ratatui::crossterm::terminal::LeaveAlternateScreen)?;
|
||||||
crossterm::terminal::disable_raw_mode()?;
|
ratatui::crossterm::terminal::disable_raw_mode()?;
|
||||||
io::stdout().execute(crossterm::cursor::Show)?;
|
io::stdout().execute(ratatui::crossterm::cursor::Show)?;
|
||||||
|
|
||||||
let parameters_table = table::parameters_table(
|
let parameters_table = table::parameters_table(
|
||||||
tokenizer_name,
|
tokenizer_name,
|
||||||
|
|
Loading…
Reference in New Issue