fix(ui): sync_events 查询补 JOIN sync_videos 取 camera_name(修 1054 报错);feat(缩略图): Oracle 处理成功后抽首帧存 thumbs/{id}.jpg + /api/oracle/video/{id}/thumb 带 token 接口;fam-ui 视频会话显示缩略图(oracle_url+token);start_ui.sh 注入 .env

This commit is contained in:
ericwyuan
2026-08-21 13:37:23 +08:00
parent b7b5fe6f0b
commit 41485072bf
5 changed files with 74 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ API-Gateway - Flask 蓝图(新架构 v2
"""
import os
from flask import Blueprint, request, jsonify
from flask import Blueprint, request, jsonify, send_file
from ..logger import setup_logger
from .. import state
@@ -116,6 +116,20 @@ def chat_ask():
return jsonify({"answer": answer, "provider": provider}), 200
@api_bp.route('/api/oracle/video/<int:video_id>/thumb', methods=['GET'])
def video_thumb(video_id):
"""返回视频首帧缩略图token 校验,不公网裸奔)。
缩略图由 video_processor 处理成功后生成于 /opt/fam-edge/thumbs/{video_id}.jpg。
"""
if not _check_token():
return jsonify({"error": "unauthorized"}), 401
path = f"/opt/fam-edge/thumbs/{video_id}.jpg"
if not os.path.isfile(path):
return jsonify({"error": "thumb_not_found"}), 404
return send_file(path, mimetype='image/jpeg')
@api_bp.route('/health', methods=['GET'])
def health():
"""健康检查"""