Skip to content

Commit

Permalink
remove the first empty line in the chat
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Jan 25, 2024
1 parent 3db7d93 commit cbf6650
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ impl Chat<'_> {

self.answer.formatted_answer =
formatter.format(format!("🤖: {}", &self.answer.plain_answer).as_str());
// self.move_to_bottom();
}

LLMAnswer::EndAnswer => {
Expand Down
16 changes: 11 additions & 5 deletions src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use std::sync::mpsc::Sender;
use std::{collections::HashMap, thread};

use ratatui::text::Line;
use ratatui::text::{Line, Text};

use crate::notification::{Notification, NotificationLevel};
use std::sync::Arc;
Expand Down Expand Up @@ -237,10 +237,16 @@ pub fn handle_key_events(

app.chat.plain_chat.push(format!("👤 : {}\n", user_input));

app.chat.formatted_chat.extend(
app.formatter
.format(format!("👤: {}\n", user_input).as_str()),
);
if app.chat.formatted_chat.width() == 0 {
app.chat.formatted_chat = app
.formatter
.format(format!("👤: {}\n", user_input).as_str());
} else {
app.chat.formatted_chat.extend(
app.formatter
.format(format!("👤: {}\n", user_input).as_str()),
);
}

let conv = HashMap::from([
("role".into(), "user".into()),
Expand Down

0 comments on commit cbf6650

Please sign in to comment.