Spaces:
Running
Running
axeronis commited on
Commit ·
b45f01e
1
Parent(s): 8598a05
Fix: Upgrade to Python 3.11 & syntax fix
Browse filesFiles changed (5)
67 unmodified lines6869707172737467 unmodified linesreturn {"status": "ok"}def extract_evolution_message(data: dict) -> dict | None:"""Extract message from Evolution API webhook payload."""67 unmodified lines68697071727374757667 unmodified linesreturn {"status": "ok"}from typing import Optionaldef extract_evolution_message(data: dict) -> Optional[dict]:"""Extract message from Evolution API webhook payload."""
183 unmodified lines1841851861871881891904 unmodified lines19519619719819920020129 unmodified lines231232233234235236237183 unmodified lines# TASK 1: REMOVE THRESHOLDS - Analyze immediately on EVERY message# 1. Detect psychotype (NO threshold - analyze even "Hi")if len(user_messages) > 0: # At least 1 messagepsychotype_str = await self.gemini.analyze_psychotype(user_messages)lead.psychotype = Psychotype(psychotype_str)# 2. Calculate heat score4 unmodified lines"timeline": lead.timeline}heat_score = await self.gemini.calculate_heat_score(conversation_text=conversation_text,bant_data=bant_data)29 unmodified linesold_summary = lead.ai_summary_json or {}# Generate NEW summarynew_summary = await self.gemini.generate_11_point_summary(conversation_text=conversation_text,lead_name=lead.name or "Customer",psychotype=lead.psychotype.value,183 unmodified lines1841851861871881891904 unmodified lines19519619719819920020129 unmodified lines231232233234235236237183 unmodified lines# TASK 1: REMOVE THRESHOLDS - Analyze immediately on EVERY message# 1. Detect psychotype (NO threshold - analyze even "Hi")if len(user_messages) > 0: # At least 1 messagepsychotype_str = await self.llm.analyze_psychotype(user_messages)lead.psychotype = Psychotype(psychotype_str)# 2. Calculate heat score4 unmodified lines"timeline": lead.timeline}heat_score = await self.llm.calculate_heat_score(conversation_text=conversation_text,bant_data=bant_data)29 unmodified linesold_summary = lead.ai_summary_json or {}# Generate NEW summarynew_summary = await self.llm.generate_11_point_summary(conversation_text=conversation_text,lead_name=lead.name or "Customer",psychotype=lead.psychotype.value,
12345[phases.setup]nixPkgs = ["python39", "postgresql"][phases.install]cmds = ["pip install --no-cache-dir -r requirements.txt"]12345[phases.setup]nixPkgs = ["python311", "postgresql"][phases.install]cmds = ["pip install --no-cache-dir -r requirements.txt"]
16 unmodified lines17181920212223242516 unmodified lines# AI & MLopenai==1.12.0 # For Groq API (OpenAI-compatible)--extra-index-url https://download.pytorch.org/whl/cputorch==2.2.0+cpu # CPU-only version (saves ~2.5GB by avoiding CUDA libraries)sentence-transformers==2.3.1 # Local embeddingsgoogle-generativeai>=0.4.0numpy>=1.24.016 unmodified lines17181920212216 unmodified lines# AI & MLopenai==1.12.0 # For Groq API (OpenAI-compatible)google-generativeai>=0.4.0numpy>=1.24.0
12345[phases.setup]nixPkgs = ["python39", "postgresql", "gcc"][phases.install]cmds = ["python -m venv --copies /opt/venv", ". /opt/venv/bin/activate && pip install --no-cache-dir -r backend/requirements.txt"]12345[phases.setup]nixPkgs = ["python311", "postgresql", "gcc"][phases.install]cmds = ["python -m venv --copies /opt/venv", ". /opt/venv/bin/activate && pip install --no-cache-dir -r backend/requirements.txt"]
backend/app/api/evolution_webhook.py+3-1
backend/app/services/ai_core.py+3-3
backend/nixpacks.toml+1-1
backend/requirements.txt-3
nixpacks.toml+1-1