pub struct MovieChat { /* private fields */ }Expand description
A Chat that answers from the films of a MovieLibrary. It looks only at
the words the films hold, on this machine, with no model.
The messages are the app’s, so that they outlive a closed panel, and on_open
says what opening a moment means there, usually going to the film with a
MovieCue.
use ravenrs_movie::{MovieChat, MovieLibrary};
use ravenrs_reactive::State;
use ravenrs_widgets::ChatMessage;
let messages = State::new(Vec::<ChatMessage>::new());
let chat = MovieChat::new(MovieLibrary::new(), messages.binding(), |moment| {
println!("open {}", moment.title);
});Implementations§
Source§impl MovieChat
impl MovieChat
Sourcepub fn new(
library: MovieLibrary,
messages: Binding<Vec<ChatMessage>>,
on_open: impl Fn(&Moment) + 'static,
) -> Self
pub fn new( library: MovieLibrary, messages: Binding<Vec<ChatMessage>>, on_open: impl Fn(&Moment) + 'static, ) -> Self
A conversation over library, keeping messages.
Sourcepub fn writer(self, writer: Option<MovieWriter>) -> Self
pub fn writer(self, writer: Option<MovieWriter>) -> Self
Something that writes the answer in its own words, such as a local model, instead of a fixed sentence. Finding the moments stays with the search, which answered better than a small model when measured, and a question that finds nothing is not passed on, so it cannot make something up.
Sourcepub fn labels(self, labels: MovieChatLabels) -> Self
pub fn labels(self, labels: MovieChatLabels) -> Self
The words it shows.
Sourcepub fn examples(
self,
examples: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn examples( self, examples: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Things to ask, offered before the first question.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MovieChat
impl !Send for MovieChat
impl !Sync for MovieChat
impl !UnwindSafe for MovieChat
impl Freeze for MovieChat
impl Unpin for MovieChat
impl UnsafeUnpin for MovieChat
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.