From 09e58e5e1904423504860ce11cd10b03c5af1008 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 3 Aug 2026 10:38:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DBPools=20init=20(config.databases),=20s?= =?UTF-8?q?or.R=E2=86=92sqlExe,=20add=20call=5Fllm()=20wrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _get_db() / _get_task_raw(): properly init DBPools with config.databases - Replace sor.R() with sqlExe() to avoid 3-arg signature issues - Add call_llm() as SDLC handler interface delegating to llm_call --- pipeline_service/executor.py | 14 +++++++++----- pipeline_service/llm_bridge.py | 5 +++++ pipeline_service/storage.py | 8 +++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pipeline_service/executor.py b/pipeline_service/executor.py index e32b339..59c7820 100644 --- a/pipeline_service/executor.py +++ b/pipeline_service/executor.py @@ -134,15 +134,19 @@ async def _run_task(task_id: str): async def _get_task_raw(task_id: str) -> dict: """Get task record without tenant filtering (internal use only).""" from sqlor.dbpools import DBPools - db, dbname = DBPools(), 'pipeline' + db = DBPools() + if not db.databases: + from appPublic.jsonConfig import getConfig + config = getConfig() + if config.databases: + db.databases = config.databases + dbname = 'pipeline' async with db.sqlorContext(dbname) as sor: - recs = await sor.R('pipeline_tasks', {'id': task_id}) + recs = await sor.sqlExe("SELECT * FROM pipeline_tasks WHERE id=${tid}$", {'tid': task_id}) if not recs: return None rec = recs[0] - if hasattr(rec, '__dict__'): - return {k: getattr(rec, k) for k in dir(rec) if not k.startswith('_')} - return dict(rec) + return {k: getattr(rec, k) for k in dir(rec) if not k.startswith('_')} if hasattr(rec, '__dict__') else dict(rec) async def _execute_step(task_id: str, step_name: str, step_graph: dict, task_info: dict): diff --git a/pipeline_service/llm_bridge.py b/pipeline_service/llm_bridge.py index 1644d59..5faa9e7 100644 --- a/pipeline_service/llm_bridge.py +++ b/pipeline_service/llm_bridge.py @@ -124,3 +124,8 @@ async def llm_call(prompt: str, model: str = None, temperature: float = 0.7) -> raise ValueError(f"LLM API error {resp.status}: {text[:300]}") data = await resp.json() return data["choices"][0]["message"]["content"] + + +async def call_llm(tenant_id: str, prompt: str, model: str = None, temperature: float = 0.7) -> str: + """SDLC handler interface — delegates to llm_call.""" + return await llm_call(prompt, model=model, temperature=temperature) diff --git a/pipeline_service/storage.py b/pipeline_service/storage.py index 3cf6181..fc3b50d 100644 --- a/pipeline_service/storage.py +++ b/pipeline_service/storage.py @@ -10,7 +10,13 @@ DBNAME = "pipeline" def _get_db(): - return DBPools(), DBNAME + db = DBPools() + if not db.databases: + from appPublic.jsonConfig import getConfig + config = getConfig() + if config.databases: + db.databases = config.databases + return db, DBNAME async def get_pipeline_steps(pipeline_id: str) -> list: