feat(plugin): mock call info
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Code generated by thriftgo (0.4.2). DO NOT EDIT.
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package product_public_api
|
||||
|
||||
@ -28167,11 +28167,11 @@ func (p *ProductCallRateLimit) String() string {
|
||||
|
||||
type UserInfo struct {
|
||||
// User name
|
||||
Name string `thrift:"name,1" form:"name" json:"name" query:"name"`
|
||||
// User icon
|
||||
Icon string `thrift:"icon,2" form:"icon" json:"icon" query:"icon"`
|
||||
// User role
|
||||
Role string `thrift:"role,3" form:"role" json:"role" query:"role"`
|
||||
UserName *string `thrift:"user_name,1,optional" form:"user_name" json:"user_name,omitempty" query:"user_name"`
|
||||
// User nickname
|
||||
NickName *string `thrift:"nick_name,2,optional" form:"nick_name" json:"nick_name,omitempty" query:"nick_name"`
|
||||
// User avatar url
|
||||
AvatarURL *string `thrift:"avatar_url,3,optional" form:"avatar_url" json:"avatar_url,omitempty" query:"avatar_url"`
|
||||
}
|
||||
|
||||
func NewUserInfo() *UserInfo {
|
||||
@ -28181,22 +28181,49 @@ func NewUserInfo() *UserInfo {
|
||||
func (p *UserInfo) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *UserInfo) GetName() (v string) {
|
||||
return p.Name
|
||||
var UserInfo_UserName_DEFAULT string
|
||||
|
||||
func (p *UserInfo) GetUserName() (v string) {
|
||||
if !p.IsSetUserName() {
|
||||
return UserInfo_UserName_DEFAULT
|
||||
}
|
||||
return *p.UserName
|
||||
}
|
||||
|
||||
func (p *UserInfo) GetIcon() (v string) {
|
||||
return p.Icon
|
||||
var UserInfo_NickName_DEFAULT string
|
||||
|
||||
func (p *UserInfo) GetNickName() (v string) {
|
||||
if !p.IsSetNickName() {
|
||||
return UserInfo_NickName_DEFAULT
|
||||
}
|
||||
return *p.NickName
|
||||
}
|
||||
|
||||
func (p *UserInfo) GetRole() (v string) {
|
||||
return p.Role
|
||||
var UserInfo_AvatarURL_DEFAULT string
|
||||
|
||||
func (p *UserInfo) GetAvatarURL() (v string) {
|
||||
if !p.IsSetAvatarURL() {
|
||||
return UserInfo_AvatarURL_DEFAULT
|
||||
}
|
||||
return *p.AvatarURL
|
||||
}
|
||||
|
||||
var fieldIDToName_UserInfo = map[int16]string{
|
||||
1: "name",
|
||||
2: "icon",
|
||||
3: "role",
|
||||
1: "user_name",
|
||||
2: "nick_name",
|
||||
3: "avatar_url",
|
||||
}
|
||||
|
||||
func (p *UserInfo) IsSetUserName() bool {
|
||||
return p.UserName != nil
|
||||
}
|
||||
|
||||
func (p *UserInfo) IsSetNickName() bool {
|
||||
return p.NickName != nil
|
||||
}
|
||||
|
||||
func (p *UserInfo) IsSetAvatarURL() bool {
|
||||
return p.AvatarURL != nil
|
||||
}
|
||||
|
||||
func (p *UserInfo) Read(iprot thrift.TProtocol) (err error) {
|
||||
@ -28272,35 +28299,35 @@ ReadStructEndError:
|
||||
|
||||
func (p *UserInfo) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
_field = &v
|
||||
}
|
||||
p.Name = _field
|
||||
p.UserName = _field
|
||||
return nil
|
||||
}
|
||||
func (p *UserInfo) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
_field = &v
|
||||
}
|
||||
p.Icon = _field
|
||||
p.NickName = _field
|
||||
return nil
|
||||
}
|
||||
func (p *UserInfo) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
_field = &v
|
||||
}
|
||||
p.Role = _field
|
||||
p.AvatarURL = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -28341,14 +28368,16 @@ WriteStructEndError:
|
||||
}
|
||||
|
||||
func (p *UserInfo) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
if p.IsSetUserName() {
|
||||
if err = oprot.WriteFieldBegin("user_name", thrift.STRING, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.UserName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
@ -28357,14 +28386,16 @@ WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *UserInfo) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("icon", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.Icon); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
if p.IsSetNickName() {
|
||||
if err = oprot.WriteFieldBegin("nick_name", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.NickName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
@ -28373,14 +28404,16 @@ WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *UserInfo) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("role", thrift.STRING, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.Role); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
if p.IsSetAvatarURL() {
|
||||
if err = oprot.WriteFieldBegin("avatar_url", thrift.STRING, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.AvatarURL); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
@ -28408,6 +28441,8 @@ type GetProductCallInfoData struct {
|
||||
CallRateLimit *ProductCallRateLimit `thrift:"call_rate_limit,4" form:"call_rate_limit" json:"call_rate_limit" query:"call_rate_limit"`
|
||||
// User info
|
||||
UserInfo *UserInfo `thrift:"user_info,5" form:"user_info" json:"user_info" query:"user_info"`
|
||||
// Enterprise revert time
|
||||
RevertTime *string `thrift:"revert_time,6,optional" form:"revert_time" json:"revert_time,omitempty" query:"revert_time"`
|
||||
}
|
||||
|
||||
func NewGetProductCallInfoData() *GetProductCallInfoData {
|
||||
@ -28452,12 +28487,22 @@ func (p *GetProductCallInfoData) GetUserInfo() (v *UserInfo) {
|
||||
return p.UserInfo
|
||||
}
|
||||
|
||||
var GetProductCallInfoData_RevertTime_DEFAULT string
|
||||
|
||||
func (p *GetProductCallInfoData) GetRevertTime() (v string) {
|
||||
if !p.IsSetRevertTime() {
|
||||
return GetProductCallInfoData_RevertTime_DEFAULT
|
||||
}
|
||||
return *p.RevertTime
|
||||
}
|
||||
|
||||
var fieldIDToName_GetProductCallInfoData = map[int16]string{
|
||||
1: "mcp_json",
|
||||
2: "user_level",
|
||||
3: "call_count_limit",
|
||||
4: "call_rate_limit",
|
||||
5: "user_info",
|
||||
6: "revert_time",
|
||||
}
|
||||
|
||||
func (p *GetProductCallInfoData) IsSetCallCountLimit() bool {
|
||||
@ -28472,6 +28517,10 @@ func (p *GetProductCallInfoData) IsSetUserInfo() bool {
|
||||
return p.UserInfo != nil
|
||||
}
|
||||
|
||||
func (p *GetProductCallInfoData) IsSetRevertTime() bool {
|
||||
return p.RevertTime != nil
|
||||
}
|
||||
|
||||
func (p *GetProductCallInfoData) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
@ -28530,6 +28579,14 @@ func (p *GetProductCallInfoData) Read(iprot thrift.TProtocol) (err error) {
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 6:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField6(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
@ -28605,6 +28662,17 @@ func (p *GetProductCallInfoData) ReadField5(iprot thrift.TProtocol) error {
|
||||
p.UserInfo = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetProductCallInfoData) ReadField6(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.RevertTime = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *GetProductCallInfoData) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
@ -28632,6 +28700,10 @@ func (p *GetProductCallInfoData) Write(oprot thrift.TProtocol) (err error) {
|
||||
fieldId = 5
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField6(oprot); err != nil {
|
||||
fieldId = 6
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
@ -28730,6 +28802,24 @@ WriteFieldBeginError:
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
||||
}
|
||||
func (p *GetProductCallInfoData) writeField6(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetRevertTime() {
|
||||
if err = oprot.WriteFieldBegin("revert_time", thrift.STRING, 6); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.RevertTime); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *GetProductCallInfoData) String() string {
|
||||
if p == nil {
|
||||
|
||||
@ -19,11 +19,16 @@ package plugin
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strconv"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_common"
|
||||
pluginAPI "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/consts"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/convert"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/model"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/dto"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/errorx"
|
||||
@ -36,8 +41,17 @@ func (p *PluginApplicationService) GetPlaygroundPluginList(ctx context.Context,
|
||||
plugins []*entity.PluginInfo
|
||||
total int64
|
||||
)
|
||||
|
||||
var isSaasPlugin bool
|
||||
if slices.Contains(req.PluginTypes, int32(product_common.ProductEntityType_SaasPlugin)) {
|
||||
isSaasPlugin = true
|
||||
}
|
||||
if len(req.PluginIds) > 0 {
|
||||
plugins, total, err = p.getPlaygroundPluginListByIDs(ctx, req.PluginIds)
|
||||
if isSaasPlugin {
|
||||
plugins, total, err = p.getSaasPluginListByIDs(ctx, req.PluginIds)
|
||||
} else {
|
||||
plugins, total, err = p.getPlaygroundPluginListByIDs(ctx, req.PluginIds)
|
||||
}
|
||||
} else {
|
||||
plugins, total, err = p.getPlaygroundPluginList(ctx, req)
|
||||
}
|
||||
@ -47,18 +61,37 @@ func (p *PluginApplicationService) GetPlaygroundPluginList(ctx context.Context,
|
||||
}
|
||||
|
||||
pluginList := make([]*common.PluginInfoForPlayground, 0, len(plugins))
|
||||
for _, pl := range plugins {
|
||||
tools, err := p.toolRepo.GetPluginAllOnlineTools(ctx, pl.ID)
|
||||
if err != nil {
|
||||
return nil, errorx.Wrapf(err, "GetPluginAllOnlineTools failed, pluginID=%d", pl.ID)
|
||||
|
||||
if isSaasPlugin {
|
||||
pluginIDs := make([]int64, 0, len(plugins))
|
||||
for _, product := range plugins {
|
||||
pluginIDs = append(pluginIDs, product.ID)
|
||||
}
|
||||
|
||||
pluginInfo, err := p.toPluginInfoForPlayground(ctx, pl, tools)
|
||||
tools, err := p.getSaasPluginToolsList(ctx, pluginIDs)
|
||||
if err != nil {
|
||||
logs.CtxErrorf(ctx, "BatchGetSaasPluginToolsInfo failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
pluginList, err = p.convertSaasPluginListToPlayground(ctx, plugins, tools)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pluginList = append(pluginList, pluginInfo)
|
||||
} else {
|
||||
for _, pl := range plugins {
|
||||
tools, err := p.toolRepo.GetPluginAllOnlineTools(ctx, pl.ID)
|
||||
if err != nil {
|
||||
return nil, errorx.Wrapf(err, "GetPluginAllOnlineTools failed, pluginID=%d", pl.ID)
|
||||
}
|
||||
|
||||
pluginInfo, err := p.toPluginInfoForPlayground(ctx, pl, tools)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pluginList = append(pluginList, pluginInfo)
|
||||
}
|
||||
}
|
||||
|
||||
resp = &pluginAPI.GetPlaygroundPluginListResponse{
|
||||
@ -71,6 +104,36 @@ func (p *PluginApplicationService) GetPlaygroundPluginList(ctx context.Context,
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (p *PluginApplicationService) convertSaasPluginListToPlayground(ctx context.Context, plugins []*entity.PluginInfo, tools map[int64][]*entity.ToolInfo) ([]*common.PluginInfoForPlayground, error) {
|
||||
products := make([]*common.PluginInfoForPlayground, 0, len(plugins))
|
||||
for _, pl := range plugins {
|
||||
tools := tools[pl.ID]
|
||||
pluginInfo, err := p.toPluginInfoForPlayground(ctx, pl, tools)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
products = append(products, pluginInfo)
|
||||
}
|
||||
return products, nil
|
||||
}
|
||||
|
||||
func (p *PluginApplicationService) getSaasPluginListByIDs(ctx context.Context, pluginIDs []string) ([]*entity.PluginInfo, int64, error) {
|
||||
//todo need to move
|
||||
return []*entity.PluginInfo{
|
||||
{
|
||||
PluginInfo: &model.PluginInfo{
|
||||
ID: 7449357316584996883,
|
||||
PluginType: 1,
|
||||
Manifest: &model.PluginManifest{
|
||||
Auth: &model.AuthV2{
|
||||
Type: consts.AuthzTypeOfNone,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, 1, nil
|
||||
}
|
||||
|
||||
func (p *PluginApplicationService) getPlaygroundPluginListByIDs(ctx context.Context, pluginIDs []string) (plugins []*entity.PluginInfo, total int64, err error) {
|
||||
ids := make([]int64, 0, len(pluginIDs))
|
||||
for _, id := range pluginIDs {
|
||||
@ -132,19 +195,22 @@ func (p *PluginApplicationService) toPluginInfoForPlayground(ctx context.Context
|
||||
}
|
||||
|
||||
var creator *common.Creator
|
||||
userInfo, err := p.userSVC.GetUserInfo(ctx, pl.DeveloperID)
|
||||
if err != nil {
|
||||
logs.CtxErrorf(ctx, "get user info failed, err=%v", err)
|
||||
creator = common.NewCreator()
|
||||
} else {
|
||||
creator = &common.Creator{
|
||||
ID: strconv.FormatInt(pl.DeveloperID, 10),
|
||||
Name: userInfo.Name,
|
||||
AvatarURL: userInfo.IconURL,
|
||||
UserUniqueName: userInfo.UniqueName,
|
||||
if pl.Source != ptr.Of(bot_common.PluginSource_FromSaas) {
|
||||
userInfo, err := p.userSVC.GetUserInfo(ctx, pl.DeveloperID)
|
||||
if err != nil {
|
||||
logs.CtxErrorf(ctx, "get user info failed, err=%v", err)
|
||||
creator = common.NewCreator()
|
||||
} else {
|
||||
creator = &common.Creator{
|
||||
ID: strconv.FormatInt(pl.DeveloperID, 10),
|
||||
Name: userInfo.Name,
|
||||
AvatarURL: userInfo.IconURL,
|
||||
UserUniqueName: userInfo.UniqueName,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
iconURL, err := p.oss.GetObjectUrl(ctx, pl.GetIconURI())
|
||||
if err != nil {
|
||||
logs.Errorf("get plugin icon url failed, err=%v", err)
|
||||
|
||||
@ -35,6 +35,7 @@ import (
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/service"
|
||||
search "github.com/coze-dev/coze-studio/backend/domain/search/service"
|
||||
user "github.com/coze-dev/coze-studio/backend/domain/user/service"
|
||||
entityUser "github.com/coze-dev/coze-studio/backend/domain/user/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/storage"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/errorx"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
@ -576,38 +577,42 @@ func (p *PluginApplicationService) GetSaasProductCategoryList(ctx context.Contex
|
||||
}
|
||||
|
||||
func (p *PluginApplicationService) GetProductCallInfo(ctx context.Context, req *productAPI.GetProductCallInfoRequest) (resp *productAPI.GetProductCallInfoResponse, err error) {
|
||||
userID := ctxutil.GetUIDFromCtx(ctx)
|
||||
if userID == nil {
|
||||
return &productAPI.GetProductCallInfoResponse{
|
||||
Code: -1,
|
||||
Message: "User not authenticated",
|
||||
}, nil
|
||||
}
|
||||
// userInfo, err := p.userSVC.GetSaasUserInfo(ctx)
|
||||
// if err != nil {
|
||||
// logs.CtxErrorf(ctx, "GetSaasUserInfo failed: %v", err)
|
||||
// return &productAPI.GetProductCallInfoResponse{
|
||||
// Code: -1,
|
||||
// Message: "Failed to get user info",
|
||||
// }, nil
|
||||
// }
|
||||
|
||||
userInfo, err := p.userSVC.GetSaasUserInfo(ctx)
|
||||
if err != nil {
|
||||
logs.CtxErrorf(ctx, "GetSaasUserInfo failed: %v", err)
|
||||
return &productAPI.GetProductCallInfoResponse{
|
||||
Code: -1,
|
||||
Message: "Failed to get user info",
|
||||
}, nil
|
||||
}
|
||||
// benefit, err := p.userSVC.GetUserBenefit(ctx)
|
||||
// if err != nil {
|
||||
// logs.CtxErrorf(ctx, "GetUserBenefit failed: %v", err)
|
||||
// return &productAPI.GetProductCallInfoResponse{
|
||||
// Code: -1,
|
||||
// Message: "Failed to get user benefit",
|
||||
// }, nil
|
||||
// }
|
||||
|
||||
benefit, err := p.userSVC.GetUserBenefit(ctx)
|
||||
if err != nil {
|
||||
logs.CtxErrorf(ctx, "GetUserBenefit failed: %v", err)
|
||||
return &productAPI.GetProductCallInfoResponse{
|
||||
Code: -1,
|
||||
Message: "Failed to get user benefit",
|
||||
}, nil
|
||||
//todo:: need to move
|
||||
userInfo := &entityUser.SaasUserData{
|
||||
UserName: "gigoo",
|
||||
NickName: "gigoo",
|
||||
AvatarURL: "https://p6-passport.byteacctimg.com/img/user-avatar/cae85f2778fc38b29f5930be8f954bed~300x300.image",
|
||||
}
|
||||
benefit := &entityUser.UserBenefit{
|
||||
UsedCount: 10,
|
||||
TotalCount: 100,
|
||||
IsUnlimited: false,
|
||||
}
|
||||
|
||||
// Build response data
|
||||
data := &productAPI.GetProductCallInfoData{
|
||||
UserLevel: productAPI.UserLevel_Free,
|
||||
UserInfo: &productAPI.UserInfo{
|
||||
Name: userInfo.NickName,
|
||||
Icon: userInfo.AvatarURL,
|
||||
UserName: ptr.Of(userInfo.UserName),
|
||||
NickName: ptr.Of(userInfo.NickName),
|
||||
AvatarURL: ptr.Of(userInfo.AvatarURL),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -698,9 +698,9 @@ struct ProductCallRateLimit {
|
||||
}
|
||||
|
||||
struct UserInfo {
|
||||
1: string name, // User name
|
||||
2: string icon, // User icon
|
||||
3: string role, // User role
|
||||
1: optional string user_name, // User name
|
||||
2: optional string nick_name, // User nickname
|
||||
3: optional string avatar_url, // User avatar url
|
||||
}
|
||||
|
||||
struct GetProductCallInfoData {
|
||||
@ -709,6 +709,7 @@ struct GetProductCallInfoData {
|
||||
3: ProductCallCountLimit call_count_limit, // Plugin tool call count limit
|
||||
4: ProductCallRateLimit call_rate_limit, // Plugin tool call rate limit
|
||||
5: UserInfo user_info, // User info
|
||||
6: optional string revert_time, // Enterprise revert time
|
||||
}
|
||||
|
||||
struct GetProductCallInfoResponse {
|
||||
|
||||
Reference in New Issue
Block a user