Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -104,7 +104,6 @@ class XylariaChat: | |
| 104 | 
             
                    # Prepare messages with conversation context and persistent memory
         | 
| 105 | 
             
                    messages = [
         | 
| 106 | 
             
                        {"role": "system", "content": self.system_prompt},
         | 
| 107 | 
            -
                        *self.conversation_history,
         | 
| 108 | 
             
                    ]
         | 
| 109 |  | 
| 110 | 
             
                    # Add persistent memory context if available
         | 
| @@ -112,7 +111,10 @@ class XylariaChat: | |
| 112 | 
             
                        memory_context = "Remembered Information:\n" + "\n".join(
         | 
| 113 | 
             
                            [f"{k}: {v}" for k, v in self.persistent_memory.items()]
         | 
| 114 | 
             
                        )
         | 
| 115 | 
            -
                        messages. | 
|  | |
|  | |
|  | |
| 116 |  | 
| 117 | 
             
                    # Process image if uploaded
         | 
| 118 | 
             
                    if image:
         | 
| @@ -197,7 +199,8 @@ class XylariaChat: | |
| 197 | 
             
                            chatbot = gr.Chatbot(
         | 
| 198 | 
             
                                label="Xylaria 1.4 Senoa",
         | 
| 199 | 
             
                                height=500,
         | 
| 200 | 
            -
                                show_copy_button=True
         | 
|  | |
| 201 | 
             
                            )
         | 
| 202 |  | 
| 203 | 
             
                            # Input row with improved layout and image upload
         | 
| @@ -209,7 +212,7 @@ class XylariaChat: | |
| 209 | 
             
                                        container=False
         | 
| 210 | 
             
                                    )
         | 
| 211 | 
             
                                    img = gr.Image(
         | 
| 212 | 
            -
                                        sources=["upload", " | 
| 213 | 
             
                                        type="filepath", 
         | 
| 214 | 
             
                                        label="Upload or Capture Image"
         | 
| 215 | 
             
                                    )
         | 
|  | |
| 104 | 
             
                    # Prepare messages with conversation context and persistent memory
         | 
| 105 | 
             
                    messages = [
         | 
| 106 | 
             
                        {"role": "system", "content": self.system_prompt},
         | 
|  | |
| 107 | 
             
                    ]
         | 
| 108 |  | 
| 109 | 
             
                    # Add persistent memory context if available
         | 
|  | |
| 111 | 
             
                        memory_context = "Remembered Information:\n" + "\n".join(
         | 
| 112 | 
             
                            [f"{k}: {v}" for k, v in self.persistent_memory.items()]
         | 
| 113 | 
             
                        )
         | 
| 114 | 
            +
                        messages.append({"role": "system", "content": memory_context})
         | 
| 115 | 
            +
                    
         | 
| 116 | 
            +
                    # Add conversation history
         | 
| 117 | 
            +
                    messages.extend(self.conversation_history)
         | 
| 118 |  | 
| 119 | 
             
                    # Process image if uploaded
         | 
| 120 | 
             
                    if image:
         | 
|  | |
| 199 | 
             
                            chatbot = gr.Chatbot(
         | 
| 200 | 
             
                                label="Xylaria 1.4 Senoa",
         | 
| 201 | 
             
                                height=500,
         | 
| 202 | 
            +
                                show_copy_button=True,
         | 
| 203 | 
            +
                                type="messages"  # Updated to use messages type
         | 
| 204 | 
             
                            )
         | 
| 205 |  | 
| 206 | 
             
                            # Input row with improved layout and image upload
         | 
|  | |
| 212 | 
             
                                        container=False
         | 
| 213 | 
             
                                    )
         | 
| 214 | 
             
                                    img = gr.Image(
         | 
| 215 | 
            +
                                        sources=["upload", "webcam"], 
         | 
| 216 | 
             
                                        type="filepath", 
         | 
| 217 | 
             
                                        label="Upload or Capture Image"
         | 
| 218 | 
             
                                    )
         | 

