@@ -65,15 +65,15 @@ def get_agent():
6565
6666
6767def chat_with_agent (
68- message : str , user_id : str = "default" , selected_images : Optional [List [str ]] = None
68+ message : str , user_id : str = "default" , selected_images : Optional [List [dict ]] = None
6969) -> str :
7070 """
7171 Send a message to the agent and get a response.
7272
7373 Args:
7474 message: The user's message
7575 user_id: Unique identifier for the user/thread
76- selected_images: List of selected image names (optional)
76+ selected_images: List of selected image objects (optional)
7777
7878 Returns:
7979 The agent's response as a string
@@ -83,7 +83,16 @@ def chat_with_agent(
8383 # Prepare the message with context
8484 full_message = message
8585 if selected_images and len (selected_images ) > 0 :
86- image_context = f" Selected images: { ', ' .join (selected_images )} ."
86+ image_context = "\n \n Selected Images:\n "
87+ for i , img in enumerate (selected_images , 1 ):
88+ image_context += (
89+ f"{ i } . { img .get ('title' , 'Untitled' )} (ID: { img .get ('id' , 'unknown' )} )\n "
90+ )
91+ image_context += f" Type: { img .get ('type' , 'unknown' )} \n "
92+ image_context += f" Description: { img .get ('description' , 'No description' )} \n "
93+ if img .get ("url" ):
94+ image_context += f" URL: { img .get ('url' )} \n "
95+ image_context += "\n "
8796 full_message = message + image_context
8897
8998 # Configure thread ID for conversation continuity
0 commit comments