Files
tw/run_tianwang_simple.py
ZuoWei a6c42d505a feat: 完整功能部署 v1.0
新增功能:
- 天网协作系统 (HTTP API 端口 6060)
- 三种工作流 (查找图片/处理图片/转人工派单)
- 图片任务数据库 (支持客户后续增加需求)
- 图绘派单系统集成 (API: 8005)
- 文字检测与加价 (60-80 元高价值订单)
- 风险评估与接单判断
- 作图失败自动转人工

新增文档:
- 项目功能汇总.md
- 三种工作流功能说明.md
- 文字加价功能说明.md
- 风险评估功能说明.md
- 图片任务数据库功能说明.md
- 图绘派单系统集成说明.md
- 作图失败转接人工说明.md
- DEPLOYMENT.md
- TIANWANG_INTEGRATION.md

核心修改:
- core/pydantic_ai_agent.py
- core/workflow.py
- core/websocket_client.py
- image/image_analyzer.py
- services/service_tuhui_dispatch.py
- db/image_tasks_db.py

版本:v1.0
日期:2026-02-28
2026-02-28 11:20:40 +08:00

61 lines
1.7 KiB
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
天网协作版 - 简化版(仅 HTTP API + 任务调度,不含 AI Agent
"""
import sys
import os
import logging
import signal
from pathlib import Path
_root = Path(__file__).resolve().parent
if str(_root) not in sys.path:
sys.path.insert(0, str(_root))
logging.basicConfig(
level=logging.INFO,
format='[%(asctime)s] %(levelname)s: %(message)s'
)
logger = logging.getLogger(__name__)
def main():
logger.info("=" * 60)
logger.info("天网协作版 - HTTP API 服务器")
logger.info("=" * 60)
# 1. 启动 HTTP API 服务器
from api.http_server import start_http_server
http_thread = start_http_server(host='0.0.0.0', port=6060)
logger.info("HTTP API 服务器已启动http://0.0.0.0:5678")
logger.info("")
logger.info("天网任务接口:")
logger.info(" POST /api/task/receive - 接收任务")
logger.info(" POST /api/task/cancel - 取消任务")
logger.info(" GET /api/task/status/:id - 查询任务状态")
logger.info(" GET /api/task/list - 任务列表")
logger.info(" GET /api/health - 健康检查")
logger.info("=" * 60)
logger.info("系统已就绪,等待天网任务...")
logger.info("")
# 注册信号处理
def signal_handler(signum, frame):
logger.info("收到退出信号")
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
# 保持运行
try:
while True:
import time
time.sleep(1)
except KeyboardInterrupt:
logger.info("已停止")
if __name__ == "__main__":
main()