aboutsummaryrefslogtreecommitdiff
path: root/src/ui/init.rs
diff options
context:
space:
mode:
authorOxbian <oxbian@mailbox.org>2025-05-18 12:19:33 -0400
committerOxbian <oxbian@mailbox.org>2025-05-18 12:19:33 -0400
commitea5fe19ad751fd6fa686e502a5cf7f26a78668e9 (patch)
treecd005f10acc256613ef5a9b88cf36733659ea57f /src/ui/init.rs
parentfecb211130ec487c7c617d28419c6d0097f19783 (diff)
downloadNAI-main.tar.gz
NAI-main.zip
feat: refactor chat, resume into modules + color in UImain
Diffstat (limited to 'src/ui/init.rs')
-rw-r--r--src/ui/init.rs15
1 files changed, 14 insertions, 1 deletions
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;
ArKa projects. All rights to me, and your next child right arm.