diff --git a/backend/api/model/crossdomain/plugin/openapi.go b/backend/api/model/crossdomain/plugin/openapi.go index 7d251cd3c6..58326e8d85 100644 --- a/backend/api/model/crossdomain/plugin/openapi.go +++ b/backend/api/model/crossdomain/plugin/openapi.go @@ -228,12 +228,14 @@ func (op *Openapi3Operation) ToEinoSchemaParameterInfo(ctx context.Context) (map Required: paramVal.Required, } - if _, ok := result[paramVal.Name]; ok { - logs.CtxWarnf(ctx, "duplicate parameter name '%s'", paramVal.Name) + // Use location+name as unique key to allow same names in different locations + key := paramVal.In + "-" + paramVal.Name + if _, ok := result[key]; ok { + logs.CtxWarnf(ctx, "duplicate parameter in same location: %s@%s", paramVal.Name, paramVal.In) continue } - result[paramVal.Name] = paramInfo + result[key] = paramInfo } if op.RequestBody == nil || op.RequestBody.Value == nil || len(op.RequestBody.Value.Content) == 0 { @@ -259,12 +261,14 @@ func (op *Openapi3Operation) ToEinoSchemaParameterInfo(ctx context.Context) (map continue } - if _, ok := result[paramName]; ok { - logs.CtxWarnf(ctx, "duplicate parameter name '%s'", paramName) + // Use location+name as unique key for body parameters + key := string(ParamInBody) + "-" + paramName + if _, ok := result[key]; ok { + logs.CtxWarnf(ctx, "duplicate parameter in same location: %s@%s", paramName, string(ParamInBody)) continue } - result[paramName] = paramInfo + result[key] = paramInfo } break // Take only one MIME. diff --git a/frontend/packages/agent-ide/bot-plugin/tools/src/components/plugin_modal/utils.ts b/frontend/packages/agent-ide/bot-plugin/tools/src/components/plugin_modal/utils.ts index 8b7c599965..9899d5a9c2 100644 --- a/frontend/packages/agent-ide/bot-plugin/tools/src/components/plugin_modal/utils.ts +++ b/frontend/packages/agent-ide/bot-plugin/tools/src/components/plugin_modal/utils.ts @@ -366,7 +366,7 @@ export const handleIsShowDelete = ( return isShowDelete(data, targetKey); }; -// Check if the same name exists +// Check if the same name exists in the same location export const checkSameName = ( data: Array, targetKey: string, @@ -374,8 +374,10 @@ export const checkSameName = ( ): boolean | undefined => { for (const item of data) { if (item[ROWKEY] === targetKey) { + // Filter by both name and location to allow same names in different locations const items = data.filter( - (dataItem: APIParameter) => dataItem.name === val, + (dataItem: APIParameter) => + dataItem.name === val && dataItem.location === item.location, ); return items.length > 1; } else if (