pub struct PromptContext {
pub text: String,
pub images: Vec<PathBuf>,
pub ready: bool,
pub created_at: SystemTime,
}Expand description
Prompt context containing text and images
Manages the context for a prompt including:
- Text input
- Associated images
- Metadata about the context
§Requirements
- Req 1.4: Add images to prompt context
- Req 5.1: Display images in chat interface
- Req 5.1: Include images in message history
Fields§
§text: StringText content of the prompt
images: Vec<PathBuf>Images associated with the prompt
ready: boolWhether the context is complete and ready to send
created_at: SystemTimeTimestamp when context was created
Implementations§
Source§impl PromptContext
impl PromptContext
Sourcepub fn with_text_and_images(
text: impl Into<String>,
images: Vec<PathBuf>,
) -> Self
pub fn with_text_and_images( text: impl Into<String>, images: Vec<PathBuf>, ) -> Self
Create a new prompt context with text and images
Sourcepub fn add_images(&mut self, paths: Vec<PathBuf>)
pub fn add_images(&mut self, paths: Vec<PathBuf>)
Sourcepub fn remove_image(&mut self, path: &PathBuf) -> bool
pub fn remove_image(&mut self, path: &PathBuf) -> bool
Sourcepub fn clear_images(&mut self)
pub fn clear_images(&mut self)
Clear all images from the context
Sourcepub fn get_images(&self) -> &[PathBuf]
pub fn get_images(&self) -> &[PathBuf]
Get the images in the context
Sourcepub fn image_count(&self) -> usize
pub fn image_count(&self) -> usize
Get the number of images in the context
Sourcepub fn has_images(&self) -> bool
pub fn has_images(&self) -> bool
Check if the context has any images
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if the context is complete (has text or images)
Sourcepub fn mark_ready(&mut self)
pub fn mark_ready(&mut self)
Mark the context as ready to send
Sourcepub fn mark_not_ready(&mut self)
pub fn mark_not_ready(&mut self)
Mark the context as not ready
Trait Implementations§
Source§impl Clone for PromptContext
impl Clone for PromptContext
Source§fn clone(&self) -> PromptContext
fn clone(&self) -> PromptContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromptContext
impl Debug for PromptContext
Auto Trait Implementations§
impl Freeze for PromptContext
impl RefUnwindSafe for PromptContext
impl Send for PromptContext
impl Sync for PromptContext
impl Unpin for PromptContext
impl UnwindSafe for PromptContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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