docs(gateway): 标注图目录改为 crontab 每日清理旧文案同步

app.py 启动日志与 reqlog 注释原写「永久保留,不自动清理」,实际已配置
crontab 每天 03:00 清理 static/annotations 超过 30 天的文件
This commit is contained in:
xsl
2026-09-22 23:51:39 +08:00
parent 12a825315a
commit 6f46fc0ccd
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -65,10 +65,10 @@ async def lifespan(app: FastAPI):
else:
app.state._pool_shutdown = None
# 确保标注图目录存在(永久保留,不做定期清理)
# 确保标注图目录存在(超过 30 天的文件由 crontab 每天 03:00 清理)
static_dir = Path(cfg["static_dir"])
static_dir.mkdir(parents=True, exist_ok=True)
logger.info("标注图目录: %s(永久保留,不自动清理)", static_dir)
logger.info("标注图目录: %s(>30 天文件由 crontab 每日清理)", static_dir)
yield
+2 -2
View File
@@ -2,7 +2,7 @@
设计原则(与用户约定):
- 入参/出参日志里**绝不内嵌图片 base64**。图片统一存盘后用 URL 引用,保持日志短小。
- 入参图片(image_file / *_base64)补存到 static_dir(in_ 前缀),永久保留;
- 入参图片(image_file / *_base64)补存到 static_dir(in_ 前缀);
url 输入图本身就在远端,不重新下载,直接记 URL。
- 出参响应在 forward.py 已把 base64 改写成 *_url(无大图),记录完整 data,
但用递归摘要器截断超长结构(landmarks、长字符串),单条上限 ~8KB。
@@ -39,7 +39,7 @@ def save_image_bytes(
"""把图片字节存盘并返回公网 URL。失败返回 None(不抛异常)。
存到 static_dir/{prefix}{uuid}.{ext},URL = {public_base_url}/static/annotations/{file}。
与 forward.py 的 rewrite_base64_to_url 落盘路径/URL 规则一致;文件永久保留,不自动清理。
与 forward.py 的 rewrite_base64_to_url 落盘路径/URL 规则一致;超过 30 天的文件由 crontab 每日清理。
"""
if not data:
return None