feat: associate generation calls with devices

This commit is contained in:
QiuSW
2026-07-21 09:40:40 +08:00
parent 69f4517958
commit 11c0d63ac8
16 changed files with 398 additions and 19 deletions
+9
View File
@@ -35,6 +35,14 @@ class CallRecord(models.Model):
on_delete=models.SET_NULL,
related_name="call_records",
)
client_device = models.ForeignKey(
"licensing.ClientDevice",
verbose_name="客户端设备",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="call_records",
)
operation_type = models.CharField("操作类型", max_length=32, choices=OperationType.choices)
alias = models.CharField("能力别名", max_length=64, blank=True)
model_used = models.CharField("实际模型", max_length=128, blank=True)
@@ -68,6 +76,7 @@ class CallRecord(models.Model):
indexes = [
models.Index(fields=("user", "created_at")),
models.Index(fields=("api_key", "created_at")),
models.Index(fields=("client_device", "created_at")),
models.Index(fields=("operation_type", "status")),
models.Index(fields=("alias",)),
]