pub struct ChatView { /* private fields */ }Implementations§
Source§impl ChatView
impl ChatView
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Set the title displayed in the title bar
Sourcepub fn with_empty_state(self, render: RenderFn) -> Self
pub fn with_empty_state(self, render: RenderFn) -> Self
Set custom empty state renderer (shown when no messages)
Use helper functions from chat_helpers for common patterns:
welcome_art()- ASCII art welcome screencentered_text()- Simple centered message
Or provide a custom closure for full ratatui control.
Sourcepub fn set_title(&mut self, title: impl Into<String>)
pub fn set_title(&mut self, title: impl Into<String>)
Set the title displayed in the title bar (mutable setter)
Sourcepub fn step_spinner(&mut self)
pub fn step_spinner(&mut self)
Advance the spinner animation
Sourcepub fn add_user_message(&mut self, content: String)
pub fn add_user_message(&mut self, content: String)
Add a user message (does not force scroll - caller should handle that)
Sourcepub fn add_assistant_message(&mut self, content: String)
pub fn add_assistant_message(&mut self, content: String)
Add an assistant message (complete)
Sourcepub fn add_system_message(&mut self, content: String)
pub fn add_system_message(&mut self, content: String)
Add a system message (ignores empty messages)
Sourcepub fn add_tool_message(
&mut self,
tool_use_id: &str,
display_name: &str,
display_title: &str,
)
pub fn add_tool_message( &mut self, tool_use_id: &str, display_name: &str, display_title: &str, )
Add a tool execution message
Sourcepub fn update_tool_status(&mut self, tool_use_id: &str, status: ToolStatus)
pub fn update_tool_status(&mut self, tool_use_id: &str, status: ToolStatus)
Update a tool message status by tool_use_id - O(1) lookup
Sourcepub fn enable_auto_scroll(&mut self)
pub fn enable_auto_scroll(&mut self)
Re-enable auto-scroll and scroll to bottom (call when user submits a message)
Sourcepub fn append_streaming(&mut self, text: &str)
pub fn append_streaming(&mut self, text: &str)
Append text to the streaming buffer
Sourcepub fn complete_streaming(&mut self)
pub fn complete_streaming(&mut self)
Complete the streaming response and add as assistant message
Sourcepub fn discard_streaming(&mut self)
pub fn discard_streaming(&mut self)
Discard the streaming buffer without saving (used on cancel)
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Check if currently streaming
pub fn scroll_up(&mut self)
pub fn scroll_down(&mut self)
pub fn render_chat( &mut self, frame: &mut Frame<'_>, area: Rect, pending_status: Option<&str>, )
Trait Implementations§
Source§impl Widget for ChatView
impl Widget for ChatView
Source§fn handle_key(&mut self, _key: KeyEvent, _theme: &Theme) -> WidgetKeyResult
fn handle_key(&mut self, _key: KeyEvent, _theme: &Theme) -> WidgetKeyResult
Source§fn required_height(&self, _available: u16) -> u16
fn required_height(&self, _available: u16) -> u16
Source§fn blocks_input(&self) -> bool
fn blocks_input(&self) -> bool
Source§fn is_overlay(&self) -> bool
fn is_overlay(&self) -> bool
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Auto Trait Implementations§
impl Freeze for ChatView
impl !RefUnwindSafe for ChatView
impl Send for ChatView
impl Sync for ChatView
impl Unpin for ChatView
impl !UnwindSafe for ChatView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more