Spaces:
Running
Running
| import logging | |
| from backend.services.nvidia_vault import nvidia_key_manager | |
| async def generate_intelligent_follow_up(persona: str, daily_summary: dict) -> str: | |
| """ | |
| 1. Retrieve latest uploaded audio. | |
| 2. Retrieve latest cloud transcript. | |
| 3. Analyze transcript. | |
| 4. Analyze emotional tone. | |
| 5. Analyze activity patterns. | |
| 6. Analyze productivity patterns. | |
| 7. Analyze conversation history. | |
| 8. Analyze Master Vault context. | |
| 9. Analyze Assistant Identity. | |
| """ | |
| logging.info("Gathering metrics for Intelligent Day Review Greeting...") | |
| # In a full implementation, these would query the actual databases | |
| # For now, we extract the metadata from the daily_summary passed in | |
| activity = daily_summary.get("total_events", 0) | |
| # Classify activity level (used in fallback response selection below) | |
| if activity > 50: | |
| activity_pattern = "highly active" | |
| elif activity > 10: | |
| activity_pattern = "moderately active" | |
| else: | |
| activity_pattern = "quiet day" | |
| # Use NVIDIA Router logic to execute this specific agentic task | |
| active_key = nvidia_key_manager.get_healthy_key() | |
| if active_key: | |
| logging.info("Using NVIDIA key for Intelligent Greeting generation.") | |
| # Prompt for full production call (NvidiaModel.GLM_5_1): | |
| # prompt = ( | |
| # f"You are {persona.upper()}, acting with a {tone} tone. " | |
| # f"Activity: {activity_pattern} ({activity} events)\n" | |
| # f"Productivity: {productivity}\nConversations: {conversations}\nVault Context: {vault_context}\n" | |
| # "Generate a brief, natural follow-up response." | |
| # ) | |
| # return call_nvidia_api(NvidiaModel.GLM_5_1, prompt, active_key) | |
| # Fallback simulation | |
| if activity_pattern == "quiet day": | |
| return "Looking at today's conversations, it seems today was a quieter day focused mostly on development work and system planning. How did your day go?" | |
| else: | |
| return "Today seemed more active than usual with several problem-solving sessions and project discussions. What was the highlight of your day?" | |