chore(plugin): remove unuse InvocationArgs field (#2266)
This commit is contained in:
@ -533,8 +533,6 @@ func (t *toolExecutor) execute(ctx context.Context, argumentsInJson, accessToken
|
||||
ArgsInJson: argumentsInJson,
|
||||
ProjectInfo: t.projectInfo,
|
||||
UserID: t.userID,
|
||||
AccessToken: accessToken,
|
||||
AuthURL: authURL,
|
||||
Plugin: t.plugin,
|
||||
Tool: t.tool,
|
||||
PluginManifest: t.plugin.Manifest,
|
||||
|
||||
@ -68,8 +68,6 @@ type InvocationArgs struct {
|
||||
|
||||
UserID string
|
||||
ProjectInfo *model.ProjectInfo
|
||||
AccessToken string
|
||||
AuthURL string
|
||||
|
||||
Header map[string]any
|
||||
Path map[string]any
|
||||
@ -82,8 +80,6 @@ type InvocationArgsBuilder struct {
|
||||
ArgsInJson string
|
||||
ProjectInfo *model.ProjectInfo
|
||||
UserID string
|
||||
AccessToken string
|
||||
AuthURL string
|
||||
Plugin *entity.PluginInfo
|
||||
Tool *entity.ToolInfo
|
||||
AuthInfo *AuthInfo
|
||||
@ -98,11 +94,13 @@ func NewInvocationArgs(ctx context.Context, builder *InvocationArgsBuilder) (*In
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if builder.AuthInfo == nil {
|
||||
return nil, fmt.Errorf("auth info is nil")
|
||||
}
|
||||
|
||||
args := &InvocationArgs{
|
||||
UserID: builder.UserID,
|
||||
ProjectInfo: builder.ProjectInfo,
|
||||
AccessToken: builder.AccessToken,
|
||||
AuthURL: builder.AuthURL,
|
||||
Tool: builder.Tool,
|
||||
AuthInfo: builder.AuthInfo,
|
||||
PluginManifest: builder.PluginManifest,
|
||||
|
||||
@ -315,7 +315,11 @@ func (h *httpCallImpl) injectOAuthAccessToken(ctx context.Context, httpReq *http
|
||||
return "", nil
|
||||
}
|
||||
|
||||
accessToken := args.AccessToken
|
||||
if args.AuthInfo.OAuth == nil {
|
||||
return "", fmt.Errorf("auth of oauth is nil")
|
||||
}
|
||||
|
||||
accessToken := args.AuthInfo.OAuth.AccessToken
|
||||
authInfo := args.AuthInfo.MetaInfo
|
||||
|
||||
if authInfo.SubType == pluginConsts.AuthzSubTypeOfOAuthAuthorizationCode &&
|
||||
@ -325,7 +329,7 @@ func (h *httpCallImpl) injectOAuthAccessToken(ctx context.Context, httpReq *http
|
||||
errMsg = authCodeInvalidTokenErrMsg[i18n.LocaleEN]
|
||||
}
|
||||
|
||||
errMsg = fmt.Sprintf(errMsg, args.PluginManifest.NameForHuman, args.AuthURL)
|
||||
errMsg = fmt.Sprintf(errMsg, args.PluginManifest.NameForHuman, args.AuthInfo.OAuth.AuthURL)
|
||||
|
||||
return errMsg, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user