(root, stream: StreamingAgentChatResponse)
| 106 | |
| 107 | # Handle streaming responses |
| 108 | def handle_stream(root, stream: StreamingAgentChatResponse): |
| 109 | text = "" |
| 110 | root.markdown("Thinking...") |
| 111 | for token in stream.response_gen: |
| 112 | text += token |
| 113 | root.markdown(text) |
| 114 | return text |
| 115 | |
| 116 | # Define constants and settings |
| 117 | CACHE_DIR = "./uploads" |