main: add a custom panic hook, which tries to reset the terminal before printing logs
This commit is contained in:
+12
-2
@@ -14,7 +14,7 @@ use futures::{StreamExt, future::FutureExt};
|
||||
|
||||
use ratatui::prelude::*;
|
||||
|
||||
use crate::{events::AudioRecordRequest, prediction::{PossibleResponse}, scene::{ConversationEntry, PlaylistEntry, Scene, StageActions, StageDirection}, tts::start_tts};
|
||||
use crate::{events::AudioRecordRequest, prediction::PossibleResponse, scene::{ConversationEntry, PlaylistEntry, Scene, StageActions, StageDirection}, tts::start_tts};
|
||||
|
||||
mod scene;
|
||||
mod events;
|
||||
@@ -436,6 +436,7 @@ impl App {
|
||||
self.scene.conversation_mut().append(&mut actions.additions.clone());
|
||||
self.prediction_request_sink.send(actions).unwrap();
|
||||
self.is_requesting = true;
|
||||
panic!("at the disco");
|
||||
}
|
||||
|
||||
fn reload_mixxx_playlist(&mut self) {
|
||||
@@ -481,7 +482,16 @@ impl SaveData {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
color_eyre::install().unwrap();
|
||||
let (panic_hook, eyre_hook) = color_eyre::config::HookBuilder::default()
|
||||
.display_env_section(true)
|
||||
.display_location_section(true)
|
||||
.into_hooks();
|
||||
eyre_hook.install().unwrap();
|
||||
|
||||
std::panic::set_hook(Box::new(move |panic_info| {
|
||||
let msg = format!("{}", panic_hook.panic_report(panic_info));
|
||||
println!("Panic: {}", msg);
|
||||
}));
|
||||
|
||||
if option_env!("OPENAI_API_KEY").is_none() {
|
||||
eprintln!("Error: OPENAI_API_KEY environment variable not set. The application will not function without it.");
|
||||
|
||||
Reference in New Issue
Block a user