pub struct ChatApp { /* private fields */ }Expand description
Elegant Chat application state
Implementations§
Source§impl ChatApp
impl ChatApp
Sourcepub fn new(provider: GenAIProvider, model: String) -> Self
pub fn new(provider: GenAIProvider, model: String) -> Self
Create a new chat application
Sourcepub async fn run(&mut self, terminal: &mut DefaultTerminal) -> Result<()>
pub async fn run(&mut self, terminal: &mut DefaultTerminal) -> Result<()>
Run the chat application main loop
Sourcepub fn handle_app_event(&mut self, event: AppEvent) -> bool
pub fn handle_app_event(&mut self, event: AppEvent) -> bool
Handle an AppEvent from the async event loop
Returns true to continue running, false to quit.
Sourcepub fn is_send_pending(&self) -> bool
pub fn is_send_pending(&self) -> bool
Check if a message send is pending (set by Enter key in handle_terminal_event)
Sourcepub fn clear_pending_send(&mut self)
pub fn clear_pending_send(&mut self)
Clear the pending send flag
Sourcepub fn process_stream_chunks(&mut self)
pub fn process_stream_chunks(&mut self)
Check and process pending stream chunks
Sourcepub fn needs_render(&self) -> bool
pub fn needs_render(&self) -> bool
Check if a render is needed
Auto Trait Implementations§
impl Freeze for ChatApp
impl !RefUnwindSafe for ChatApp
impl Send for ChatApp
impl Sync for ChatApp
impl Unpin for ChatApp
impl UnsafeUnpin for ChatApp
impl !UnwindSafe for ChatApp
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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