Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sentinelops-backend/app/services/ai_chat_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
Logic for handling natural language queries about repo health and system state.
"""

import logging
from typing import Any, Dict
from openai import AsyncOpenAI
from app.core.config import settings

logger = logging.getLogger(__name__)

client = (
AsyncOpenAI(api_key=settings.OPENAI_API_KEY) if settings.OPENAI_API_KEY else None
)
Expand Down Expand Up @@ -50,5 +53,6 @@ async def handle_devops_query(query: str, context_data: Dict[str, Any]) -> str:
temperature=0.4,
)
return response.choices[0].message.content
except Exception as e:
return f"Error processing query: {str(e)}"
except Exception:
logger.exception("Failed to process DevOps AI query")
return "Sorry, I couldn't process your request right now. Please try again shortly."
Loading