refactor(backend): dify, minio等迁移到integration,清除无效文件
This commit is contained in:
1 parent
7fe7a39384
commit
faa554ade4
90 files changed
+7540
-9649
No files matched your search
@@ -2,7 +2,7 @@
|
||||
backend/app/services/shipping_notice/fulfillment_audit.py
|
||||
|
||||
用途:履约关键节点与敏感访问写入统一审计事件的轻量封装。
|
||||
依赖:audit_service.append_shipping_audit_event、Flask g.request_id / request、AppError、db.session。
|
||||
依赖:audit_service.append_shipping_audit_event、Flask g.request_id、core.http_context、AppError、db.session。
|
||||
逻辑:由 candidate / decision / fulfillment_workflow / workspace 读取与导出 / Workflow 写路径调用;
|
||||
默认 strict=True;审计写入包在 SAVEPOINT 内,失败不污染外层业务事务;
|
||||
strict=False 时仅记日志(门禁路径用,禁止审计打断匹配等业务结果);
|
||||
@@ -37,10 +37,11 @@ def _client_request_context() -> tuple[str | None, str | None]:
|
||||
核心逻辑:优先 X-Forwarded-For 首段;无请求上下文时返回 (None, None)。
|
||||
"""
|
||||
try:
|
||||
from flask import request
|
||||
forwarded = str(request.headers.get('X-Forwarded-For') or '').split(',')[0].strip()
|
||||
ip = forwarded or str(request.remote_addr or '').strip() or None
|
||||
ua = str(request.headers.get('User-Agent') or '').strip() or None
|
||||
from app.core.http_context import header, remote_addr
|
||||
|
||||
forwarded = header('X-Forwarded-For').split(',')[0].strip()
|
||||
ip = forwarded or remote_addr() or None
|
||||
ua = header('User-Agent').strip() or None
|
||||
return ip, ua
|
||||
except RuntimeError:
|
||||
return None, None
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
services/shipping_notice/i18n.py
|
||||
|
||||
用途:维护发货通知链路的多语言文案与语言解析工具。
|
||||
依赖:Flask request 上下文、模块内 `_MESSAGES` 文案字典。
|
||||
依赖:core.http_context、模块内 `_MESSAGES` 文案字典。
|
||||
逻辑:由 parse_summary、field_alignment_summary、workflow 提示文案等上游模块调用本文件输出用户可读消息。
|
||||
"""
|
||||
|
||||
@@ -10,7 +10,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from flask import has_request_context, request
|
||||
from app.core.http_context import has_http_request, header
|
||||
|
||||
SUPPORTED_LANGS = ("zh", "en", "th")
|
||||
|
||||
@@ -422,11 +422,11 @@ def resolve_lang(payload: dict[str, Any] | None = None) -> str:
|
||||
if val:
|
||||
return normalize_lang(val)
|
||||
|
||||
if has_request_context():
|
||||
hdr = str(request.headers.get("X-Lang") or "").strip()
|
||||
if has_http_request():
|
||||
hdr = header("X-Lang").strip()
|
||||
if hdr:
|
||||
return normalize_lang(hdr)
|
||||
accept = str(request.headers.get("Accept-Language") or "").strip()
|
||||
accept = header("Accept-Language").strip()
|
||||
if accept:
|
||||
return normalize_lang(accept.split(",")[0].strip())
|
||||
return "zh"
|
||||
|
||||
@@ -24,7 +24,7 @@ from app import db
|
||||
from app.core.config.settings import Config
|
||||
from app.core.errors import ConflictError, NotFoundError, ValidationError
|
||||
from app.models import Agent, ShippingOrderReviewCase, ShippingOrderReviewSuggestion
|
||||
from app.services.dify import DifyService
|
||||
from app.services.integrations.dify import DifyService
|
||||
from app.services.shipping_notice.agent_resolver import resolve_chat_agent
|
||||
from app.services.shipping_notice.fulfillment_audit import record_fulfillment_audit
|
||||
from app.services.shipping_notice.order_review_draft_service import (
|
||||
|
||||
@@ -8,7 +8,7 @@ from app import db
|
||||
from app.models import ShippingReceiptNotificationDelivery, ShippingReceiptReportFile, User
|
||||
from app.services.file_assets.storage import file_asset_storage
|
||||
from app.services.shipping_notice.audit_service import append_shipping_audit_event
|
||||
from app.services.wecom_notify import send_wecom_file_message, send_wecom_textcard_message, upload_wecom_temp_media
|
||||
from app.services.integrations.wecom.notify import send_wecom_file_message, send_wecom_textcard_message, upload_wecom_temp_media
|
||||
|
||||
|
||||
def _recipient_ids(report_file: ShippingReceiptReportFile) -> list[int]:
|
||||
|
||||
@@ -367,7 +367,7 @@ def _release_alert_send_lock(*, previous_state: dict[str, Any]) -> None:
|
||||
|
||||
|
||||
def _send_alert_to_recipients(*, title: str, content: str) -> bool:
|
||||
from app.services.wecom_notify import send_wecom_event_message
|
||||
from app.services.integrations.wecom.notify import send_wecom_event_message
|
||||
|
||||
recipients = _alert_recipients()
|
||||
if not recipients:
|
||||
|
||||
Reference in new issue
Block a user