feat(runtime): enhance payload rule resolution with dynamic path support
- Introduced `resolvePayloadRulePaths` function to dynamically resolve rule paths supporting array queries and complex logic. - Updated payload processing logic (`apply defaults`, `overrides`, `filters`) to handle resolved paths for better flexibility. - Added helper functions for path parsing, query matching, and logical resolution to improve modularity and reusability. - Introduced payload condition match logic, including `match`, `not-match`, `exist`, and `not-exist` rules in `PayloadConfig`. - Enhanced `payloadModelRulesMatch` function to support conditional checks at various levels. - Added helper methods for evaluating JSON path conditions and values. - Updated tests to validate new conditional rules against different payload scenarios.
This commit is contained in:
@@ -407,6 +407,17 @@ nonstream-keepalive-interval: 0
|
||||
# - models:
|
||||
# - name: "gemini-2.5-pro" # Supports wildcards (e.g., "gemini-*")
|
||||
# protocol: "gemini" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex, antigravity
|
||||
# form-protocol: "responses" # restricts the rule to the source protocol, options: openai, responses, gemini, claude
|
||||
# headers: # all configured request headers must match; values support "*" wildcards
|
||||
# X-Client-Tier: "tenant-*-region-*"
|
||||
# match: # all payload JSON paths must equal the configured values
|
||||
# - "metadata.client": "codex"
|
||||
# not-match: # payload JSON paths must not equal the configured values
|
||||
# - "metadata.mode": "dev"
|
||||
# exist: # all payload JSON paths must exist and not be null
|
||||
# - "tools.#(type==\"web_search\").type"
|
||||
# not-exist: # all payload JSON paths must be missing or null
|
||||
# - "metadata.disable_payload"
|
||||
# params: # JSON path (gjson/sjson syntax) -> value
|
||||
# "generationConfig.thinkingConfig.thinkingBudget": 32768
|
||||
# default-raw: # Default raw rules set parameters using raw JSON when missing (must be valid JSON).
|
||||
|
||||
Reference in New Issue
Block a user