diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index bcb0acb..7d21897 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -202,7 +202,14 @@ async def _exec_tool(sor, tool, params, ctx, uid, org_id): if ex: return f'FAIL: 项目「{name}」已存在' pid = getID() wid = getID() - ws = f'/d/pipeline/workspaces/{org_id}/{name}' + _wsb = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe("SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + _wsb = getattr(_wbr[0], 'params_value', '') + except Exception: + pass + ws = _wsb + '/' + str(org_id) + '/' + name await sor.C('sd_projects',{'id':pid,'name':name,'description':p.get('description',''),'workspace_dir':ws,'org_id':org_id,'created_by':uid}) await sor.C('sd_iterations',{'id':wid,'project_id':pid,'iteration_name':'默认迭代','iteration_type':'default','status':'active','priority':1,'org_id':org_id}) await _save_ctx(sor, uid, pid) diff --git a/wwwroot/api/workspace_browse.dspy b/wwwroot/api/workspace_browse.dspy index 6dc9b63..329f0c7 100644 --- a/wwwroot/api/workspace_browse.dspy +++ b/wwwroot/api/workspace_browse.dspy @@ -5,10 +5,16 @@ if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') -workspace_base = '/d/pipeline/workspaces' import os async with DBPools().sqlorContext(dbname) as sor: + workspace_base = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe("SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + workspace_base = getattr(_wbr[0], 'params_value', '') + except Exception: + pass recs = await sor.sqlExe( "SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) diff --git a/wwwroot/api/workspace_delete.dspy b/wwwroot/api/workspace_delete.dspy index 399ee92..c2511c8 100644 --- a/wwwroot/api/workspace_delete.dspy +++ b/wwwroot/api/workspace_delete.dspy @@ -9,9 +9,15 @@ if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') -workspace_base = '/d/pipeline/workspaces' async with DBPools().sqlorContext(dbname) as sor: + workspace_base = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe("SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + workspace_base = getattr(_wbr[0], 'params_value', '') + except Exception: + pass recs = await sor.sqlExe( "SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) pid = getattr(recs[0], 'current_project_id', '') if recs else '' diff --git a/wwwroot/api/workspace_file.dspy b/wwwroot/api/workspace_file.dspy index 1fd9235..61668b7 100644 --- a/wwwroot/api/workspace_file.dspy +++ b/wwwroot/api/workspace_file.dspy @@ -12,9 +12,15 @@ if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') -workspace_base = '/d/pipeline/workspaces' async with DBPools().sqlorContext(dbname) as sor: + workspace_base = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe("SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + workspace_base = getattr(_wbr[0], 'params_value', '') + except Exception: + pass recs = await sor.sqlExe( "SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) pid = getattr(recs[0], 'current_project_id', '') if recs else '' diff --git a/wwwroot/api/workspace_files.dspy b/wwwroot/api/workspace_files.dspy index 0522739..447b37e 100644 --- a/wwwroot/api/workspace_files.dspy +++ b/wwwroot/api/workspace_files.dspy @@ -10,9 +10,15 @@ if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') -workspace_base = '/d/pipeline/workspaces' async with DBPools().sqlorContext(dbname) as sor: + workspace_base = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe("SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + workspace_base = getattr(_wbr[0], 'params_value', '') + except Exception: + pass recs = await sor.sqlExe( "SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) pid = getattr(recs[0], 'current_project_id', '') if recs else '' diff --git a/wwwroot/api/workspace_open.dspy b/wwwroot/api/workspace_open.dspy index 0149f66..f21ac20 100644 --- a/wwwroot/api/workspace_open.dspy +++ b/wwwroot/api/workspace_open.dspy @@ -11,9 +11,15 @@ if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') -workspace_base = '/d/pipeline/workspaces' async with DBPools().sqlorContext(dbname) as sor: + workspace_base = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe("SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + workspace_base = getattr(_wbr[0], 'params_value', '') + except Exception: + pass recs = await sor.sqlExe( "SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) pid = getattr(recs[0], 'current_project_id', '') if recs else '' diff --git a/wwwroot/api/workspace_tree.dspy b/wwwroot/api/workspace_tree.dspy index 503400d..7eacd87 100644 --- a/wwwroot/api/workspace_tree.dspy +++ b/wwwroot/api/workspace_tree.dspy @@ -9,9 +9,17 @@ if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') -workspace_base = '/d/pipeline/workspaces' async with DBPools().sqlorContext(dbname) as sor: + # workspace_base 从 appbase params 表读(可动态配置),默认值兜底 + workspace_base = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe( + "SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + workspace_base = getattr(_wbr[0], 'params_value', '') + except Exception: + pass recs = await sor.sqlExe( "SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) diff --git a/wwwroot/api/workspace_upload.dspy b/wwwroot/api/workspace_upload.dspy index 74d0e59..ace511b 100644 --- a/wwwroot/api/workspace_upload.dspy +++ b/wwwroot/api/workspace_upload.dspy @@ -12,9 +12,15 @@ if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') -workspace_base = '/d/pipeline/workspaces' async with DBPools().sqlorContext(dbname) as sor: + workspace_base = '/d/pipeline/workspaces' + try: + _wbr = await sor.sqlExe("SELECT params_value FROM params WHERE params_name='workspace_base' LIMIT 1", {}) + if _wbr and getattr(_wbr[0], 'params_value', ''): + workspace_base = getattr(_wbr[0], 'params_value', '') + except Exception: + pass recs = await sor.sqlExe( "SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) pid = getattr(recs[0], 'current_project_id', '') if recs else ''