From 6c344f776fa67d794ba75411d828bc325cd6698d Mon Sep 17 00:00:00 2001 From: jingrow Date: Thu, 30 Oct 2025 23:16:50 +0800 Subject: [PATCH] =?UTF-8?q?dramatiq=E5=A2=9E=E5=8A=A0watch=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=83=AD=E9=87=8D=E8=BD=BD=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=9B=91=E6=8E=A7apps=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jingrow/jingrow/config.py | 1 + apps/jingrow/jingrow/dramatiq.py | 5 +++++ apps/jingrow/pyproject.toml | 2 ++ package.json | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/jingrow/jingrow/config.py b/apps/jingrow/jingrow/config.py index 5e1be46..998c1db 100644 --- a/apps/jingrow/jingrow/config.py +++ b/apps/jingrow/jingrow/config.py @@ -46,6 +46,7 @@ class Settings(BaseSettings): # 异步任务队列(Dramatiq)配置 worker_processes: int = 1 worker_threads: int = 1 + watch: bool = True class Config: env_file = str(Path(__file__).resolve().parents[3] / '.env') diff --git a/apps/jingrow/jingrow/dramatiq.py b/apps/jingrow/jingrow/dramatiq.py index 0df7409..6b268c0 100644 --- a/apps/jingrow/jingrow/dramatiq.py +++ b/apps/jingrow/jingrow/dramatiq.py @@ -20,6 +20,11 @@ def main() -> None: "--threads", str(threads), ] + # 仅从 Config.watch 控制是否启用 watch,目录固定为 apps 根目录 + if bool(getattr(Config, "watch", False)): + current_dir = os.path.dirname(__file__) + apps_dir = os.path.abspath(os.path.join(current_dir, "..", "..")) + args.extend(["--watch", apps_dir]) os.execvp("dramatiq", args) diff --git a/apps/jingrow/pyproject.toml b/apps/jingrow/pyproject.toml index f5a6bd2..c4c0cd2 100644 --- a/apps/jingrow/pyproject.toml +++ b/apps/jingrow/pyproject.toml @@ -9,4 +9,6 @@ dependencies = [ "pydantic-settings>=2.0.0", "qdrant-client==1.15.1", "requests==2.31.0", + "dramatiq", + "dramatiq[watch]", ] diff --git a/package.json b/package.json index 322c610..a7ec691 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jingrow", "version": "1.0.0", - "description": "AI Agent工作流平台", + "description": "AI Agent Framework", "scripts": { "dev": "./dev.sh start", "stop": "./dev.sh stop",