feat(usage): add custom blank template for usage script

- Add "自定义" (Custom) template as the first preset option
- Provide minimal structure with empty URL and headers for full customization
- Include basic extractor function returning remaining and unit fields
- Allow users to build usage queries from scratch without starting from complex examples
This commit is contained in:
Jason
2025-11-04 21:53:42 +08:00
parent 7be74806e8
commit 802c3bffd9

View File

@@ -27,6 +27,20 @@ interface UsageScriptModalProps {
// 预设模板JS 对象字面量格式)
const PRESET_TEMPLATES: Record<string, string> = {
: `({
request: {
url: "",
method: "GET",
headers: {}
},
extractor: function(response) {
return {
remaining: 0,
unit: "USD"
};
}
})`,
: `({
request: {
url: "{{baseUrl}}/user/balance",