30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""
|
|
智能体模块模型
|
|
"""
|
|
from django.db import models
|
|
from apps.users.models import User
|
|
|
|
|
|
class Spirit(models.Model):
|
|
"""智能体/心灵模型"""
|
|
|
|
id = models.BigAutoField(primary_key=True)
|
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='spirits', verbose_name='所属用户')
|
|
name = models.CharField('名称', max_length=100)
|
|
avatar = models.URLField('头像', max_length=500, blank=True, default='')
|
|
prompt = models.TextField('提示词', blank=True, default='')
|
|
memory = models.TextField('记忆', blank=True, default='')
|
|
voice_id = models.CharField('音色ID', max_length=100, blank=True, default='')
|
|
is_active = models.BooleanField('是否启用', default=True)
|
|
created_at = models.DateTimeField('创建时间', auto_now_add=True)
|
|
updated_at = models.DateTimeField('更新时间', auto_now=True)
|
|
|
|
class Meta:
|
|
db_table = 'spirit'
|
|
verbose_name = '智能体'
|
|
verbose_name_plural = '智能体'
|
|
ordering = ['-created_at']
|
|
|
|
def __str__(self):
|
|
return f"{self.name} - {self.user.phone}"
|