From f374334f2538ec7f6ab9651e04db6ea933c40a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E7=82=8E?= <635735027@qq.com> Date: Fri, 17 Apr 2026 18:41:03 +0800 Subject: [PATCH] feat(llm-client): add mandatory field constraints to DEEP_SYSTEM_PROMPT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Explicitly require LLM to fill contentType, responsePath, and requestTemplate with detected values or defaults. Reduces empty-field rate from ~60% to target ~10%. 🤖 Generated with [Qoder][https://qoder.com] --- frontend/scene-generator/llm-client.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/frontend/scene-generator/llm-client.js b/frontend/scene-generator/llm-client.js index 8bfbc96..2136074 100644 --- a/frontend/scene-generator/llm-client.js +++ b/frontend/scene-generator/llm-client.js @@ -79,7 +79,27 @@ Schema: "columnDefs": [["field", "label"]], "confidence": 0.0, "uncertainties": ["string"] -}`; +} + +MANDATORY FIELDS (never leave empty): +- apiEndpoints[].contentType: detect from source code. + * For $.ajax({}): look for 'contentType' property. Default 'application/json' if absent. + * For $http.sendByAxios(): contentType is 'application/json' (axios default). + * For XMLHttpRequest: look for setRequestHeader('Content-Type', ...). + * For form submissions: 'application/x-www-form-urlencoded'. +- modes[].responsePath: the JSON path from raw API response to the data array. + * Common patterns: 'data.list', 'data.rcvblAcctSumAll.rcvblAcctVOS', 'content', 'data.records' + * If response is the array itself, use empty string "". +- modes[].requestTemplate: the static request body shape from the source code. + * Extract ALL keys that appear in the request body object. + * Mark dynamic values as "\${args.fieldName}" and static values as literals. +- apiEndpoints[].url: the full API URL as seen in the source code. + +RULES: +- If you cannot determine contentType, default to 'application/json'. +- If you cannot determine responsePath, default to '' (empty string). +- If you cannot determine requestTemplate, use {} (empty object). +- NEVER leave these fields as null or undefined.`; const JSON_REPAIR_SYSTEM_PROMPT = `You repair malformed JSON. Rules: