fix: _load_ctx fallback — recover project_id from conversation history when settings table empty
This commit is contained in:
parent
e14db2cde7
commit
09d51b87c7
@ -83,6 +83,11 @@ async def _load_ctx(sor, uid):
|
||||
ctx = {'pid':'','pname':'','ws':'','skills_dir':'','repos':[]}
|
||||
if not recs: return ctx
|
||||
ctx['pid'] = getattr(recs[0],'current_project_id','') or ''
|
||||
if not ctx['pid']:
|
||||
# Fallback: recover from most recent conversation's iteration_id (which stores project_id)
|
||||
last = await sor.sqlExe("SELECT iteration_id FROM pipeline_conversations WHERE created_by=${u}$ AND iteration_id != '' ORDER BY created_at DESC LIMIT 1",{"u":uid})
|
||||
if last:
|
||||
ctx['pid'] = getattr(last[0],'iteration_id','') or ''
|
||||
if ctx['pid']:
|
||||
projs = await sor.sqlExe("SELECT name,workspace_dir,org_id FROM sd_projects WHERE id=${p}$",{"p":ctx['pid']})
|
||||
if projs:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user