feat(shipping_notice): 完成货代发货通知全流程功能迭代与重构
主要变更: 1. 移除废弃的发货通知字段抽取独立Workflow Agent相关代码 2. 重构Dify服务调用,新增inputs参数支持注入环境变量配置的工具API地址与密钥 3. 新增auto_progress工具API与checkpoint catalog接口,支持流程自动推进 4. 统一字段命名,将column_mapping_json改为map_json并兼容旧有调用 5. 重构库存匹配、解析结果的展示格式,改为标准化多语言Markdown表格 6. 新增ODM ID库存字段支持,优化库存解析与映射逻辑 7. 新增LibreOffice转换隔离Profile配置,避免多实例运行冲突 8. 新增完整环境变量配置、数据库迁移脚本与测试用例 9. 适配前端代码,更新字段命名与聊天跳转逻辑 10. 更新OpenAPI规范适配Dify工具调用,删除已归档的旧部署文档
This commit is contained in:
1 parent
2ce5256483
commit
c18c0394d0
50 files changed
+6088
-2407
No files matched your search
@@ -12,6 +12,8 @@ from __future__ import annotations
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
|
||||
def soffice_timeout_sec() -> int:
|
||||
@@ -46,6 +48,15 @@ def find_soffice() -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
def use_isolated_soffice_profile() -> bool:
|
||||
raw = str(os.environ.get("EDKB_SOFFICE_ISOLATED_PROFILE", "1")).strip().lower()
|
||||
return raw not in {"0", "false", "no"}
|
||||
|
||||
|
||||
def _new_soffice_profile_dir() -> Path:
|
||||
return Path(tempfile.mkdtemp(prefix="lo-profile-")).resolve()
|
||||
|
||||
|
||||
def run_soffice(cmd: list[str]) -> subprocess.CompletedProcess[str]:
|
||||
"""
|
||||
执行 soffice 命令并强制超时。
|
||||
@@ -80,8 +91,14 @@ def convert_with_soffice(
|
||||
:param convert_to: 目标格式,如 docx / pdf / xlsx / pptx
|
||||
"""
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
profile_dir: Path | None = None
|
||||
profile_arg: str | None = None
|
||||
if use_isolated_soffice_profile():
|
||||
profile_dir = _new_soffice_profile_dir()
|
||||
profile_arg = f"-env:UserInstallation={profile_dir.as_uri()}"
|
||||
cmd = [
|
||||
soffice,
|
||||
*( [profile_arg] if profile_arg else [] ),
|
||||
"--headless",
|
||||
"--convert-to",
|
||||
convert_to,
|
||||
@@ -89,4 +106,8 @@ def convert_with_soffice(
|
||||
"--outdir",
|
||||
str(out_dir),
|
||||
]
|
||||
return run_soffice(cmd)
|
||||
try:
|
||||
return run_soffice(cmd)
|
||||
finally:
|
||||
if profile_dir is not None:
|
||||
shutil.rmtree(profile_dir, ignore_errors=True)
|
||||
Reference in new issue
Block a user