@@ -115,7 +115,7 @@ def get_execution_log(task_id: str, operator_name: str = Query(None, description
115115 raise HTTPException (500 , f"Failed to get task logs: { str (e )} " )
116116
117117
118- @router .get ("/execution/{task_id}/download" , operation_id = "download_task_result" , summary = "下载任务执行结果文件" )
118+ @router .get ("/execution/{task_id}/download" , operation_id = "download_task_result" , summary = "下载任务执行结果文件,step从0开始计数,想请求第一个算子传step=0 " )
119119def download_task_result (task_id : str , step : int = None ):
120120 """
121121 下载任务执行结果文件
@@ -160,15 +160,20 @@ def download_task_result(task_id: str, step: int = None):
160160 # 构建缓存文件路径(使用绝对路径)
161161 from app .core .config import settings
162162 cache_path = settings .CACHE_DIR
163+ cache_task_dir = f"{ task_id } _output"
163164 cache_file_prefix = "dataflow_cache_step"
164- cache_file = os .path .join (cache_path , f"{ cache_file_prefix } _step{ step } .jsonl" )
165+ actual_step_for_json = step + 1
166+
167+ cache_file_name = f"{ cache_file_prefix } _step{ actual_step_for_json } .jsonl"
168+
169+ cache_file = os .path .join (cache_path , cache_task_dir , cache_file_name )
165170
166171 # 检查文件是否存在
167172 if not os .path .exists (cache_file ):
168173 raise HTTPException (404 , f"Result file not found for step { step } : { cache_file } " )
169174
170175 # 返回文件下载
171- filename = f"{ task_id } _{ operator_name } _step{ step } .jsonl"
176+ filename = f"{ task_id } _{ operator_name } _step{ actual_step_for_json } .jsonl"
172177 logger .info (f"Downloading file: { cache_file } as { filename } " )
173178
174179 return FileResponse (
0 commit comments