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 ProductInboundService:
@ -183,6 +184,9 @@ class ProductInboundService:
sale_price=float(data.get('sale_price') or 0),
order_id=data.get('order_id')
)
# 实时提取成品实拍图向量(失败不影响业务)
if new_stock.product_photo:
new_stock.arrival_image_embedding = extract_and_embed(new_stock.product_photo)
db.session.add(new_stock)
db.session.commit()
return new_stock