22 lines
919 B
Python

from django.db import models
class OpenAIAssistant(models.Model):
"""
Model to store OpenAI assistant details.
"""
name = models.CharField(max_length=100, unique=True, help_text="Unique name of the assistant")
description = models.TextField(blank=True, null=True, help_text="Description of the assistant's behavior")
api_key = models.CharField(max_length=200, help_text="API key for accessing OpenAI services")
assistant_id = models.CharField(max_length=100, blank=True, null=True, help_text="Optional assistant ID for advanced workflows")
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def is_special_assistant(self):
"""
Determines if the assistant is special (has an assistant_id).
"""
return bool(self.assistant_id)
def __str__(self):
return self.name