chore(file_manager): Reformat

Signed-off-by: -LAN- <laipz8200@outlook.com>
pull/22704/head
-LAN- 10 months ago
parent f7a0e71abd
commit ed1ea5129b
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF

@ -47,21 +47,21 @@ def to_prompt_message_content(
) -> PromptMessageContentUnionTypes: ) -> PromptMessageContentUnionTypes:
""" """
Convert a file to prompt message content. Convert a file to prompt message content.
This function converts files to their appropriate prompt message content types. This function converts files to their appropriate prompt message content types.
For supported file types (IMAGE, AUDIO, VIDEO, DOCUMENT), it creates the For supported file types (IMAGE, AUDIO, VIDEO, DOCUMENT), it creates the
corresponding message content with proper encoding/URL. corresponding message content with proper encoding/URL.
For unsupported file types, instead of raising an error, it returns a For unsupported file types, instead of raising an error, it returns a
TextPromptMessageContent with a descriptive message about the file. TextPromptMessageContent with a descriptive message about the file.
Args: Args:
f: The file to convert f: The file to convert
image_detail_config: Optional detail configuration for image files image_detail_config: Optional detail configuration for image files
Returns: Returns:
PromptMessageContentUnionTypes: The appropriate message content type PromptMessageContentUnionTypes: The appropriate message content type
Raises: Raises:
ValueError: If file extension or mime_type is missing ValueError: If file extension or mime_type is missing
""" """
@ -80,9 +80,7 @@ def to_prompt_message_content(
# Check if file type is supported # Check if file type is supported
if f.type not in prompt_class_map: if f.type not in prompt_class_map:
# For unsupported file types, return a text description # For unsupported file types, return a text description
return TextPromptMessageContent( return TextPromptMessageContent(data=f"[Unsupported file type: {f.filename} ({f.type.value})]")
data=f"[Unsupported file type: {f.filename} ({f.type.value})]"
)
# Process supported file types # Process supported file types
params = { params = {

Loading…
Cancel
Save