fix: DBPools init (config.databases), sor.R→sqlExe, add call_llm() wrapper
- _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
This commit is contained in:
parent
9eaf6c2e74
commit
09e58e5e19
@ -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):
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user