ratatui_toolkit/widgets/ai_chat/constructors/
mod.rs1use crate::widgets::ai_chat::state::{InputState, MessageStore};
2use ratatui::style::{Color, Modifier, Style};
3
4use crate::widgets::ai_chat::AIChat;
5
6impl<'a> AIChat<'a> {
7 pub fn new_ai_chat(messages: &'a mut MessageStore, input: &'a mut InputState) -> Self {
9 Self {
10 messages,
11 input,
12 attached_files: Vec::new(),
13 is_loading: false,
14 user_message_style: Style::default()
15 .fg(Color::LightCyan)
16 .add_modifier(Modifier::BOLD),
17 ai_message_style: Style::default().fg(Color::White),
18 input_style: Style::default().fg(Color::White),
19 input_prompt: "You: ".to_string(),
20 commands: vec!["/clear".to_string()],
21 selected_command_index: 0,
22 }
23 }
24
25 pub fn with_selected_command_index(mut self, index: usize) -> Self {
27 self.selected_command_index = index;
28 self
29 }
30}