feats: the flexable params override and compatible format

This commit is contained in:
Nekohy
2025-08-16 11:27:47 +08:00
parent f6a48434c1
commit dd497d5bd8
10 changed files with 377 additions and 56 deletions

View File

@@ -83,12 +83,7 @@ func ClaudeHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *typ
// apply param override
if len(info.ParamOverride) > 0 {
reqMap := make(map[string]interface{})
_ = common.Unmarshal(jsonData, &reqMap)
for key, value := range info.ParamOverride {
reqMap[key] = value
}
jsonData, err = common.Marshal(reqMap)
jsonData, err = relaycommon.ApplyParamOverride(jsonData, info.ParamOverride)
if err != nil {
return types.NewError(err, types.ErrorCodeChannelParamOverrideInvalid, types.ErrOptionWithSkipRetry())
}