fix: restore pipeline_submit in cockpit, fix _get_db/executor db config loading
This commit is contained in:
parent
fff34b04b3
commit
085d6154d3
@ -360,33 +360,14 @@ if action == 'send_message':
|
||||
title = intent.get('title', '') or message_text[:100]
|
||||
task_params = {'description': intent.get('description', ''), 'input_text': message_text}
|
||||
try:
|
||||
# Direct task creation
|
||||
task_id = getID()
|
||||
await sor.C('pipeline_tasks', {
|
||||
'id': task_id, 'tenant_id': org_id, 'pipeline_id': 'sdlc_general',
|
||||
'owner_id': uid, 'title': title, 'state': 'submitted',
|
||||
'params': json.dumps(task_params, ensure_ascii=False)
|
||||
})
|
||||
result = await pipeline_submit(org_id, 'sdlc_general', uid, title, task_params)
|
||||
rd = json.loads(result)
|
||||
if rd.get('success'):
|
||||
task_id = rd.get('task_id', '')
|
||||
await _save_context(sor, uid, pid, iid)
|
||||
|
||||
# Auto-execute: call LLM to work on the task
|
||||
task_msgs = [{"role": "system", "content": settings['system_prompt']}]
|
||||
task_msgs.append({"role": "user", "content": f"请完成以下开发任务:\n{title}\n\n{json.dumps(task_params, ensure_ascii=False)}"})
|
||||
try:
|
||||
result = await _call_llm(model_info, task_msgs, settings['temperature'])
|
||||
# Save deliverable
|
||||
did = getID()
|
||||
await sor.C('pipeline_deliverables', {
|
||||
'id': did, 'project_id': pid, 'task_id': task_id,
|
||||
'deliverable_type': 'code', 'title': title, 'content': result,
|
||||
'quality_score': 80, 'review_status': 'pending', 'created_by': 'agent'
|
||||
})
|
||||
await sor.sqlExe("UPDATE pipeline_tasks SET state='completed' WHERE id=${tid}$", {"tid": task_id})
|
||||
agent_reply = f"✅ 任务「{title}」已完成。\n\n{result[:1500]}"
|
||||
if len(result) > 1500:
|
||||
agent_reply += f"\n\n...(共{len(result)}字,完整内容已保存到交付件 {did})"
|
||||
except Exception as e2:
|
||||
agent_reply = f"✅ 任务「{title}」已创建({task_id}),但执行失败:{str(e2)[:200]}"
|
||||
agent_reply = f"✅ 任务「{title}」已提交({task_id}),产线开始执行。"
|
||||
else:
|
||||
agent_reply = f"任务提交失败:{rd.get('message', '未知错误')}"
|
||||
except Exception as e:
|
||||
agent_reply = f"任务提交失败:{str(e)[:200]}"
|
||||
elif intent_type == 'add_bug':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user