From ea5fe19ad751fd6fa686e502a5cf7f26a78668e9 Mon Sep 17 00:00:00 2001 From: Oxbian Date: Sun, 18 May 2025 12:19:33 -0400 Subject: feat: refactor chat, resume into modules + color in UI --- src/ui/init.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/ui/init.rs') diff --git a/src/ui/init.rs b/src/ui/init.rs index afd686a..b789f38 100644 --- a/src/ui/init.rs +++ b/src/ui/init.rs @@ -1,4 +1,5 @@ use crate::app::init::App; +use crate::app::llm::MessageType; use crate::ui::inputfield::{BoxData, InputField, InputMode}; use color_eyre::Result; use ratatui::{ @@ -179,7 +180,19 @@ impl Ui { let size = msg.chars().take(available_width_message as usize).count(); let text = Text::from(msg); - for line in text { + for mut line in text { + match m.role { + MessageType::USER => { + line.style = Style::default().fg(Color::Yellow); + } + MessageType::ASSISTANT => { + line.style = Style::default().fg(Color::Cyan); + } + MessageType::SYSTEM => { + line.style = Style::default().fg(Color::Red); + } + } + messages.push_line(line.clone()); let line_count = (line.to_string().chars().count() as f64 / size as f64).ceil() as usize; -- cgit v1.2.3