Skip to main content

parse_at_patterns

Function parse_at_patterns 

Source
pub async fn parse_at_patterns(
    input: &str,
    base_dir: &Path,
) -> Result<MessageContent>
Expand description

Parse the @ pattern in text and replace image file paths/URLs with base64 content

The function looks for patterns like @./path/to/image.png, @image.jpg, or @https://example.com/image.png and replaces them with base64 encoded content that can be processed by LLMs

§Arguments

  • input - The user input text that may contain @ patterns
  • base_dir - The base directory to resolve relative paths from

§Returns

  • MessageContent - Either a single text string or multiple content parts containing both text and base64-encoded images