update
This commit is contained in:
@@ -29,6 +29,7 @@ from app.modules.work_assistant.personnel_profile import ProfileRequest, review_
|
||||
from app.modules.work_assistant.sales_review import SalesRequest, review_sales, RULE_VERSION as SALES_RULE
|
||||
from app.modules.work_assistant.bid_writing import BidStep, bid_step, RULE_VERSION as BID_RULE
|
||||
from app.modules.work_assistant.bid_queue import bid_queue
|
||||
from app.modules.work_assistant.submission_advice import AdviceRequest, review_advice
|
||||
|
||||
|
||||
def require_pms_bridge(x_work_assistant_key: Annotated[str | None, Header()] = None) -> None:
|
||||
@@ -42,6 +43,19 @@ def require_pms_bridge(x_work_assistant_key: Annotated[str | None, Header()] = N
|
||||
router = APIRouter(dependencies=[Depends(require_pms_bridge)])
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@router.post('/submission-advice')
|
||||
def submission_advice(payload: AdviceRequest) -> dict:
|
||||
token = background_review.set(True)
|
||||
try:
|
||||
return review_advice(payload)
|
||||
except ModelUnavailable as exc:
|
||||
raise HTTPException(503, '业务提示暂未完成,仍可按原流程提交') from exc
|
||||
except (ValueError, TypeError) as exc:
|
||||
logger.warning('submission_advice_failed type=%s', type(exc).__name__)
|
||||
raise HTTPException(502, '提示依据尚未核对通过,仍可按原流程提交') from exc
|
||||
finally:
|
||||
background_review.reset(token)
|
||||
|
||||
from app.modules.work_assistant.message_push import PushPreviewRequest, generate_preview
|
||||
from app.modules.work_assistant.message_push_feishu import dispatch_feishu
|
||||
|
||||
|
||||
Reference in New Issue
Block a user