KaiWu commited on
Commit
587ef78
·
1 Parent(s): 67adaa5

fix(tools): 隐藏 output_path 以修复 LLM 绕过 ARTIFACT_ROOT 的持久化缺陷

Browse files

- cadquery_tool/lux3d_tool schema: 明确指示 LLM 不要传 output_path,
描述改为推荐省略以使用配置的 artifact 目录
- prompts.py SYSTEM: 在系统提示里再次强调 do NOT pass output_path

根因:LLM 按旧 schema 默认值提示,每次主动传相对路径 outputs/xxx.step,
safe_path 拼到 WORKDIR=/app 而非 ARTIFACT_ROOT=/data/outputs,
导致生成物全部写到容器临时目录,HF 持久化卷始终为空。

agent_core/prompts.py CHANGED
@@ -12,14 +12,14 @@ For CadQuery tasks:
12
  - Write CadQuery Python code.
13
  - The code must assign the final model to a variable named result.
14
  - You may use cadquery as cq; it is pre-imported by the tool.
15
- - Call execute_cadquery with the code and optional output_path.
16
  - Each successful tool call writes into a unique run directory to avoid overwriting previous models.
17
  - If execute_cadquery returns ok=false, inspect the structured error, fix the code, and call execute_cadquery again.
18
 
19
  For image-to-3D tasks:
20
  - The user must provide an image path from the workspace or configured artifact directory.
21
  - If the user asks for image-to-3D generation but does not provide an image path, ask for the image path. Do not guess.
22
- - Call generate_3d_model with the image_path and optional output_path.
23
  - Do not ask the user to read files, convert images to base64, call APIs, or download results manually.
24
 
25
  When a tool returns ok=true, report output_path, run_dir, and manifest_path to the user.
 
12
  - Write CadQuery Python code.
13
  - The code must assign the final model to a variable named result.
14
  - You may use cadquery as cq; it is pre-imported by the tool.
15
+ - Call execute_cadquery with just the code; do NOT pass output_path. The tool writes outputs into the configured artifact directory under a unique run directory automatically.
16
  - Each successful tool call writes into a unique run directory to avoid overwriting previous models.
17
  - If execute_cadquery returns ok=false, inspect the structured error, fix the code, and call execute_cadquery again.
18
 
19
  For image-to-3D tasks:
20
  - The user must provide an image path from the workspace or configured artifact directory.
21
  - If the user asks for image-to-3D generation but does not provide an image path, ask for the image path. Do not guess.
22
+ - Call generate_3d_model with just the image_path; do NOT pass output_path. The tool writes outputs into the configured artifact directory under a unique run directory automatically.
23
  - Do not ask the user to read files, convert images to base64, call APIs, or download results manually.
24
 
25
  When a tool returns ok=true, report output_path, run_dir, and manifest_path to the user.
agent_core/tools/cadquery_tool.py CHANGED
@@ -259,8 +259,7 @@ TOOL_SCHEMA = {
259
  Execute CadQuery Python code and export the result as a STEP file.
260
  The code must assign the final CadQuery model to a variable named result.
261
  cadquery is pre-imported as cq.
262
- output_path is optional. If it is a .step/.stp file path, the file name is used inside a unique run directory.
263
- If it is a directory path, model.step is written inside a unique run directory under that root.
264
  """).strip(),
265
  "input_schema": {
266
  "type": "object",
@@ -271,7 +270,7 @@ TOOL_SCHEMA = {
271
  },
272
  "output_path": {
273
  "type": "string",
274
- "description": "Optional workspace-relative STEP file path or output directory. Defaults to outputs/model.step.",
275
  },
276
  },
277
  "required": ["code"],
 
259
  Execute CadQuery Python code and export the result as a STEP file.
260
  The code must assign the final CadQuery model to a variable named result.
261
  cadquery is pre-imported as cq.
262
+ Do NOT supply output_path in normal usage. The tool automatically writes files to the configured artifact directory under a unique run directory. Only set output_path if the user explicitly requests a different location.
 
263
  """).strip(),
264
  "input_schema": {
265
  "type": "object",
 
270
  },
271
  "output_path": {
272
  "type": "string",
273
+ "description": "Advanced: custom STEP file path or output directory. Omit this field to use the configured artifact directory (recommended).",
274
  },
275
  },
276
  "required": ["code"],
agent_core/tools/lux3d_tool.py CHANGED
@@ -297,7 +297,7 @@ TOOL_SCHEMA = {
297
  },
298
  "output_path": {
299
  "type": "string",
300
- "description": "Optional workspace-relative model file path or output directory. Defaults to outputs.",
301
  },
302
  },
303
  "required": ["image_path"],
 
297
  },
298
  "output_path": {
299
  "type": "string",
300
+ "description": "Advanced: custom model file path or output directory. Omit this field to use the configured artifact directory (recommended).",
301
  },
302
  },
303
  "required": ["image_path"],