From e0efcfc7db10a66af725b45c220ed410b3455bf8 Mon Sep 17 00:00:00 2001 From: ymq Date: Tue, 8 Sep 2026 15:24:31 +0800 Subject: [PATCH] feat(models): add 5 runtime table JSONs + pipeline_tasks retry_count/last_error --- models/pipeline_git_locks.json | 43 +++++++ models/pipeline_llm_tokens.json | 160 ++++++++++++++++++++++++++ models/pipeline_session_settings.json | 80 +++++++++++++ models/pipeline_tasks.json | 2 + models/sd_deploy_accounts.json | 90 +++++++++++++++ models/sd_work_envs.json | 95 +++++++++++++++ 6 files changed, 470 insertions(+) create mode 100644 models/pipeline_git_locks.json create mode 100644 models/pipeline_llm_tokens.json create mode 100644 models/pipeline_session_settings.json create mode 100644 models/sd_deploy_accounts.json create mode 100644 models/sd_work_envs.json diff --git a/models/pipeline_git_locks.json b/models/pipeline_git_locks.json new file mode 100644 index 0000000..0b757b5 --- /dev/null +++ b/models/pipeline_git_locks.json @@ -0,0 +1,43 @@ +{ + "summary": [ + { + "name": "pipeline_git_locks", + "title": "git串行锁", + "primary": [ + "lock_key" + ], + "catelog": "entity" + } + ], + "fields": [ + { + "name": "lock_key", + "title": "锁键(仓库路径sha256)", + "type": "str", + "length": 64, + "nullable": "no" + }, + { + "name": "token", + "title": "持有者令牌", + "type": "str", + "length": 64, + "nullable": "no" + }, + { + "name": "expires_at", + "title": "过期时间", + "type": "datetime", + "nullable": "no" + } + ], + "indexes": [ + { + "name": "idx_expires", + "idxtype": "index", + "idxfields": [ + "expires_at" + ] + } + ] +} diff --git a/models/pipeline_llm_tokens.json b/models/pipeline_llm_tokens.json new file mode 100644 index 0000000..d72af30 --- /dev/null +++ b/models/pipeline_llm_tokens.json @@ -0,0 +1,160 @@ +{ + "summary": [ + { + "name": "pipeline_llm_tokens", + "title": "LLM短期令牌", + "primary": [ + "id" + ], + "catelog": "entity" + } + ], + "fields": [ + { + "name": "id", + "title": "主键ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "token", + "title": "令牌", + "type": "str", + "length": 80, + "nullable": "no" + }, + { + "name": "org_id", + "title": "机构ID", + "type": "str", + "length": 32, + "nullable": "no", + "default": "0" + }, + { + "name": "project_id", + "title": "项目ID", + "type": "str", + "length": 32, + "nullable": "no", + "default": "" + }, + { + "name": "task_id", + "title": "任务ID", + "type": "str", + "length": 32, + "nullable": "no", + "default": "" + }, + { + "name": "model_name", + "title": "模型名", + "type": "str", + "length": 100, + "nullable": "no", + "default": "" + }, + { + "name": "purpose", + "title": "用途", + "type": "str", + "length": 100, + "nullable": "no", + "default": "" + }, + { + "name": "status", + "title": "状态", + "type": "str", + "length": 20, + "nullable": "no", + "default": "active" + }, + { + "name": "expires_at", + "title": "过期时间", + "type": "datetime", + "nullable": "no" + }, + { + "name": "max_calls", + "title": "最大调用次数", + "type": "int", + "nullable": "no", + "default": "500" + }, + { + "name": "call_count", + "title": "已调用次数", + "type": "int", + "nullable": "no", + "default": "0" + }, + { + "name": "prompt_tokens", + "title": "输入tokens累计", + "type": "bigint", + "nullable": "no", + "default": "0" + }, + { + "name": "completion_tokens", + "title": "输出tokens累计", + "type": "bigint", + "nullable": "no", + "default": "0" + }, + { + "name": "created_by", + "title": "创建人", + "type": "str", + "length": 64, + "nullable": "no", + "default": "" + }, + { + "name": "created_at", + "title": "创建时间", + "type": "timestamp", + "nullable": "no" + }, + { + "name": "last_used_at", + "title": "最后使用时间", + "type": "datetime" + } + ], + "indexes": [ + { + "name": "uk_token", + "idxtype": "unique", + "idxfields": [ + "token" + ] + }, + { + "name": "idx_org", + "idxtype": "index", + "idxfields": [ + "org_id" + ] + }, + { + "name": "idx_project", + "idxtype": "index", + "idxfields": [ + "project_id" + ] + }, + { + "name": "idx_status_exp", + "idxtype": "index", + "idxfields": [ + "status", + "expires_at" + ] + } + ] +} diff --git a/models/pipeline_session_settings.json b/models/pipeline_session_settings.json new file mode 100644 index 0000000..f9edb6e --- /dev/null +++ b/models/pipeline_session_settings.json @@ -0,0 +1,80 @@ +{ + "summary": [ + { + "name": "pipeline_session_settings", + "title": "会话设置", + "primary": [ + "id" + ], + "catelog": "entity" + } + ], + "fields": [ + { + "name": "id", + "title": "主键ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "session_id", + "title": "会话ID", + "type": "str", + "length": 64, + "nullable": "no" + }, + { + "name": "user_id", + "title": "用户ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "current_project_id", + "title": "当前项目ID", + "type": "str", + "length": 32, + "nullable": "no", + "default": "" + }, + { + "name": "current_iteration_id", + "title": "当前迭代ID", + "type": "str", + "length": 32, + "nullable": "no", + "default": "" + }, + { + "name": "created_at", + "title": "创建时间", + "type": "timestamp", + "nullable": "no" + }, + { + "name": "updated_at", + "title": "更新时间", + "type": "timestamp", + "nullable": "no" + } + ], + "indexes": [ + { + "name": "uk_user_session", + "idxtype": "unique", + "idxfields": [ + "user_id", + "session_id" + ] + }, + { + "name": "idx_session", + "idxtype": "index", + "idxfields": [ + "session_id" + ] + } + ] +} diff --git a/models/pipeline_tasks.json b/models/pipeline_tasks.json index ae625fe..d8a79a5 100644 --- a/models/pipeline_tasks.json +++ b/models/pipeline_tasks.json @@ -20,6 +20,8 @@ {"name": "claimed_by", "title": "认领agent标识", "type": "str", "length": 64, "nullable": "yes"}, {"name": "parent_id", "title": "父任务ID(分解后子任务指向父)", "type": "str", "length": 32, "nullable": "yes"}, {"name": "depends_on", "title": "依赖任务ID列表(JSON数组,依赖完成才可认领)", "type": "text"}, + {"name": "retry_count", "title": "重试次数", "type": "int", "nullable": "no", "default": "0"}, + {"name": "last_error", "title": "最后错误", "type": "text"}, {"name": "created_at", "title": "创建时间", "type": "timestamp", "nullable": "no"}, {"name": "updated_at", "title": "更新时间", "type": "timestamp", "nullable": "no"} ], diff --git a/models/sd_deploy_accounts.json b/models/sd_deploy_accounts.json new file mode 100644 index 0000000..6ce7fab --- /dev/null +++ b/models/sd_deploy_accounts.json @@ -0,0 +1,90 @@ +{ + "summary": [ + { + "name": "sd_deploy_accounts", + "title": "部署账号", + "primary": [ + "id" + ], + "catelog": "entity" + } + ], + "fields": [ + { + "name": "id", + "title": "主键ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "user_id", + "title": "用户ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "account_name", + "title": "账号名称", + "type": "str", + "length": 64, + "nullable": "no" + }, + { + "name": "deploy_dir", + "title": "部署目录", + "type": "str", + "length": 500, + "nullable": "no" + }, + { + "name": "status", + "title": "状态", + "type": "str", + "length": 20, + "nullable": "no", + "default": "active" + }, + { + "name": "sandbox_config", + "title": "沙箱配置", + "type": "text" + }, + { + "name": "created_at", + "title": "创建时间", + "type": "timestamp", + "nullable": "no" + }, + { + "name": "updated_at", + "title": "更新时间", + "type": "timestamp", + "nullable": "no" + } + ], + "indexes": [ + { + "name": "uk_account_name", + "idxtype": "unique", + "idxfields": [ + "account_name" + ] + }, + { + "name": "uk_user_id", + "idxtype": "unique", + "idxfields": [ + "user_id" + ] + }, + { + "name": "idx_status", + "idxtype": "index", + "idxfields": [ + "status" + ] + } + ] +} diff --git a/models/sd_work_envs.json b/models/sd_work_envs.json new file mode 100644 index 0000000..b6987b0 --- /dev/null +++ b/models/sd_work_envs.json @@ -0,0 +1,95 @@ +{ + "summary": [ + { + "name": "sd_work_envs", + "title": "工作环境", + "primary": [ + "id" + ], + "catelog": "entity" + } + ], + "fields": [ + { + "name": "id", + "title": "主键ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "owner_type", + "title": "归属类型", + "type": "str", + "length": 10, + "nullable": "no" + }, + { + "name": "owner_id", + "title": "归属ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "mode", + "title": "模式", + "type": "str", + "length": 10, + "nullable": "no", + "default": "local" + }, + { + "name": "remote_host", + "title": "远程主机", + "type": "str", + "length": 200 + }, + { + "name": "remote_port", + "title": "远程端口", + "type": "int", + "default": "22" + }, + { + "name": "remote_user", + "title": "远程用户", + "type": "str", + "length": 100 + }, + { + "name": "remote_key_path", + "title": "远程密钥路径", + "type": "str", + "length": 500 + }, + { + "name": "remote_dir", + "title": "远程目录", + "type": "str", + "length": 200 + }, + { + "name": "created_at", + "title": "创建时间", + "type": "timestamp", + "nullable": "no" + }, + { + "name": "updated_at", + "title": "更新时间", + "type": "timestamp", + "nullable": "no" + } + ], + "indexes": [ + { + "name": "uk_owner", + "idxtype": "unique", + "idxfields": [ + "owner_type", + "owner_id" + ] + } + ] +}