from django.db import models

class AIProvider(models.Model):
    """
    Stores different AI providers (OpenAI, DeepSeek, Cohere, etc.).
    """
    name = models.CharField(max_length=100, unique=True, help_text="Name of the AI provider (e.g., OpenAI, DeepSeek)")
    description = models.TextField(blank=True, null=True, help_text="Description of the provider and its capabilities.")

    def __str__(self):
        return self.name

from django.db import models
from pxy_neo4j.models import Neo4jProfile  # Import Neo4jProfile

class AIAssistant(models.Model):
    """
    Represents a LangChain-based AI assistant configuration.
    """
    name = models.CharField(max_length=100, unique=True, help_text="Unique name of the assistant.")
    description = models.TextField(blank=True, null=True, help_text="System role or behavior description.")
    model_name = models.CharField(max_length=100, help_text="Name of the AI model (e.g., gpt-4, deepseek-chat, mistral-7b).")
    provider = models.ForeignKey(AIProvider, on_delete=models.CASCADE, help_text="The AI provider for this assistant.")
    api_key = models.CharField(max_length=200, help_text="API key for accessing the AI provider.")
    uses_graph = models.BooleanField(default=False, help_text="Indicates if this assistant should use graph-based responses.")
    neo4j_profile = models.ForeignKey(Neo4jProfile, on_delete=models.SET_NULL, null=True, blank=True, help_text="Associated Neo4j profile for querying data.")

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    def __str__(self):
        return f"{self.name} ({self.model_name})"


