Refactor market system and improve app configuration

- Refactor market system from singleton function to class-based architecture with MarketAPIs
- Add automatic API key detection for Coinbase and CryptoCompare wrappers
- Improve error handling and logging with agno.utils.log throughout the application
- Split Models class into separate methods for online and local model availability
- Add proper JSON response extraction with thinking pattern support
- Enhance ToolAgent with better state management for provider and style selection
- Update Gradio app with proper server configuration and logging
This commit is contained in:
2025-09-27 17:49:32 +02:00
parent a51ec67ac1
commit 03d8523a5a
8 changed files with 143 additions and 73 deletions

View File

@@ -2,6 +2,7 @@ import gradio as gr
from dotenv import load_dotenv
from app.tool import ToolAgent
from agno.utils.log import log_info
########################################
# MAIN APP & GRADIO INTERFACE
@@ -33,10 +34,14 @@ if __name__ == "__main__":
type="index",
label="Stile di investimento"
)
style.change(fn=tool_agent.choose_style, inputs=style, outputs=None)
user_input = gr.Textbox(label="Richiesta utente")
output = gr.Textbox(label="Risultato analisi", lines=12)
analyze_btn = gr.Button("🔎 Analizza")
analyze_btn.click(fn=tool_agent.interact, inputs=[user_input, style], outputs=output)
demo.launch(server_name="0.0.0.0", server_port=8000)
analyze_btn.click(fn=tool_agent.interact, inputs=[user_input], outputs=output)
server, port = ("0.0.0.0", 8000)
log_info(f"Starting UPO AppAI on http://{server}:{port}")
demo.launch(server_name=server, server_port=port, quiet=True)