refactor: extract pipeline_core and pipeline_task as independent modules
- pipeline_core moved to independent repo pipeline_core.git - pipeline_task symlink fixed to relative path - All modules now cloned independently under pkgs/ - Removed embedded module source from umbrella repo
This commit is contained in:
parent
941c3c838e
commit
9d6446410f
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ conf/config.json
|
||||
pipeline.pid
|
||||
pkgs/
|
||||
bricks
|
||||
pipeline_core/
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
{
|
||||
"appcodes": [
|
||||
{
|
||||
"parentid": "pipeline_type",
|
||||
"parentname": "产线类型",
|
||||
"items": [
|
||||
{"k": "text", "v": "文本"},
|
||||
{"k": "audio", "v": "音频"},
|
||||
{"k": "video", "v": "视频"},
|
||||
{"k": "image", "v": "图片"},
|
||||
{"k": "multimodal", "v": "多模态"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"parentid": "pipeline_status",
|
||||
"parentname": "产线状态",
|
||||
"items": [
|
||||
{"k": "draft", "v": "草稿"},
|
||||
{"k": "published", "v": "已发布"},
|
||||
{"k": "archived", "v": "已归档"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
{
|
||||
"tblname": "llm",
|
||||
"title": "大语言模型管理",
|
||||
"params": {
|
||||
"sortby": "created_at",
|
||||
"browserfields": {
|
||||
"exclouded": ["id", "api_key"],
|
||||
"cwidth": {}
|
||||
},
|
||||
"editexclouded": ["id", "created_at", "updated_at"],
|
||||
"editable": {
|
||||
"new_data_url": "{{entire_url('./add_llm.dspy')}}",
|
||||
"update_data_url": "{{entire_url('./update_llm.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('./delete_llm.dspy')}}"
|
||||
},
|
||||
"confidential_fields": ["api_key"]
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
{
|
||||
"tblname": "pipeline_steps",
|
||||
"title": "产线步骤",
|
||||
"params": {
|
||||
"sortby": "step_order",
|
||||
"browserfields": {
|
||||
"exclouded": ["id", "step_config", "input_schema", "output_schema"],
|
||||
"cwidth": {}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id", "created_at"
|
||||
],
|
||||
"editable": {
|
||||
"new_data_url": "{{entire_url('../api/pipeline_steps_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('../api/pipeline_steps_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('../api/pipeline_steps_delete.dspy')}}"
|
||||
},
|
||||
"confidential_fields": [],
|
||||
"subtables": [
|
||||
{
|
||||
"field": "pipeline_id",
|
||||
"title": "所属产线",
|
||||
"subtable": "pipelines"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
{
|
||||
"tblname": "pipeline_versions",
|
||||
"title": "发布记录",
|
||||
"params": {
|
||||
"sortby": "created_at",
|
||||
"browserfields": {
|
||||
"exclouded": ["id", "config_snapshot"],
|
||||
"cwidth": {}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id", "created_at"
|
||||
],
|
||||
"editable": {
|
||||
"new_data_url": "{{entire_url('../api/pipeline_versions_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('../api/pipeline_versions_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('../api/pipeline_versions_delete.dspy')}}"
|
||||
},
|
||||
"confidential_fields": [],
|
||||
"subtables": [
|
||||
{
|
||||
"field": "pipeline_id",
|
||||
"title": "所属产线",
|
||||
"subtable": "pipelines"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
{
|
||||
"tblname": "pipelines",
|
||||
"title": "产线定义",
|
||||
"params": {
|
||||
"sortby": "created_at",
|
||||
"logined_userorgid": "org_id",
|
||||
"browserfields": {
|
||||
"exclouded": ["id", "model_api_key", "pipeline_config"],
|
||||
"cwidth": {}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id", "created_at", "updated_at"
|
||||
],
|
||||
"editable": {
|
||||
"new_data_url": "{{entire_url('../api/pipelines_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('../api/pipelines_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('../api/pipelines_delete.dspy')}}"
|
||||
},
|
||||
"confidential_fields": ["model_api_key"]
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
{
|
||||
"summary": [
|
||||
{
|
||||
"name": "llm",
|
||||
"title": "大语言模型表",
|
||||
"primary": ["id"]
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{"name": "id", "title": "主键", "type": "str", "length": 32, "nullable": "no"},
|
||||
{"name": "name", "title": "模型名称", "type": "str", "length": 100, "nullable": "no"},
|
||||
{"name": "provider", "title": "供应商", "type": "str", "length": 50, "nullable": "no"},
|
||||
{"name": "model_id", "title": "模型标识", "type": "str", "length": 100},
|
||||
{"name": "api_base", "title": "API地址", "type": "str", "length": 500},
|
||||
{"name": "api_key", "title": "API密钥", "type": "str", "length": 500},
|
||||
{"name": "max_tokens", "title": "最大Token", "type": "int", "default": "8192"},
|
||||
{"name": "status", "title": "状态", "type": "str", "length": 20, "default": "active"},
|
||||
{"name": "description", "title": "描述", "type": "text"},
|
||||
{"name": "created_at", "title": "创建时间", "type": "timestamp"},
|
||||
{"name": "updated_at", "title": "更新时间", "type": "timestamp"}
|
||||
],
|
||||
"indexes": [
|
||||
{"name": "idx_llm_status", "idxtype": "index", "idxfields": ["status"]}
|
||||
]
|
||||
}
|
||||
@ -1,122 +0,0 @@
|
||||
{
|
||||
"summary": [
|
||||
{
|
||||
"name": "pipeline_steps",
|
||||
"title": "产线步骤表",
|
||||
"primary": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"uitype": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "所属产线",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"uitype": "select"
|
||||
},
|
||||
{
|
||||
"name": "step_order",
|
||||
"title": "步骤序号",
|
||||
"type": "int",
|
||||
"nullable": "no",
|
||||
"uitype": "number"
|
||||
},
|
||||
{
|
||||
"name": "step_name",
|
||||
"title": "步骤名称",
|
||||
"type": "str",
|
||||
"length": 100,
|
||||
"nullable": "no",
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "step_type",
|
||||
"title": "步骤类型",
|
||||
"type": "str",
|
||||
"length": 50,
|
||||
"nullable": "no",
|
||||
"uitype": "select"
|
||||
},
|
||||
{
|
||||
"name": "model_name",
|
||||
"title": "调用模型名称",
|
||||
"type": "str",
|
||||
"length": 100,
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "step_config",
|
||||
"title": "步骤配置JSON",
|
||||
"type": "text",
|
||||
"uitype": "textarea"
|
||||
},
|
||||
{
|
||||
"name": "input_schema",
|
||||
"title": "输入定义JSON",
|
||||
"type": "text",
|
||||
"uitype": "textarea"
|
||||
},
|
||||
{
|
||||
"name": "output_schema",
|
||||
"title": "输出定义JSON",
|
||||
"type": "text",
|
||||
"uitype": "textarea"
|
||||
},
|
||||
{
|
||||
"name": "timeout_seconds",
|
||||
"title": "超时秒数",
|
||||
"type": "int",
|
||||
"default": "300",
|
||||
"uitype": "number"
|
||||
},
|
||||
{
|
||||
"name": "retry_count",
|
||||
"title": "重试次数",
|
||||
"type": "int",
|
||||
"default": "0",
|
||||
"uitype": "number"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp",
|
||||
"uitype": "timestamp"
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_steps_pipeline",
|
||||
"idxtype": "index",
|
||||
"idxfields": [
|
||||
"pipeline_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "idx_steps_order",
|
||||
"idxtype": "unique",
|
||||
"idxfields": [
|
||||
"pipeline_id",
|
||||
"step_order"
|
||||
]
|
||||
}
|
||||
],
|
||||
"codes": [
|
||||
{
|
||||
"field": "pipeline_id",
|
||||
"table": "pipelines",
|
||||
"valuefield": "id",
|
||||
"textfield": "name"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
{
|
||||
"summary": [
|
||||
{
|
||||
"name": "pipeline_versions",
|
||||
"title": "产线发布记录表",
|
||||
"primary": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"uitype": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"uitype": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"title": "版本号",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "publish_status",
|
||||
"title": "发布状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"default": "pending",
|
||||
"uitype": "select"
|
||||
},
|
||||
{
|
||||
"name": "published_by",
|
||||
"title": "发布人",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "published_at",
|
||||
"title": "发布时间",
|
||||
"type": "timestamp",
|
||||
"uitype": "timestamp"
|
||||
},
|
||||
{
|
||||
"name": "changelog",
|
||||
"title": "变更说明",
|
||||
"type": "text",
|
||||
"uitype": "textarea"
|
||||
},
|
||||
{
|
||||
"name": "config_snapshot",
|
||||
"title": "配置快照JSON",
|
||||
"type": "text",
|
||||
"uitype": "textarea"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp",
|
||||
"uitype": "timestamp"
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_versions_pipeline",
|
||||
"idxtype": "index",
|
||||
"idxfields": [
|
||||
"pipeline_id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"codes": [
|
||||
{
|
||||
"field": "pipeline_id",
|
||||
"table": "pipelines",
|
||||
"valuefield": "id",
|
||||
"textfield": "name"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,139 +0,0 @@
|
||||
{
|
||||
"summary": [
|
||||
{
|
||||
"name": "pipelines",
|
||||
"title": "产线定义表",
|
||||
"primary": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"uitype": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"title": "产线名称",
|
||||
"type": "str",
|
||||
"length": 200,
|
||||
"nullable": "no",
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"title": "产线描述",
|
||||
"type": "text",
|
||||
"uitype": "textarea"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_type",
|
||||
"title": "产线类型",
|
||||
"type": "str",
|
||||
"length": 50,
|
||||
"nullable": "no",
|
||||
"uitype": "select"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"title": "当前版本",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"default": "1.0.0",
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"default": "draft",
|
||||
"uitype": "select"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_config",
|
||||
"title": "产线配置JSON",
|
||||
"type": "text",
|
||||
"uitype": "textarea"
|
||||
},
|
||||
{
|
||||
"name": "model_api_url",
|
||||
"title": "模型API地址",
|
||||
"type": "str",
|
||||
"length": 500,
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "model_api_key",
|
||||
"title": "模型API密钥",
|
||||
"type": "str",
|
||||
"length": 500,
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "org_id",
|
||||
"title": "所属机构ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"default": "0",
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"title": "创建人",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"uitype": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp",
|
||||
"uitype": "timestamp"
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"title": "更新时间",
|
||||
"type": "timestamp",
|
||||
"uitype": "timestamp"
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_pipelines_name",
|
||||
"idxtype": "index",
|
||||
"idxfields": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "idx_pipelines_status",
|
||||
"idxtype": "index",
|
||||
"idxfields": [
|
||||
"status"
|
||||
]
|
||||
}
|
||||
],
|
||||
"codes": [
|
||||
{
|
||||
"field": "pipeline_type",
|
||||
"table": "appcodes_kv",
|
||||
"valuefield": "k",
|
||||
"textfield": "v",
|
||||
"cond": "parentid='pipeline_type'"
|
||||
},
|
||||
{
|
||||
"field": "status",
|
||||
"table": "appcodes_kv",
|
||||
"valuefield": "k",
|
||||
"textfield": "v",
|
||||
"cond": "parentid='pipeline_status'"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,115 +0,0 @@
|
||||
|
||||
-- models/pipeline_versions.json
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- 建库时请用以下语句,支持emoji字符
|
||||
-- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
drop table if exists pipeline_versions;
|
||||
CREATE TABLE pipeline_versions
|
||||
(
|
||||
|
||||
`id` VARCHAR(32) NOT NULL comment 'id',
|
||||
`pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
|
||||
`version` VARCHAR(20) NOT NULL comment '版本号',
|
||||
`publish_status` VARCHAR(20) NOT NULL DEFAULT 'pending' comment '发布状态',
|
||||
`published_by` VARCHAR(32) comment '发布人',
|
||||
`published_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '发布时间',
|
||||
`changelog` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '变更说明',
|
||||
`config_snapshot` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '配置快照JSON',
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间'
|
||||
|
||||
|
||||
,primary key(id)
|
||||
|
||||
|
||||
)
|
||||
CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci
|
||||
engine=innodb
|
||||
comment '产线发布记录表'
|
||||
;
|
||||
|
||||
CREATE INDEX pipeline_versions_idx_versions_pipeline ON pipeline_versions(pipeline_id);
|
||||
|
||||
-- models/pipelines.json
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- 建库时请用以下语句,支持emoji字符
|
||||
-- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
drop table if exists pipelines;
|
||||
CREATE TABLE pipelines
|
||||
(
|
||||
|
||||
`id` VARCHAR(32) NOT NULL comment 'id',
|
||||
`name` VARCHAR(200) NOT NULL comment '产线名称',
|
||||
`description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '产线描述',
|
||||
`pipeline_type` VARCHAR(50) NOT NULL comment '产线类型',
|
||||
`version` VARCHAR(20) DEFAULT '1.0.0' comment '当前版本',
|
||||
`status` VARCHAR(20) NOT NULL DEFAULT 'draft' comment '状态',
|
||||
`pipeline_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '产线配置JSON',
|
||||
`model_api_url` VARCHAR(500) comment '模型API地址',
|
||||
`model_api_key` VARCHAR(500) comment '模型API密钥',
|
||||
`org_id` VARCHAR(32) DEFAULT '0' comment '所属机构ID',
|
||||
`created_by` VARCHAR(32) comment '创建人',
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间',
|
||||
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '更新时间'
|
||||
|
||||
|
||||
,primary key(id)
|
||||
|
||||
|
||||
)
|
||||
CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci
|
||||
engine=innodb
|
||||
comment '产线定义表'
|
||||
;
|
||||
|
||||
CREATE INDEX pipelines_idx_pipelines_name ON pipelines(name);
|
||||
CREATE INDEX pipelines_idx_pipelines_status ON pipelines(status);
|
||||
|
||||
-- models/pipeline_steps.json
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- 建库时请用以下语句,支持emoji字符
|
||||
-- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
drop table if exists pipeline_steps;
|
||||
CREATE TABLE pipeline_steps
|
||||
(
|
||||
|
||||
`id` VARCHAR(32) NOT NULL comment 'id',
|
||||
`pipeline_id` VARCHAR(32) NOT NULL comment '所属产线',
|
||||
`step_order` int NOT NULL comment '步骤序号',
|
||||
`step_name` VARCHAR(100) NOT NULL comment '步骤名称',
|
||||
`step_type` VARCHAR(50) NOT NULL comment '步骤类型',
|
||||
`model_name` VARCHAR(100) comment '调用模型名称',
|
||||
`step_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '步骤配置JSON',
|
||||
`input_schema` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '输入定义JSON',
|
||||
`output_schema` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '输出定义JSON',
|
||||
`timeout_seconds` int DEFAULT '300' comment '超时秒数',
|
||||
`retry_count` int DEFAULT '0' comment '重试次数',
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间'
|
||||
|
||||
|
||||
,primary key(id)
|
||||
|
||||
|
||||
)
|
||||
CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci
|
||||
engine=innodb
|
||||
comment '产线步骤表'
|
||||
;
|
||||
|
||||
CREATE INDEX pipeline_steps_idx_steps_pipeline ON pipeline_steps(pipeline_id);
|
||||
CREATE UNIQUE INDEX pipeline_steps_idx_steps_order ON pipeline_steps(pipeline_id,step_order);
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
# pipeline_core/__init__.py
|
||||
from .init import (
|
||||
create_pipeline,
|
||||
update_pipeline,
|
||||
delete_pipeline,
|
||||
create_pipeline_step,
|
||||
update_pipeline_step,
|
||||
delete_pipeline_step,
|
||||
create_pipeline_version,
|
||||
update_pipeline_version,
|
||||
delete_pipeline_version,
|
||||
publish_pipeline,
|
||||
load_pipeline_core,
|
||||
)
|
||||
@ -1,331 +0,0 @@
|
||||
"""pipeline_core 模块 - 产线管理核心模块"""
|
||||
import json
|
||||
from appPublic.uniqueID import getID
|
||||
from sqlor.dbpools import DBPools
|
||||
from ahserver.serverenv import ServerEnv
|
||||
from appPublic.log import debug
|
||||
|
||||
|
||||
MODULE_NAME = 'pipeline_core'
|
||||
DBNAME = 'pipeline'
|
||||
|
||||
|
||||
def _get_sor():
|
||||
"""Get database pool and dbname for pipeline_core module."""
|
||||
return DBPools(), DBNAME
|
||||
|
||||
|
||||
async def create_pipeline(params_kw):
|
||||
"""创建产线记录"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
data['id'] = getID()
|
||||
await sor.C('pipelines', data)
|
||||
result['success'] = True
|
||||
result['message'] = '创建成功'
|
||||
result['id'] = data['id']
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def update_pipeline(params_kw):
|
||||
"""更新产线记录"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
record_id = data.pop('id', None)
|
||||
if not record_id:
|
||||
result['message'] = '缺少id'
|
||||
else:
|
||||
await sor.U('pipelines', {**data, 'id': record_id})
|
||||
result['success'] = True
|
||||
result['message'] = '更新成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def delete_pipeline(params_kw):
|
||||
"""删除产线记录"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
record_id = params_kw.get('id')
|
||||
if not record_id:
|
||||
result['message'] = '缺少id'
|
||||
else:
|
||||
await sor.D('pipelines', {'id': record_id})
|
||||
result['success'] = True
|
||||
result['message'] = '删除成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def create_pipeline_step(params_kw):
|
||||
"""创建产线步骤"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
data['id'] = getID()
|
||||
await sor.C('pipeline_steps', data)
|
||||
result['success'] = True
|
||||
result['message'] = '创建成功'
|
||||
result['id'] = data['id']
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def update_pipeline_step(params_kw):
|
||||
"""更新产线步骤"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
record_id = data.pop('id', None)
|
||||
if not record_id:
|
||||
result['message'] = '缺少id'
|
||||
else:
|
||||
await sor.U('pipeline_steps', {**data, 'id': record_id})
|
||||
result['success'] = True
|
||||
result['message'] = '更新成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def delete_pipeline_step(params_kw):
|
||||
"""删除产线步骤"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
record_id = params_kw.get('id')
|
||||
if not record_id:
|
||||
result['message'] = '缺少id'
|
||||
else:
|
||||
await sor.D('pipeline_steps', {'id': record_id})
|
||||
result['success'] = True
|
||||
result['message'] = '删除成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def create_pipeline_version(params_kw):
|
||||
"""创建产线发布记录"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
data['id'] = getID()
|
||||
await sor.C('pipeline_versions', data)
|
||||
result['success'] = True
|
||||
result['message'] = '创建成功'
|
||||
result['id'] = data['id']
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def update_pipeline_version(params_kw):
|
||||
"""更新产线发布记录"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
record_id = data.pop('id', None)
|
||||
if not record_id:
|
||||
result['message'] = '缺少id'
|
||||
else:
|
||||
await sor.U('pipeline_versions', {**data, 'id': record_id})
|
||||
result['success'] = True
|
||||
result['message'] = '更新成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def delete_pipeline_version(params_kw):
|
||||
"""删除产线发布记录"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
record_id = params_kw.get('id')
|
||||
if not record_id:
|
||||
result['message'] = '缺少id'
|
||||
else:
|
||||
await sor.D('pipeline_versions', {'id': record_id})
|
||||
result['success'] = True
|
||||
result['message'] = '删除成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def publish_pipeline(params_kw):
|
||||
"""发布产线 - 创建发布记录并更新产线状态"""
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
pipeline_id = params_kw.get('pipeline_id')
|
||||
if not pipeline_id:
|
||||
result['message'] = '缺少pipeline_id'
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
changelog = params_kw.get('changelog', '')
|
||||
published_by = params_kw.get('published_by', '')
|
||||
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
# Get current pipeline
|
||||
recs = await sor.R('pipelines', {'id': pipeline_id})
|
||||
if not recs:
|
||||
result['message'] = f'产线不存在: {pipeline_id}'
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
pipeline = recs[0]
|
||||
current_version = pipeline.get('version', '1.0.0') if hasattr(pipeline, 'get') else getattr(pipeline, 'version', '1.0.0')
|
||||
|
||||
# Build config snapshot from current pipeline data
|
||||
config_snapshot = json.dumps({
|
||||
'pipeline_config': getattr(pipeline, 'pipeline_config', None),
|
||||
'model_api_url': getattr(pipeline, 'model_api_url', None),
|
||||
'version': current_version,
|
||||
}, ensure_ascii=False, default=str)
|
||||
|
||||
# Create version record
|
||||
version_id = getID()
|
||||
version_data = {
|
||||
'id': version_id,
|
||||
'pipeline_id': pipeline_id,
|
||||
'version': current_version,
|
||||
'publish_status': 'published',
|
||||
'published_by': published_by,
|
||||
'changelog': changelog,
|
||||
'config_snapshot': config_snapshot,
|
||||
}
|
||||
await sor.C('pipeline_versions', version_data)
|
||||
|
||||
# Update pipeline status to published
|
||||
await sor.U('pipelines', {'id': pipeline_id, 'status': 'published'})
|
||||
|
||||
result['success'] = True
|
||||
result['message'] = '发布成功'
|
||||
result['version_id'] = version_id
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def create_llm(params_kw):
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
data['id'] = getID()
|
||||
await sor.C('llm', data)
|
||||
result['success'] = True
|
||||
result['message'] = '创建成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def update_llm(params_kw):
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
data = params_kw.copy()
|
||||
data.pop('page', None)
|
||||
data.pop('rows', None)
|
||||
data.pop('data_filter', None)
|
||||
await sor.U('llm', data)
|
||||
result['success'] = True
|
||||
result['message'] = '更新成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
async def delete_llm(params_kw):
|
||||
result = {'success': False, 'message': ''}
|
||||
try:
|
||||
db, dbname = _get_sor()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
await sor.D('llm', {'id': params_kw.get('id')})
|
||||
result['success'] = True
|
||||
result['message'] = '删除成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
def load_pipeline_core():
|
||||
"""注册函数到 ServerEnv"""
|
||||
env = ServerEnv()
|
||||
# Pipelines
|
||||
env.create_pipeline = create_pipeline
|
||||
env.create_pipelines = create_pipeline
|
||||
env.update_pipeline = update_pipeline
|
||||
env.update_pipelines = update_pipeline
|
||||
env.delete_pipeline = delete_pipeline
|
||||
env.delete_pipelines = delete_pipeline
|
||||
# LLM
|
||||
env.create_llm = create_llm
|
||||
env.update_llm = update_llm
|
||||
env.delete_llm = delete_llm
|
||||
# Pipeline Steps
|
||||
env.create_pipeline_step = create_pipeline_step
|
||||
env.create_pipeline_steps = create_pipeline_step
|
||||
env.update_pipeline_step = update_pipeline_step
|
||||
env.update_pipeline_steps = update_pipeline_step
|
||||
env.delete_pipeline_step = delete_pipeline_step
|
||||
env.delete_pipeline_steps = delete_pipeline_step
|
||||
# Pipeline Versions
|
||||
env.create_pipeline_version = create_pipeline_version
|
||||
env.create_pipeline_versions = create_pipeline_version
|
||||
env.update_pipeline_version = update_pipeline_version
|
||||
env.update_pipeline_versions = update_pipeline_version
|
||||
env.delete_pipeline_version = delete_pipeline_version
|
||||
env.delete_pipeline_versions = delete_pipeline_version
|
||||
# Publish
|
||||
env.publish_pipeline = publish_pipeline
|
||||
debug(f'[{MODULE_NAME}] module loaded')
|
||||
return True
|
||||
@ -1,9 +0,0 @@
|
||||
[project]
|
||||
name = "pipeline_core"
|
||||
version = "0.1.0"
|
||||
description = "产线管理核心模块"
|
||||
dependencies = ["sqlor", "bricks_for_python"]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["pipeline_core*"]
|
||||
@ -1,70 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""RBAC path registration for pipeline_core module."""
|
||||
import os, sys, subprocess
|
||||
|
||||
MOD = "pipeline_core"
|
||||
|
||||
PATHS_ANY = [
|
||||
f"/{MOD}/index.ui",
|
||||
]
|
||||
|
||||
PATHS_LOGINED = [
|
||||
f"/{MOD}",
|
||||
# Pipelines CRUD
|
||||
f"/{MOD}/pipelines/index.ui",
|
||||
f"/{MOD}/pipelines/get_pipelines.dspy",
|
||||
f"/{MOD}/pipelines/add_pipelines.dspy",
|
||||
f"/{MOD}/pipelines/update_pipelines.dspy",
|
||||
f"/{MOD}/pipelines/delete_pipelines.dspy",
|
||||
# Pipeline Steps CRUD
|
||||
f"/{MOD}/pipeline_steps/index.ui",
|
||||
f"/{MOD}/pipeline_steps/get_pipeline_steps.dspy",
|
||||
f"/{MOD}/pipeline_steps/add_pipeline_steps.dspy",
|
||||
f"/{MOD}/pipeline_steps/update_pipeline_steps.dspy",
|
||||
f"/{MOD}/pipeline_steps/delete_pipeline_steps.dspy",
|
||||
# Pipeline Versions
|
||||
f"/{MOD}/pipeline_versions/index.ui",
|
||||
f"/{MOD}/pipeline_versions/get_pipeline_versions.dspy",
|
||||
f"/{MOD}/pipeline_versions/add_pipeline_versions.dspy",
|
||||
f"/{MOD}/pipeline_versions/update_pipeline_versions.dspy",
|
||||
f"/{MOD}/pipeline_versions/delete_pipeline_versions.dspy",
|
||||
# Pipeline Editor
|
||||
f"/{MOD}/pipeline_editor/index.ui",
|
||||
f"/{MOD}/pipeline_editor/save_steps.dspy",
|
||||
# Data sources
|
||||
f"/{MOD}/pipeline_steps/get_pipelines.dspy",
|
||||
f"/{MOD}/pipeline_steps/get_step_types.dspy",
|
||||
# API
|
||||
f"/{MOD}/api/pipeline_publish.dspy",
|
||||
f"/{MOD}/api/pipeline_steps_create.dspy",
|
||||
f"/{MOD}/api/pipeline_steps_update.dspy",
|
||||
f"/{MOD}/api/pipeline_steps_delete.dspy",
|
||||
f"/{MOD}/api/pipeline_versions_create.dspy",
|
||||
f"/{MOD}/api/pipeline_versions_update.dspy",
|
||||
f"/{MOD}/api/pipeline_versions_delete.dspy",
|
||||
f"/{MOD}/api/pipelines_create.dspy",
|
||||
f"/{MOD}/api/pipelines_update.dspy",
|
||||
f"/{MOD}/api/pipelines_delete.dspy",
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
root = os.path.expanduser("~/pipeline")
|
||||
if not os.path.isfile(os.path.join(root, "set_role_perm.py")):
|
||||
print("ERROR: pipeline root not found")
|
||||
sys.exit(1)
|
||||
set_perm = os.path.join(root, "set_role_perm.py")
|
||||
py = sys.executable
|
||||
count = 0
|
||||
for role, paths in [("any", PATHS_ANY), ("logined", PATHS_LOGINED)]:
|
||||
for path in paths:
|
||||
r = subprocess.run([py, set_perm, role, path], capture_output=True, text=True, cwd=root)
|
||||
if r.returncode == 0:
|
||||
count += 1
|
||||
else:
|
||||
print(f" WARN: {path} -> {r.stderr.strip()[-80:]}")
|
||||
print(f"Registered {count}/{len(PATHS_ANY)+len(PATHS_LOGINED)} paths for {MOD}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@ -1,5 +0,0 @@
|
||||
func = publish_pipeline
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = create_pipeline_step
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = delete_pipeline_step
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = update_pipeline_step
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = create_pipeline_version
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = delete_pipeline_version
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = update_pipeline_version
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = create_pipeline
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = delete_pipeline
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,5 +0,0 @@
|
||||
func = update_pipeline
|
||||
if func is None:
|
||||
return json.dumps({'status': 'error', 'message': 'function not found'})
|
||||
result = await func(params_kw)
|
||||
return result
|
||||
@ -1,254 +0,0 @@
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"width": "100%",
|
||||
"height": "100%",
|
||||
"padding": "0"
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
"options": {
|
||||
"width": "100%",
|
||||
"alignItems": "center",
|
||||
"padding": "24px 24px 12px 24px",
|
||||
"cheight": 6
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Title2",
|
||||
"options": {
|
||||
"text": "产线管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "Filler"
|
||||
},
|
||||
{
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"text": "产线定义、步骤配置与发布管理",
|
||||
"cfontsize": 1.2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
"options": {
|
||||
"width": "100%",
|
||||
"padding": "12px 24px 12px 24px",
|
||||
"cheight": 18
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "ResponsableBox",
|
||||
"options": {
|
||||
"gap": "24px",
|
||||
"minWidth": "260px"
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"text": "EDITOR CARD HERE"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"css": "card",
|
||||
"cwidth": 23,
|
||||
"cheight": 12,
|
||||
"padding": "24px",
|
||||
"cursor": "pointer",
|
||||
"bgcolor": "#fff"
|
||||
},
|
||||
"binds": [
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "click",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "app.main_content",
|
||||
"options": {
|
||||
"url": "{{entire_url('/pipeline_core/pipelines/')}}"
|
||||
},
|
||||
"mode": "replace"
|
||||
}
|
||||
],
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"width": "44px",
|
||||
"height": "44px",
|
||||
"bgcolor": "#EFF6FF",
|
||||
"borderRadius": "12px",
|
||||
"alignItems": "center",
|
||||
"justifyContent": "center",
|
||||
"marginBottom": "12px"
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Svg",
|
||||
"options": {
|
||||
"svg": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#3B82F6\" stroke-width=\"2\"><path d=\"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z\"/></svg>",
|
||||
"width": "24px",
|
||||
"height": "24px"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "Title3",
|
||||
"options": {
|
||||
"text": "产线定义",
|
||||
"marginBottom": "4px"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"text": "管理产线基本信息与配置",
|
||||
"cfontsize": 1.2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"css": "card",
|
||||
"cwidth": 23,
|
||||
"cheight": 12,
|
||||
"padding": "24px",
|
||||
"cursor": "pointer",
|
||||
"bgcolor": "#fff"
|
||||
},
|
||||
"binds": [
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "click",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "app.main_content",
|
||||
"options": {
|
||||
"url": "{{entire_url('/pipeline_core/pipeline_steps/')}}"
|
||||
},
|
||||
"mode": "replace"
|
||||
}
|
||||
],
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"width": "44px",
|
||||
"height": "44px",
|
||||
"bgcolor": "#F0FDF4",
|
||||
"borderRadius": "12px",
|
||||
"alignItems": "center",
|
||||
"justifyContent": "center",
|
||||
"marginBottom": "12px"
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Svg",
|
||||
"options": {
|
||||
"svg": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#22C55E\" stroke-width=\"2\"><path d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"/></svg>",
|
||||
"width": "24px",
|
||||
"height": "24px"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "Title3",
|
||||
"options": {
|
||||
"text": "产线步骤",
|
||||
"marginBottom": "4px"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"text": "配置产线执行步骤与参数",
|
||||
"cfontsize": 1.2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"css": "card",
|
||||
"cwidth": 23,
|
||||
"cheight": 12,
|
||||
"padding": "24px",
|
||||
"cursor": "pointer",
|
||||
"bgcolor": "#fff"
|
||||
},
|
||||
"binds": [
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "click",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "app.main_content",
|
||||
"options": {
|
||||
"url": "{{entire_url('/pipeline_core/pipeline_versions/')}}"
|
||||
},
|
||||
"mode": "replace"
|
||||
}
|
||||
],
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"width": "44px",
|
||||
"height": "44px",
|
||||
"bgcolor": "#FFFBEB",
|
||||
"borderRadius": "12px",
|
||||
"alignItems": "center",
|
||||
"justifyContent": "center",
|
||||
"marginBottom": "12px"
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Svg",
|
||||
"options": {
|
||||
"svg": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#F59E0B\" stroke-width=\"2\"><path d=\"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z\"/></svg>",
|
||||
"width": "24px",
|
||||
"height": "24px"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "Title3",
|
||||
"options": {
|
||||
"text": "发布记录",
|
||||
"marginBottom": "4px"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"text": "查看产线版本发布历史",
|
||||
"cfontsize": 1.2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "VScrollPanel",
|
||||
"id": "pipeline_core_content",
|
||||
"options": {
|
||||
"css": "filler",
|
||||
"width": "100%",
|
||||
"height": "100%"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {"width": "100%", "height": "100%", "padding": "24px", "gap": "20px"},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
"options": {"alignItems": "center", "gap": "16px", "padding": "0 0 16px 0", "borderBottom": "1px solid #334155"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Title2", "options": {"text": "产线编排画布"}},
|
||||
{"widgettype": "Filler"},
|
||||
{
|
||||
"widgettype": "Button",
|
||||
"options": {"label": "发布版本", "bgcolor": "#6366f1", "color": "#fff"},
|
||||
"binds": [{"wid": "self", "event": "click", "actiontype": "method", "target": "app.pipeline_editor", "method": "publish"}]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
"options": {"gap": "12px", "alignItems": "center"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Text", "options": {"text": "选择产线:", "cfontsize": 1, "color": "#e2e8f0"}},
|
||||
{
|
||||
"widgettype": "DataSelector",
|
||||
"id": "ds_pipelines",
|
||||
"options": {
|
||||
"data_url": "{{entire_url('/pipeline_core/pipeline_steps/get_pipelines.dspy')}}",
|
||||
"valueField": "id",
|
||||
"textField": "name",
|
||||
"width": "300px",
|
||||
"placeholder": "选择要编辑的产线..."
|
||||
},
|
||||
"binds": [{"wid": "self", "event": "change", "actiontype": "method", "target": "app.pipeline_editor", "method": "load_steps"}]
|
||||
},
|
||||
{
|
||||
"widgettype": "DataSelector",
|
||||
"id": "ds_step_types",
|
||||
"options": {
|
||||
"data_url": "{{entire_url('/pipeline_core/pipeline_steps/get_step_types.dspy')}}",
|
||||
"valueField": "step_type",
|
||||
"textField": "display_name",
|
||||
"width": "240px",
|
||||
"placeholder": "添加步骤类型..."
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "Button",
|
||||
"options": {"label": "+ 添加步骤", "bgcolor": "#4ade80", "color": "#000"},
|
||||
"binds": [{"wid": "self", "event": "click", "actiontype": "method", "target": "app.pipeline_editor", "method": "add_step"}]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "DataViewer",
|
||||
"id": "dv_steps",
|
||||
"options": {
|
||||
"data_url": "",
|
||||
"width": "100%",
|
||||
"columns": ["id", "step_order", "step_name", "step_type"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"id": "steps_canvas",
|
||||
"options": {"width": "100%", "gap": "8px", "padding": "0", "minHeight": "300px"},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Text",
|
||||
"options": {"text": "选择产线后,步骤将在此显示。可以拖拽排序、点击编辑。", "cfontsize": 1, "color": "#64748b", "padding": "40px", "alignItems": "center"}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
"options": {"gap": "12px", "justifyContent": "flex-end", "padding": "16px 0 0 0", "borderTop": "1px solid #334155"},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Button",
|
||||
"options": {"label": "保存排序", "bgcolor": "#3b82f6", "color": "#fff"},
|
||||
"binds": [{"wid": "self", "event": "click", "actiontype": "method", "target": "app.pipeline_editor", "method": "save_order"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
"""
|
||||
Pipeline Editor: Save step order after reordering
|
||||
POST params: pipeline_id, steps (JSON array of {id, step_order})
|
||||
"""
|
||||
from sqlor.dbpools import DBPools
|
||||
|
||||
async def main():
|
||||
userid = await get_user()
|
||||
if not userid:
|
||||
return {'error': 'unauthorized'}
|
||||
|
||||
pipeline_id = params_kw.pipeline_id
|
||||
steps = params_kw.steps # JSON array
|
||||
|
||||
if not pipeline_id or not steps:
|
||||
return {'error': 'missing pipeline_id or steps'}
|
||||
|
||||
if isinstance(steps, str):
|
||||
import json
|
||||
steps = json.loads(steps)
|
||||
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
for i, step in enumerate(steps):
|
||||
await sor.U('pipeline_steps', {
|
||||
'id': step['id'],
|
||||
'step_order': i + 1,
|
||||
'step_name': step.get('step_name', ''),
|
||||
'step_type': step.get('step_type', ''),
|
||||
'step_config': step.get('step_config', '{}'),
|
||||
'timeout_seconds': step.get('timeout_seconds', 300),
|
||||
'retry_count': step.get('retry_count', 0)
|
||||
})
|
||||
|
||||
# Create version record
|
||||
from appPublic.uniqueID import getID
|
||||
vid = getID()
|
||||
await sor.C('pipeline_versions', {
|
||||
'id': vid,
|
||||
'pipeline_id': pipeline_id,
|
||||
'version': f"v{len(steps)}.0",
|
||||
'publish_status': 'draft',
|
||||
'changelog': 'Editor save',
|
||||
'config_snapshot': json.dumps(steps, ensure_ascii=False) if 'json' in dir() else str(steps)
|
||||
})
|
||||
|
||||
return {'success': True, 'version_id': vid, 'step_count': len(steps)}
|
||||
@ -1,37 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
id = params_kw.id
|
||||
if not id or len(id) > 32:
|
||||
id = uuid()
|
||||
ns['id'] = id
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('pipeline_steps', ns.copy())
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"title":"Add Success",
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
}
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.D('pipeline_steps', ns)
|
||||
debug('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
debug('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
|
||||
from sqlor.dbpools import DBPools
|
||||
|
||||
async def main():
|
||||
pipeline_id = params_kw.pipeline_id or params_kw.id
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
if pipeline_id:
|
||||
recs = await sor.R('pipeline_steps', {'pipeline_id': pipeline_id})
|
||||
else:
|
||||
recs = await sor.R('pipeline_steps', {})
|
||||
# Sort by step_order
|
||||
recs = sorted(recs, key=lambda r: r.step_order if hasattr(r,'step_order') else 0)
|
||||
return recs
|
||||
@ -1,13 +0,0 @@
|
||||
|
||||
from sqlor.dbpools import DBPools
|
||||
|
||||
async def main():
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
recs = await sor.R('pipelines', {'status': 'published'})
|
||||
if not recs:
|
||||
recs = await sor.R('pipelines', {})
|
||||
result = []
|
||||
for r in recs:
|
||||
result.append({'id': r.id, 'name': r.name, 'text': r.name, 'value': r.id})
|
||||
return result
|
||||
@ -1,18 +0,0 @@
|
||||
|
||||
from sqlor.dbpools import DBPools
|
||||
|
||||
async def main():
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
recs = await sor.R('pipeline_step_types', {})
|
||||
result = []
|
||||
for r in recs:
|
||||
result.append({
|
||||
'step_type': r.step_type,
|
||||
'display_name': r.display_name,
|
||||
'text': f"{r.display_name} ({r.step_type})",
|
||||
'value': r.step_type,
|
||||
'category': r.category,
|
||||
'is_interactive': r.is_interactive
|
||||
})
|
||||
return result
|
||||
@ -1,241 +0,0 @@
|
||||
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{"cheight":40,"width":"100%"},
|
||||
"subwidgets":[{
|
||||
"id":"pipeline_steps_tbl",
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
|
||||
|
||||
"title":"产线步骤表",
|
||||
|
||||
|
||||
|
||||
|
||||
"toolbar":{
|
||||
"tools": [
|
||||
{
|
||||
"selected_row": true,
|
||||
"name": "pipelines",
|
||||
"icon": "{{entire_url('/imgs/pipelines.svg')}}",
|
||||
"label": "所属产线"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"css":"card",
|
||||
|
||||
|
||||
"editable":{
|
||||
|
||||
"new_data_url":"{{entire_url('add_pipeline_steps.dspy')}}",
|
||||
|
||||
|
||||
"delete_data_url":"{{entire_url('delete_pipeline_steps.dspy')}}",
|
||||
|
||||
|
||||
"update_data_url":"{{entire_url('update_pipeline_steps.dspy')}}"
|
||||
|
||||
},
|
||||
|
||||
|
||||
"data_url":"{{entire_url('./get_pipeline_steps.dspy')}}",
|
||||
|
||||
"data_method":"GET",
|
||||
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
|
||||
"row_options":{
|
||||
|
||||
|
||||
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id",
|
||||
"step_config",
|
||||
"input_schema",
|
||||
"output_schema"
|
||||
],
|
||||
"cwidth": {}
|
||||
},
|
||||
|
||||
|
||||
"editexclouded":[
|
||||
"id",
|
||||
"created_at"
|
||||
],
|
||||
|
||||
"fields":[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "id"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "所属产线",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"label": "所属产线",
|
||||
"uitype": "code",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "pipelines",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "name",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "step_order",
|
||||
"title": "步骤序号",
|
||||
"type": "int",
|
||||
"nullable": "no",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "步骤序号"
|
||||
},
|
||||
{
|
||||
"name": "step_name",
|
||||
"title": "步骤名称",
|
||||
"type": "str",
|
||||
"length": 100,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "步骤名称"
|
||||
},
|
||||
{
|
||||
"name": "step_type",
|
||||
"title": "步骤类型",
|
||||
"type": "str",
|
||||
"length": 50,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "步骤类型"
|
||||
},
|
||||
{
|
||||
"name": "model_name",
|
||||
"title": "调用模型名称",
|
||||
"type": "str",
|
||||
"length": 100,
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "调用模型名称"
|
||||
},
|
||||
{
|
||||
"name": "step_config",
|
||||
"title": "步骤配置JSON",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "步骤配置JSON"
|
||||
},
|
||||
{
|
||||
"name": "input_schema",
|
||||
"title": "输入定义JSON",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "输入定义JSON"
|
||||
},
|
||||
{
|
||||
"name": "output_schema",
|
||||
"title": "输出定义JSON",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "输出定义JSON"
|
||||
},
|
||||
{
|
||||
"name": "timeout_seconds",
|
||||
"title": "超时秒数",
|
||||
"type": "int",
|
||||
"default": "300",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "超时秒数"
|
||||
},
|
||||
{
|
||||
"name": "retry_count",
|
||||
"title": "重试次数",
|
||||
"type": "int",
|
||||
"default": "0",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "重试次数"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "创建时间"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"page_rows":160,
|
||||
"cache_limit":5
|
||||
}
|
||||
|
||||
,"binds":[
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "pipelines",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "PopupWindow",
|
||||
"popup_options": {
|
||||
"title": "所属产线",
|
||||
"icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=pipelines",
|
||||
"resizable": true,
|
||||
"height": "70%",
|
||||
"width": "70%"
|
||||
},
|
||||
"params_mapping": {
|
||||
"mapping": {
|
||||
"id": "pipeline_id",
|
||||
"referer_widget": "referer_widget"
|
||||
},
|
||||
"need_other": false
|
||||
},
|
||||
"options": {
|
||||
"method": "POST",
|
||||
"params": {},
|
||||
"url": "{{entire_url('../pipelines')}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}]
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
|
||||
r = await sor.U('pipeline_steps', ns)
|
||||
debug('update success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Update Success",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
id = params_kw.id
|
||||
if not id or len(id) > 32:
|
||||
id = uuid()
|
||||
ns['id'] = id
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('pipeline_versions', ns.copy())
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"title":"Add Success",
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
}
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.D('pipeline_versions', ns)
|
||||
debug('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
debug('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,113 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
|
||||
|
||||
debug(f'get_pipeline_versions.dspy:{ns=}')
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
|
||||
|
||||
ns['sort'] = 'created_at'
|
||||
|
||||
|
||||
|
||||
sql = '''select a.*, b.pipeline_id_text
|
||||
from (select * from pipeline_versions where 1=1 [[filterstr]]) a left join (select id as pipeline_id,
|
||||
name as pipeline_id_text from pipelines where 1 = 1) b on a.pipeline_id = b.pipeline_id'''
|
||||
|
||||
filterjson = params_kw.get('data_filter')
|
||||
if filterjson and isinstance(filterjson, str):
|
||||
try:
|
||||
filterjson = json.loads(filterjson)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
filterjson = None
|
||||
fields_str=r'''[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"title": "版本号",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "publish_status",
|
||||
"title": "发布状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"default": "pending"
|
||||
},
|
||||
{
|
||||
"name": "published_by",
|
||||
"title": "发布人",
|
||||
"type": "str",
|
||||
"length": 32
|
||||
},
|
||||
{
|
||||
"name": "published_at",
|
||||
"title": "发布时间",
|
||||
"type": "timestamp"
|
||||
},
|
||||
{
|
||||
"name": "changelog",
|
||||
"title": "变更说明",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"name": "config_snapshot",
|
||||
"title": "配置快照JSON",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp"
|
||||
}
|
||||
]'''
|
||||
ori_fields = json.loads(fields_str)
|
||||
if not filterjson:
|
||||
fields = [ f['name'] for f in ori_fields ]
|
||||
filterjson = default_filterjson(fields, ns)
|
||||
|
||||
filterdic = ns.copy()
|
||||
filterdic['filterstr'] = ''
|
||||
filterdic['userorgid'] = '${userorgid}$'
|
||||
filterdic['userid'] = '${userid}$'
|
||||
if filterjson:
|
||||
dbf = DBFilter(filterjson)
|
||||
conds = dbf.gen(ns)
|
||||
if conds:
|
||||
ns.update(dbf.consts)
|
||||
conds = f' and {conds}'
|
||||
filterdic['filterstr'] = conds
|
||||
ac = ArgsConvert('[[', ']]')
|
||||
vars = ac.findAllVariables(sql)
|
||||
NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' }
|
||||
filterdic.update(NameSpace)
|
||||
sql = ac.convert(sql, filterdic)
|
||||
|
||||
debug(f'{sql=}')
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.sqlPaging(sql, ns)
|
||||
return r
|
||||
return {
|
||||
"total":0,
|
||||
"rows":[]
|
||||
}
|
||||
@ -1,210 +0,0 @@
|
||||
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{"cheight":40,"width":"100%"},
|
||||
"subwidgets":[{
|
||||
"id":"pipeline_versions_tbl",
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
|
||||
|
||||
"title":"产线发布记录表",
|
||||
|
||||
|
||||
|
||||
|
||||
"toolbar":{
|
||||
"tools": [
|
||||
{
|
||||
"selected_row": true,
|
||||
"name": "pipelines",
|
||||
"icon": "{{entire_url('/imgs/pipelines.svg')}}",
|
||||
"label": "所属产线"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"css":"card",
|
||||
|
||||
|
||||
"editable":{
|
||||
|
||||
"new_data_url":"{{entire_url('add_pipeline_versions.dspy')}}",
|
||||
|
||||
|
||||
"delete_data_url":"{{entire_url('delete_pipeline_versions.dspy')}}",
|
||||
|
||||
|
||||
"update_data_url":"{{entire_url('update_pipeline_versions.dspy')}}"
|
||||
|
||||
},
|
||||
|
||||
|
||||
"data_url":"{{entire_url('./get_pipeline_versions.dspy')}}",
|
||||
|
||||
"data_method":"GET",
|
||||
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
|
||||
"row_options":{
|
||||
|
||||
|
||||
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id",
|
||||
"config_snapshot"
|
||||
],
|
||||
"cwidth": {}
|
||||
},
|
||||
|
||||
|
||||
"editexclouded":[
|
||||
"id",
|
||||
"created_at"
|
||||
],
|
||||
|
||||
"fields":[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "id"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"label": "产线ID",
|
||||
"uitype": "code",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "pipelines",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "name",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"title": "版本号",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "版本号"
|
||||
},
|
||||
{
|
||||
"name": "publish_status",
|
||||
"title": "发布状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"default": "pending",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "发布状态"
|
||||
},
|
||||
{
|
||||
"name": "published_by",
|
||||
"title": "发布人",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "发布人"
|
||||
},
|
||||
{
|
||||
"name": "published_at",
|
||||
"title": "发布时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "发布时间"
|
||||
},
|
||||
{
|
||||
"name": "changelog",
|
||||
"title": "变更说明",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "变更说明"
|
||||
},
|
||||
{
|
||||
"name": "config_snapshot",
|
||||
"title": "配置快照JSON",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "配置快照JSON"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "创建时间"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"page_rows":160,
|
||||
"cache_limit":5
|
||||
}
|
||||
|
||||
,"binds":[
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "pipelines",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "PopupWindow",
|
||||
"popup_options": {
|
||||
"title": "所属产线",
|
||||
"icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=pipelines",
|
||||
"resizable": true,
|
||||
"height": "70%",
|
||||
"width": "70%"
|
||||
},
|
||||
"params_mapping": {
|
||||
"mapping": {
|
||||
"id": "pipeline_id",
|
||||
"referer_widget": "referer_widget"
|
||||
},
|
||||
"need_other": false
|
||||
},
|
||||
"options": {
|
||||
"method": "POST",
|
||||
"params": {},
|
||||
"url": "{{entire_url('../pipelines')}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}]
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
|
||||
r = await sor.U('pipeline_versions', ns)
|
||||
debug('update success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Update Success",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
id = params_kw.id
|
||||
if not id or len(id) > 32:
|
||||
id = uuid()
|
||||
ns['id'] = id
|
||||
|
||||
if params_kw.get('model_api_key'):
|
||||
ns['model_api_key'] = password_encode(params_kw.get('model_api_key'))
|
||||
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('pipelines', ns.copy())
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"title":"Add Success",
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
}
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.D('pipelines', ns)
|
||||
debug('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
debug('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,165 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
ns['userorgid'] = userorgid
|
||||
|
||||
debug(f'get_pipelines.dspy:{ns=}')
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
|
||||
|
||||
ns['sort'] = 'created_at'
|
||||
|
||||
|
||||
|
||||
sql = '''select a.*, b.pipeline_type_text, c.status_text
|
||||
from (select * from pipelines where 1=1 [[filterstr]]) a left join (select k as pipeline_type,
|
||||
v as pipeline_type_text from appcodes_kv where parentid='pipeline_type') b on a.pipeline_type = b.pipeline_type left join (select k as status,
|
||||
v as status_text from appcodes_kv where parentid='pipeline_status') c on a.status = c.status'''
|
||||
|
||||
filterjson = params_kw.get('data_filter')
|
||||
if filterjson and isinstance(filterjson, str):
|
||||
try:
|
||||
filterjson = json.loads(filterjson)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
filterjson = None
|
||||
fields_str=r'''[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"title": "产线名称",
|
||||
"type": "str",
|
||||
"length": 200,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"title": "产线描述",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_type",
|
||||
"title": "产线类型",
|
||||
"type": "str",
|
||||
"length": 50,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"title": "当前版本",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"default": "1.0.0"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"default": "draft"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_config",
|
||||
"title": "产线配置JSON",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"name": "model_api_url",
|
||||
"title": "模型API地址",
|
||||
"type": "str",
|
||||
"length": 500
|
||||
},
|
||||
{
|
||||
"name": "model_api_key",
|
||||
"title": "模型API密钥",
|
||||
"type": "str",
|
||||
"length": 500
|
||||
},
|
||||
{
|
||||
"name": "org_id",
|
||||
"title": "所属机构ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"title": "创建人",
|
||||
"type": "str",
|
||||
"length": 32
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp"
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"title": "更新时间",
|
||||
"type": "timestamp"
|
||||
}
|
||||
]'''
|
||||
ori_fields = json.loads(fields_str)
|
||||
if not filterjson:
|
||||
fields = [ f['name'] for f in ori_fields ]
|
||||
filterjson = default_filterjson(fields, ns)
|
||||
|
||||
# 确保 logined 过滤条件始终生效
|
||||
if filterjson:
|
||||
if not isinstance(filterjson, dict) or 'AND' not in filterjson:
|
||||
filterjson = {'AND': [filterjson] if filterjson else []}
|
||||
|
||||
filterjson['AND'].append({'field': 'org_id', 'op': '=', 'var': '__logined_orgid__'})
|
||||
ns['__logined_orgid__'] = userorgid
|
||||
|
||||
|
||||
|
||||
filterdic = ns.copy()
|
||||
filterdic['filterstr'] = ''
|
||||
filterdic['userorgid'] = '${userorgid}$'
|
||||
filterdic['userid'] = '${userid}$'
|
||||
if filterjson:
|
||||
dbf = DBFilter(filterjson)
|
||||
conds = dbf.gen(ns)
|
||||
if conds:
|
||||
ns.update(dbf.consts)
|
||||
conds = f' and {conds}'
|
||||
filterdic['filterstr'] = conds
|
||||
ac = ArgsConvert('[[', ']]')
|
||||
vars = ac.findAllVariables(sql)
|
||||
NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' }
|
||||
filterdic.update(NameSpace)
|
||||
sql = ac.convert(sql, filterdic)
|
||||
|
||||
debug(f'{sql=}')
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.sqlPaging(sql, ns)
|
||||
return r
|
||||
return {
|
||||
"total":0,
|
||||
"rows":[]
|
||||
}
|
||||
@ -1,244 +0,0 @@
|
||||
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{"cheight":40,"width":"100%"},
|
||||
"subwidgets":[{
|
||||
"id":"pipelines_tbl",
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
|
||||
|
||||
"title":"产线定义表",
|
||||
|
||||
|
||||
|
||||
|
||||
"css":"card",
|
||||
|
||||
|
||||
"toolbar":{
|
||||
"tools":[
|
||||
{
|
||||
"name":"publish",
|
||||
"label":"发布",
|
||||
"selected_row":true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"editable":{
|
||||
|
||||
"new_data_url":"{{entire_url('add_pipelines.dspy')}}",
|
||||
|
||||
|
||||
"delete_data_url":"{{entire_url('delete_pipelines.dspy')}}",
|
||||
|
||||
|
||||
"update_data_url":"{{entire_url('update_pipelines.dspy')}}"
|
||||
|
||||
},
|
||||
|
||||
|
||||
"data_url":"{{entire_url('./get_pipelines.dspy')}}",
|
||||
|
||||
"data_method":"GET",
|
||||
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
|
||||
"row_options":{
|
||||
|
||||
|
||||
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id",
|
||||
"model_api_key",
|
||||
"pipeline_config"
|
||||
],
|
||||
"cwidth": {}
|
||||
},
|
||||
|
||||
|
||||
"editexclouded":[
|
||||
"id",
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
|
||||
"fields":[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "id",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "id"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"title": "产线名称",
|
||||
"type": "str",
|
||||
"length": 200,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "产线名称"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"title": "产线描述",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "产线描述"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_type",
|
||||
"title": "产线类型",
|
||||
"type": "str",
|
||||
"length": 50,
|
||||
"nullable": "no",
|
||||
"label": "产线类型",
|
||||
"uitype": "code",
|
||||
"valueField": "pipeline_type",
|
||||
"textField": "pipeline_type_text",
|
||||
"params": {
|
||||
"dbname": "{{{{get_module_dbname('pipeline_core')}}}}",
|
||||
"table": "appcodes_kv",
|
||||
"tblvalue": "k",
|
||||
"tbltext": "v",
|
||||
"valueField": "pipeline_type",
|
||||
"textField": "pipeline_type_text",
|
||||
"cond": "parentid='pipeline_type'"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"title": "当前版本",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"default": "1.0.0",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "当前版本"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"default": "draft",
|
||||
"label": "状态",
|
||||
"uitype": "code",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"params": {
|
||||
"dbname": "{{{{get_module_dbname('pipeline_core')}}}}",
|
||||
"table": "appcodes_kv",
|
||||
"tblvalue": "k",
|
||||
"tbltext": "v",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"cond": "parentid='pipeline_status'"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_config",
|
||||
"title": "产线配置JSON",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "产线配置JSON"
|
||||
},
|
||||
{
|
||||
"name": "model_api_url",
|
||||
"title": "模型API地址",
|
||||
"type": "str",
|
||||
"length": 500,
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "模型API地址"
|
||||
},
|
||||
{
|
||||
"name": "model_api_key",
|
||||
"title": "模型API密钥",
|
||||
"type": "str",
|
||||
"length": 500,
|
||||
"cwidth": 18,
|
||||
"uitype": "password",
|
||||
"datatype": "str",
|
||||
"label": "模型API密钥"
|
||||
},
|
||||
{
|
||||
"name": "org_id",
|
||||
"title": "所属机构ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"default": "0",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "所属机构ID"
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"title": "创建人",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "创建人"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "创建时间"
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"title": "更新时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "更新时间"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"page_rows":160,
|
||||
"cache_limit":5
|
||||
}
|
||||
|
||||
,"binds":[{
|
||||
"wid":"self",
|
||||
"event":"publish",
|
||||
"actiontype":"script",
|
||||
"target":"self",
|
||||
"script":"var d=this.select_row.user_data;fetch('{{entire_url('../api/pipeline_publish.dspy')}}',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'pipeline_id='+encodeURIComponent(d.id)}).then(function(r){return r.json()}).then(function(r){if(r.success){this.render({})}else{bricks.show_error({title:'发布失败',message:r.message||'未知错误'})}}.bind(this))"
|
||||
}]
|
||||
|
||||
}]
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
|
||||
if params_kw.get('model_api_key'):
|
||||
ns['model_api_key'] = password_encode(params_kw.get('model_api_key'))
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_core')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
|
||||
ns1 = {
|
||||
|
||||
"org_id": userorgid,
|
||||
|
||||
|
||||
"id": params_kw.id
|
||||
}
|
||||
recs = await sor.R('pipelines', ns1)
|
||||
if len(recs) < 1:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"Record no exist or with wrong ownership"
|
||||
}
|
||||
}
|
||||
|
||||
r = await sor.U('pipelines', ns)
|
||||
debug('update success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Update Success",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1 +1 @@
|
||||
/d/apitest/pipeline-app/pkgs/pipeline_core/wwwroot
|
||||
../pkgs/pipeline_core/wwwroot
|
||||
@ -1 +1 @@
|
||||
/d/apitest/pipeline-app/pkgs/pipeline-task/wwwroot
|
||||
../pkgs/pipeline-task/wwwroot
|
||||
Loading…
x
Reference in New Issue
Block a user