mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
* feat: init knowledge workflow * feat: add knowledge workflow and version models, serializers, and API views * feat: knowledge workflow * feat: knowledge workflow * feat: add KnowledgeWorkflowModelSerializer and Operate class for workflow management * fix: route * feat: knowledge workflow * feat: Knowledge workflow permission * feat: knowledge workflow * feat: knowledge workflow * feat: knowledge workflow * feat: knowledge workflow * feat: Data source web node * fix: Back route * feat: knowledge workflow * feat: knowledge workflow * feat: Knowledge write node * feat: add Data Source tool functionality and localization * feat: add Data Source tool functionality and localization * feat: knowledge workflow * feat: knowledge workflow * fix: simplify export tool permission check in ToolListContainer.vue * fix: simplify export condition in ToolResourceIndex.vue * fix: simplify condition for copying tool in ToolListContainer * feat: knowledge workflow * fix: Upload local files and add output fields * feat: Knowledge write * feat: add Document Split Node functionality and localization * feat: add Document Split Node functionality and localization * feat: Knowledge write * feat: enhance Document Split Node with result processing and problem list generation * fix: Allow problem be blank * feat: enhance Document Split Node with result processing and problem list generation * feat: tool datasource * fix: Optimization of knowledge base workflow execution logic * refactor: streamline image handling by updating application and knowledge ID management * refactor: streamline image handling by updating application and knowledge ID management * feat: extend support modes in variable aggregation node to include knowledge workflows * feat: Chunks stored * refactor: simplify file handling in document extraction by removing unnecessary byte conversion and enhancing file saving logic * refactor: update file ID assignment in document extraction to use provided metadata * feat: Workflow menu that distinguishes between applications and knowledge bases * refactor: update file ID assignment in document extraction to use provided metadata * fix: Add workspace ID as workflow execution parameter * feat: add code template for Data Source tool form functionality * refactor: remove unused sys import and improve module handling * feat: Execution details support loading status * refactor: update tool type handling and improve category merging logic * feat: Alter fork depth * fix: ensure filterList is properly initialized and updated in getList function * refactor: simplify ToolStoreDialog by removing unused toolType logic * perf: Optimize the style * style: adjust div width for improved layout in Tree component * refactor: improve polling mechanism for knowledge workflow action * fix: Get workspace_id from workflow params * fix: filter out 'file_bytes' from result in get_details method * feat: add recursive filtering for file_bytes in context data * fix: append results to paragraph_list instead of replacing it * perf: Optimize translation files * fix: include document name in bytes_to_uploaded_file call for better file handling * refactor: optimize buffer retrieval in document processing * refactor: remove redundant parameter from bytes_to_uploaded_file call * fix: Page style optimization * feat: add slider for setting limit in document rules form * feat: add workflow knowledge management endpoints and related functionality * fix: swap file size and file count limits in form inputs * refactor: update tool_config args to use list format for improved readability * feat: Node supports knowledge base workflow * feat: Node supports knowledge base workflow * fix: Basic node data cannot be obtained in the workflow * style: Knowledge base workflow debugging page style adjustment * fix: Loop nodes cannot be used in the knowledge base workflow * fix: Knowledge base workflow variable assignment node * feat: add chunk size slider to form for custom split strategy * fix: Workflow style optimization --------- Co-authored-by: CaptainB <bin@fit2cloud.com> Co-authored-by: zhangzhanwei <zhanwei.zhang@fit2cloud.com> Co-authored-by: wangdan-fit2cloud <dan.wang@fit2cloud.com>
61 lines
3.1 KiB
Python
61 lines
3.1 KiB
Python
import uuid_utils.compat as uuid
|
|
from django.db import models
|
|
from mptt.fields import TreeForeignKey
|
|
from mptt.models import MPTTModel
|
|
|
|
from common.mixins.app_model_mixin import AppModelMixin
|
|
from users.models import User
|
|
|
|
|
|
class ToolFolder(MPTTModel, AppModelMixin):
|
|
id = models.CharField(primary_key=True, max_length=64, editable=False, verbose_name="主键id")
|
|
name = models.CharField(max_length=64, verbose_name="文件夹名称", db_index=True)
|
|
desc = models.CharField(max_length=200, null=True, blank=True, verbose_name="描述")
|
|
user = models.ForeignKey(User, on_delete=models.SET_NULL, db_constraint=False, blank=True, null=True)
|
|
workspace_id = models.CharField(max_length=64, verbose_name="工作空间id", default="default", db_index=True)
|
|
parent = TreeForeignKey('self', on_delete=models.DO_NOTHING, null=True, blank=True, related_name='children')
|
|
|
|
class Meta:
|
|
db_table = "tool_folder"
|
|
|
|
class MPTTMeta:
|
|
order_insertion_by = ['name']
|
|
|
|
|
|
class ToolScope(models.TextChoices):
|
|
SHARED = "SHARED", '共享'
|
|
WORKSPACE = "WORKSPACE", "工作空间可用"
|
|
INTERNAL = "INTERNAL", '内置'
|
|
|
|
|
|
class ToolType(models.TextChoices):
|
|
INTERNAL = "INTERNAL", '内置'
|
|
CUSTOM = "CUSTOM", "自定义"
|
|
MCP = "MCP", "MCP工具"
|
|
DATA_SOURCE = "DATA_SOURCE", "数据源"
|
|
|
|
|
|
class Tool(AppModelMixin):
|
|
id = models.UUIDField(primary_key=True, max_length=128, default=uuid.uuid7, editable=False, verbose_name="主键id")
|
|
user = models.ForeignKey(User, on_delete=models.SET_NULL, db_constraint=False, blank=True, null=True)
|
|
name = models.CharField(max_length=64, verbose_name="工具名称", db_index=True)
|
|
desc = models.CharField(max_length=128, verbose_name="描述")
|
|
code = models.CharField(max_length=102400, verbose_name="python代码")
|
|
input_field_list = models.JSONField(verbose_name="输入字段列表", default=list)
|
|
init_field_list = models.JSONField(verbose_name="启动字段列表", default=list)
|
|
icon = models.CharField(max_length=256, verbose_name="工具库icon", default="")
|
|
is_active = models.BooleanField(default=True, db_index=True)
|
|
scope = models.CharField(max_length=20, verbose_name='可用范围', choices=ToolScope.choices,
|
|
default=ToolScope.WORKSPACE, db_index=True)
|
|
tool_type = models.CharField(max_length=20, verbose_name='工具类型', choices=ToolType.choices,
|
|
default=ToolType.CUSTOM, db_index=True)
|
|
template_id = models.CharField(max_length=128, verbose_name="模版id", null=True, default=None, db_index=True)
|
|
folder = models.ForeignKey(ToolFolder, on_delete=models.DO_NOTHING, verbose_name="文件夹id", default='default')
|
|
workspace_id = models.CharField(max_length=64, verbose_name="工作空间id", default="default", db_index=True)
|
|
init_params = models.CharField(max_length=102400, verbose_name="初始化参数", null=True)
|
|
label = models.CharField(max_length=128, verbose_name="标签", null=True, db_index=True)
|
|
version = models.CharField(max_length=64, verbose_name="版本号", null=True, default=None)
|
|
|
|
class Meta:
|
|
db_table = "tool"
|