refactor: remove tool_type field and update imports in tool model

This commit is contained in:
CaptainB 2025-04-18 17:05:47 +08:00 committed by 刘瑞斌
parent 1ebcc664bb
commit 9b0f9b04b7
2 changed files with 1 additions and 11 deletions

View File

@ -62,9 +62,6 @@ class Migration(migrations.Migration):
('scope',
models.CharField(choices=[('SHARED', '共享'), ('WORKSPACE', '工作空间可用')], default='WORKSPACE',
max_length=20, verbose_name='可用范围')),
('tool_type',
models.CharField(choices=[('INTERNAL', '内置'), ('PUBLIC', '公开')], default='PUBLIC', max_length=20,
verbose_name='函数类型')),
('template_id', models.UUIDField(default=None, null=True, verbose_name='模版id')),
('workspace_id', models.CharField(default='default', max_length=64, verbose_name='工作空间id', db_index=True)),
('init_params', models.CharField(max_length=102400, null=True, verbose_name='初始化参数')),

View File

@ -1,8 +1,8 @@
import uuid_utils.compat as uuid
from django.db import models
from .tool_module import ToolModule
from users.models import User
from .tool_module import ToolModule
class ToolScope(models.TextChoices):
@ -10,11 +10,6 @@ class ToolScope(models.TextChoices):
WORKSPACE = "WORKSPACE", "工作空间可用"
class ToolType(models.TextChoices):
INTERNAL = "INTERNAL", '内置'
PUBLIC = "PUBLIC", "公开"
class Tool(models.Model):
id = models.UUIDField(primary_key=True, max_length=128, default=uuid.uuid7, editable=False, verbose_name="主键id")
user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="用户id")
@ -27,8 +22,6 @@ class Tool(models.Model):
is_active = models.BooleanField(default=True)
scope = models.CharField(max_length=20, verbose_name='可用范围', choices=ToolScope.choices,
default=ToolScope.WORKSPACE)
tool_type = models.CharField(max_length=20, verbose_name='函数类型', choices=ToolType.choices,
default=ToolType.PUBLIC)
template_id = models.UUIDField(max_length=128, verbose_name="模版id", null=True, default=None)
module = models.ForeignKey(ToolModule, on_delete=models.CASCADE, verbose_name="模块id", default='root')
workspace_id = models.CharField(max_length=64, verbose_name="工作空间id", default="default", db_index=True)