feat(llm-client): add mandatory field constraints to DEEP_SYSTEM_PROMPT

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]
This commit is contained in:
木炎
2026-04-17 18:41:03 +08:00
parent e6bab40e5b
commit f374334f25

View File

@@ -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: