feat(fish_api): add FishAction folder watch via Pydantic settings

Add ACTION_WATCH_* settings, background watch loop in FastAPI lifespan,
and shared action_watch service that updates app_state. Add fish-action-watch
CLI and optional FishAction watch_folder_predict.py for standalone use.

Made-with: Cursor
This commit is contained in:
zaiun xu
2026-04-08 19:54:18 +08:00
parent 9df21f80ef
commit d0c53068dd
6 changed files with 530 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
"""独立进程:仅根据 .env / 环境变量中的 action_watch_dir 跑目录监控(不启动 FastAPI"""
from __future__ import annotations
import asyncio
import sys
from app.services.action_watch import run_action_watch_loop
from app.settings import get_settings
def main() -> None:
s = get_settings()
if s.action_watch_dir is None:
print(
"未配置监控目录:请在 .env 中设置 ACTION_WATCH_DIR=/你的/mp4/目录",
file=sys.stderr,
)
raise SystemExit(1)
asyncio.run(run_action_watch_loop(s))
if __name__ == "__main__":
main()