Add Telegram bot support #23

Merged
Berack96 merged 23 commits from 6-telegram-interface into main 2025-10-13 10:49:46 +02:00
Showing only changes of commit 78208f19b5 - Show all commits

View File

@@ -1,9 +1,7 @@
import logging
from agno.run.agent import RunOutput
from app.agents.models import AppModels
from app.agents.team import create_team_with
from app.agents.predictor import PREDICTOR_INSTRUCTIONS, PredictorInput, PredictorOutput, PredictorStyle
from app.base.markets import ProductInfo
from app.agents.predictor import PREDICTOR_INSTRUCTIONS, PredictorOutput, PredictorStyle
logging = logging.getLogger(__name__)
@@ -79,40 +77,3 @@ class Pipeline:
raise ValueError("Team output is not a string")
logging.info(f"Team finished")
return team_outputs.content
# # Step 2: aggregazione output strutturati
# all_products: list[ProductInfo] = []
# sentiments: list[str] = []
# for agent_output in team_outputs.member_responses:
# if isinstance(agent_output, RunOutput) and agent_output.metadata is not None:
# keys = agent_output.metadata.keys()
# if "products" in keys:
# all_products.extend(agent_output.metadata["products"])
# if "sentiment_news" in keys:
# sentiments.append(agent_output.metadata["sentiment_news"])
# if "sentiment_social" in keys:
# sentiments.append(agent_output.metadata["sentiment_social"])
# aggregated_sentiment = "\n".join(sentiments)
# # Step 3: invocazione Predictor
# predictor_input = PredictorInput(
# data=all_products,
# style=self.style,
# sentiment=aggregated_sentiment
# )
# result = self.predictor.run(predictor_input) # type: ignore
# if not isinstance(result.content, PredictorOutput):
# return "❌ Errore: il modello non ha restituito un output valido."
# prediction: PredictorOutput = result.content
# Step 4: restituzione strategia finale
# portfolio_lines = "\n".join(
# [f"{item.asset} ({item.percentage}%): {item.motivation}" for item in prediction.portfolio]
# )
# return (
# f"📊 Strategia ({self.style.value}): {prediction.strategy}\n\n"
# f"💼 Portafoglio consigliato:\n{portfolio_lines}"
# )