feat: 新增物料/入库单实时 CLIP 向量提取(新建+更新),修复 I/O 延迟和路径解析静默失败

This commit is contained in:
DXC
2026-05-25 10:04:32 +08:00
parent ee9b19e72a
commit 1da4b454cd
10 changed files with 100 additions and 3 deletions

View File

@ -9,6 +9,7 @@ from sqlalchemy import or_, func, text, and_
from sqlalchemy.exc import IntegrityError
import traceback
import json
from app.utils.ai_vision import extract_and_embed
class BuyInboundService:
@ -177,6 +178,9 @@ class BuyInboundService:
arrival_photo=json.dumps(data.get('arrival_photo', [])),
inspection_report=json.dumps(data.get('inspection_report', []))
)
# 实时提取到货图片向量(失败不影响业务)
if new_stock.arrival_photo:
new_stock.arrival_image_embedding = extract_and_embed(new_stock.arrival_photo)
db.session.add(new_stock)
db.session.commit()
return new_stock