refactor(team-communication): 迁移改 current_handler 两列 + 移除配置表种子/菜单
- create_tables.py: 加 current_handler_role/agentid,废弃 escalation_path/pos 清理 - init_data.py: 移除团队角色/问题类型种子(保留 getConfig 根目录修复) - index.ui: 移除团队角色/问题类型菜单项
This commit is contained in:
parent
da41f6be1b
commit
f8c4b1bfd6
@ -58,36 +58,6 @@ SDLC_STEPS = [
|
||||
]
|
||||
|
||||
|
||||
# ---- 团队沟通(通用问题冒泡):sdlc_general 产线的团队角色 + 问题类型 ----
|
||||
TEAM_ROLE_TYPE_CODES = [
|
||||
# (k, v)
|
||||
('agent', 'Agent'),
|
||||
('human', '人'),
|
||||
]
|
||||
|
||||
SDLC_TEAM_ROLES = [
|
||||
# (role_name, agentid, role_type, display_name, description)
|
||||
('main_agent', '', 'agent', '主Agent', '用户面对话agent,回答问题、路由到客户'),
|
||||
('pm', '', 'agent', '项目经理', '审核交付件、退回意见'),
|
||||
('requirement', '', 'agent', '需求分析师', '产出需求规格文档'),
|
||||
('design', '', 'agent', '系统设计师', '产出架构/DB/API设计'),
|
||||
('develop', '', 'agent', '开发工程师', '产出可运行源码'),
|
||||
('test', '', 'agent', '测试工程师', '产出测试用例+报告'),
|
||||
('deploy', '', 'agent', '部署运维', '产出部署文档+配置'),
|
||||
('customer', '', 'human', '客户', '人类客户,最终兜底'),
|
||||
]
|
||||
|
||||
SDLC_PROBLEM_TYPES = [
|
||||
# (name, title, description, escalation_path)
|
||||
('need_info', '缺信息提问', '角色agent缺关键信息向上提问',
|
||||
'["main_agent", "customer"]'),
|
||||
('review_reject', '审核退回', 'PM审核退回意见,被退角色响应后复审',
|
||||
'["pm"]'),
|
||||
('fault_report', '故障报告', '任务失败报障,人工介入',
|
||||
'["main_agent", "customer"]'),
|
||||
]
|
||||
|
||||
|
||||
async def init_data(demo=False):
|
||||
# getConfig 接收应用根目录(内部拼接 conf/config.json),非 config 文件路径
|
||||
config = getConfig(ROOT_DIR, NS={'workdir': ROOT_DIR, 'ProgramPath': ProgramPath()})
|
||||
@ -143,55 +113,7 @@ async def init_data(demo=False):
|
||||
else:
|
||||
print(f' SKIP {SDLC_PIPELINE["name"]} (exists)')
|
||||
|
||||
# 3. 团队沟通:角色类型代码表 + sdlc_general 团队角色 + 问题类型
|
||||
print('\nTeam communication:')
|
||||
for k, v in TEAM_ROLE_TYPE_CODES:
|
||||
existing = await sor.sqlExe(
|
||||
"SELECT id FROM appcodes_kv WHERE parentid='team_role_type' AND k=${k}$", {'k': k})
|
||||
if not existing:
|
||||
await sor.C('appcodes_kv', {'id': getID(), 'parentid': 'team_role_type', 'k': k, 'v': v})
|
||||
print(f' ADD code team_role_type.{k}')
|
||||
|
||||
# 确保 sdlc_general 产线存在(能力包注册的产线 id)
|
||||
existing = await sor.sqlExe("SELECT id FROM pipelines WHERE id='sdlc_general'", {})
|
||||
if not existing:
|
||||
await sor.C('pipelines', {
|
||||
'id': 'sdlc_general', 'name': '通用软件开发产线',
|
||||
'description': 'SDLC 开发产线(能力包注册)',
|
||||
'pipeline_type': 'dev', 'status': 'published', 'version': '1.0',
|
||||
'org_id': '0', 'created_by': 'system',
|
||||
'created_at': timestampstr(), 'updated_at': timestampstr(),
|
||||
})
|
||||
print(' ADD pipeline sdlc_general')
|
||||
|
||||
for rname, aid, rtype, dname, desc in SDLC_TEAM_ROLES:
|
||||
existing = await sor.sqlExe(
|
||||
"SELECT id FROM pipeline_team_roles WHERE pipeline_id='sdlc_general' AND role_name=${r}$",
|
||||
{'r': rname})
|
||||
if existing:
|
||||
continue
|
||||
await sor.C('pipeline_team_roles', {
|
||||
'id': getID(), 'pipeline_id': 'sdlc_general',
|
||||
'role_name': rname, 'agentid': aid, 'role_type': rtype,
|
||||
'display_name': dname, 'description': desc,
|
||||
'created_at': timestampstr(),
|
||||
})
|
||||
print(f' ADD role {rname}')
|
||||
|
||||
for pname, ptitle, pdesc, ppath in SDLC_PROBLEM_TYPES:
|
||||
existing = await sor.sqlExe(
|
||||
"SELECT id FROM pipeline_problem_types WHERE pipeline_id='sdlc_general' AND name=${n}$",
|
||||
{'n': pname})
|
||||
if existing:
|
||||
continue
|
||||
await sor.C('pipeline_problem_types', {
|
||||
'id': getID(), 'pipeline_id': 'sdlc_general',
|
||||
'name': pname, 'title': ptitle, 'description': pdesc,
|
||||
'escalation_path': ppath, 'created_at': timestampstr(),
|
||||
})
|
||||
print(f' ADD problem_type {pname}')
|
||||
|
||||
# 4. Demo data
|
||||
# 3. Demo data
|
||||
if demo:
|
||||
print('\nDemo data:')
|
||||
await _create_demo(sor)
|
||||
|
||||
@ -110,15 +110,15 @@ async def main():
|
||||
except Exception as e:
|
||||
print(f' WARN: appbase params ensure failed: {e}')
|
||||
|
||||
# pipeline_agent_questions 团队沟通列幂等迁移(多 agent 感知冒泡引擎)
|
||||
# pipeline_agent_questions 团队沟通列幂等迁移(显式路由版:current_handler 两列替代 escalation 路径快照)
|
||||
try:
|
||||
_q_cols = {
|
||||
_add_cols = {
|
||||
"from_agentid": "VARCHAR(64) NULL COMMENT '提问Agent标识'",
|
||||
"problem_type": "VARCHAR(50) NULL COMMENT '问题类型'",
|
||||
"escalation_path": "TEXT NULL COMMENT '冒泡路径(JSON角色/agent数组快照)'",
|
||||
"escalation_pos": "INT NOT NULL DEFAULT 0 COMMENT '当前冒泡位置'",
|
||||
"current_handler_role": "VARCHAR(32) NULL COMMENT '当前处理角色'",
|
||||
"current_handler_agentid": "VARCHAR(64) NULL COMMENT '当前处理Agent标识(空=该角色任意)'",
|
||||
}
|
||||
for col, ddl in _q_cols.items():
|
||||
for col, ddl in _add_cols.items():
|
||||
r = await sor.sqlExe(
|
||||
"SELECT COUNT(*) as c FROM information_schema.COLUMNS "
|
||||
"WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='pipeline_agent_questions' "
|
||||
@ -127,6 +127,16 @@ async def main():
|
||||
if not r or getattr(r[0], 'c', 0) == 0:
|
||||
await sor.execute(
|
||||
f"ALTER TABLE pipeline_agent_questions ADD COLUMN {col} {ddl}", {})
|
||||
# 废弃列清理(早期路径快照方案,已改为显式 handler)
|
||||
for col in ["escalation_path", "escalation_pos"]:
|
||||
r = await sor.sqlExe(
|
||||
"SELECT COUNT(*) as c FROM information_schema.COLUMNS "
|
||||
"WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='pipeline_agent_questions' "
|
||||
"AND COLUMN_NAME=${col}$", {"col": col})
|
||||
await sor.sqlExe("COMMIT", {})
|
||||
if r and getattr(r[0], 'c', 0) > 0:
|
||||
await sor.execute(
|
||||
f"ALTER TABLE pipeline_agent_questions DROP COLUMN {col}", {})
|
||||
print(' migrate: pipeline_agent_questions team-communication columns ensured')
|
||||
except Exception as e:
|
||||
print(f' WARN: pipeline_agent_questions migrate failed: {e}')
|
||||
|
||||
@ -98,18 +98,6 @@
|
||||
"icon": "",
|
||||
"script": "this.open_tab({name:'llm_manage',label:'模型管理',url:'/pipeline_core/llm',removable:true})"
|
||||
},
|
||||
{
|
||||
"name": "team_roles",
|
||||
"label": "团队角色",
|
||||
"icon": "",
|
||||
"script": "this.open_tab({name:'team_roles',label:'团队角色',url:'/pipeline_core/pipeline_team_roles',removable:true})"
|
||||
},
|
||||
{
|
||||
"name": "problem_types",
|
||||
"label": "问题类型",
|
||||
"icon": "",
|
||||
"script": "this.open_tab({name:'problem_types',label:'问题类型',url:'/pipeline_core/pipeline_problem_types',removable:true})"
|
||||
},
|
||||
{
|
||||
"name": "generic_agent",
|
||||
"label": "通用助手",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user