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
This commit is contained in:
2026-02-28 11:20:40 +08:00
parent 5aedf1665d
commit a6c42d505a
171 changed files with 7979 additions and 328 deletions

0
image/__init__.py Normal file → Executable file
View File

0
image/__pycache__/__init__.cpython-310.pyc Normal file → Executable file
View File

0
image/__pycache__/image_analyzer.cpython-310.pyc Normal file → Executable file
View File

0
image/__pycache__/image_precheck.cpython-310.pyc Normal file → Executable file
View File

0
image/__pycache__/image_processor.cpython-310.pyc Normal file → Executable file
View File

0
image/__pycache__/image_qa.cpython-310.pyc Normal file → Executable file
View File

95
image/image_analyzer.py Normal file → Executable file
View File

@@ -61,15 +61,39 @@ ANALYSIS_PROMPT = """你是一个电商图片处理评估专家,同时也是 G
- yes含小字需精细保留/清晰化(小字难处理 → 加价)
- no无文字或仅有大字大字没关系 → 不加价)
【文字数量加价规则】
- none无文字不加价
- 少量 (1-10 字)+5 元
- 中量 (11-50 字)+10-15 元
- 大量 (51-200 字)+20-30 元
- 极多 (200 字以上)+30-50 元
【文字分层需求】
- yes客户要求可编辑分层文件PSD 等) → 基础价格 x2 或 +50 元起
- no普通图片处理 → 正常价格
【文字分层 + 大量文字】
- 如果 文字数量=大量/极多 且 文字分层需求=yes → 总价可达 60-80 元
【含人脸】
- yes图中有真实人物面孔人像照/集体照/证件照/老照片等)
- no无人脸或人脸极小不影响主体
【风险评估】
- none印花/图案/logo/风景/产品AI处理效果稳定可直接报价
- low有人脸但清晰度尚可AI修复后人脸相似度70-90%建议先看效果
【风险评估 - 重要!
- none印花/图案/logo/风景/产品AI处理效果稳定可直接报价接单
- low有人脸但清晰度尚可AI修复后人脸相似度70-90%可以接单但要说明风险
- high以下任一情况 → 严重模糊的人脸照片/老照片人像/需要打印/客户问能否找回原图
high情况下可做改为partial备注写明风险话术
high情况下可做改为partial备注写明风险话术,谨慎接单
【敏感内容检测 - 必须严格判断!】
- yes含以下任一内容 → 色情/黄色/擦边/裸露/性暗示/大尺度/涉政/暴力/血腥/违禁品
敏感内容=yes 时,可做必须填 no直接拒绝不接单
- no无上述敏感内容可以正常接单处理
【可做判断 - 决定是否接单】
- yes效果有把握可以接单处理
- partial能处理但有明显限制人脸变形风险/分辨率极低/严重损坏)→ 可以接单但要说明风险
- no无法接单纯黑/纯白/完全损坏/找原始 RAW 文件/敏感内容/违法内容)
【敏感内容】优先判断,若为 yes 则 可做 必填 no
- yes图片含色情/黄色/擦边/裸露/性暗示/大尺度等违规内容
@@ -170,6 +194,7 @@ class ImageAnalyzer:
"complex": (20, 25, "细节偏多"),
"hard": (25, 30, "非常复杂"),
}
# 注意:含文字很多时,不能报 simple/normal 的低价,必须 complex 起步
def __init__(self):
self.api_key = os.getenv("OPENAI_API_KEY")
@@ -525,10 +550,64 @@ class ImageAnalyzer:
if feasibility not in ("yes", "partial", "no"):
feasibility = "yes"
# 【重要】含文字很多时,不能低价,必须 complex 起步20 元以上)
# 有文字跟没文字是两个价格
if has_text == "yes":
if complexity == "simple":
# 简单但含文字 → 提升到 normal 价格
price_min, price_max = self.PRICE_MAP["normal"]
reason = "含文字,需精细处理"
elif complexity == "normal":
# normal 含文字 → 提升到 complex 价格
price_min, price_max = self.PRICE_MAP["complex"]
reason = "含文字,需精细处理"
# complex/hard 保持原价,已经够高
# 建议报价complex/hard 取固定值simple/normal 取中间且必须为5的整数倍
raw = price_max if complexity in ("complex", "hard") else (price_min + price_max) // 2
price_suggest = round(raw / 5) * 5
# 【文字数量加价】
text_surcharge = 0
if text_amount == "少量 (1-10 字)":
text_surcharge = 5
reason += " | 含少量文字"
elif text_amount == "中量 (11-50 字)":
text_surcharge = 15
reason += " | 含中量文字"
elif text_amount == "大量 (51-200 字)":
text_surcharge = 30
reason += " | 含大量文字"
elif text_amount == "极多 (200 字以上)":
text_surcharge = 50
reason += " | 含极多文字"
# 【文字分层需求加价】
layer_surcharge = 0
if text_layer_need == "yes":
if text_surcharge > 0:
# 有文字且需要分层 → 价格 x2 或 +50 元
layer_surcharge = max(50, price_suggest)
reason += " | 需要文字分层"
else:
# 无文字但需要分层 → +30 元
layer_surcharge = 30
reason += " | 需要分层文件"
# 加上文字加价
price_suggest += text_surcharge + layer_surcharge
# 【文字分层 + 大量文字】特殊处理 → 60-80 元
if text_amount in ["大量 (51-200 字)", "极多 (200 字以上)"] and text_layer_need == "yes":
if price_suggest < 60:
price_suggest = 60
elif price_suggest > 80:
price_suggest = 80
reason += " | 大量文字分层"
# 确保是 5 的倍数
price_suggest = round(price_suggest / 5) * 5
if sensitive == "yes":
feasibility = "no"
note = "图片含敏感内容,不接单"
@@ -549,6 +628,10 @@ class ImageAnalyzer:
"quality": quality,
"flatness": flatness if flatness in ("flat", "mild", "rough") else "",
"has_text": has_text if has_text in ("yes", "no") else "no",
"text_amount": text_amount,
"text_layer_need": text_layer_need,
"text_surcharge": text_surcharge,
"layer_surcharge": layer_surcharge,
"has_face": has_face, # yes / no
"has_shadow": has_shadow if has_shadow in ("yes", "no") else "no",
"risk": risk, # none / low / high
@@ -574,6 +657,10 @@ class ImageAnalyzer:
"quality": "",
"flatness": "",
"has_text": "no",
"text_amount": text_amount,
"text_layer_need": text_layer_need,
"text_surcharge": text_surcharge,
"layer_surcharge": layer_surcharge,
"has_face": "no",
"has_shadow": "no",
"risk": "none",

0
image/image_precheck.py Normal file → Executable file
View File

0
image/image_processor.py Normal file → Executable file
View File

0
image/image_qa.py Normal file → Executable file
View File

0
image/image_tools.py Normal file → Executable file
View File

0
image/perspective_fix.py Normal file → Executable file
View File