chore: replace all cn comments to en version by volc api (#313)
This commit is contained in:
@@ -1014,7 +1014,7 @@ func (a *APPApplicationService) ResourceCopyDetail(ctx context.Context, req *res
|
||||
}
|
||||
|
||||
if !exist {
|
||||
return resp, nil // 默认返回处理中
|
||||
return resp, nil // Default return processing
|
||||
}
|
||||
|
||||
detail.Status = resourceCommon.TaskStatus(result.CopyStatus)
|
||||
|
||||
@@ -348,7 +348,7 @@ func (c *ConversationApplicationService) buildTools(ctx context.Context, tools [
|
||||
}
|
||||
|
||||
arguments[key] = parametersStruct.Value
|
||||
// uri需要转换成url
|
||||
// URI needs to be converted to url.
|
||||
if parametersStruct.ResourceType == consts.ShortcutCommandResourceType {
|
||||
|
||||
resourceInfo, err := c.appContext.ImageX.GetResourceURL(ctx, parametersStruct.Value)
|
||||
|
||||
@@ -64,7 +64,7 @@ func assertValAs(typ document.TableColumnType, val string) (*document.ColumnData
|
||||
}, nil
|
||||
|
||||
case document.TableColumnTypeTime:
|
||||
// 支持时间戳和时间字符串
|
||||
// Supports timestamp and time string
|
||||
i, err := strconv.ParseInt(val, 10, 64)
|
||||
if err == nil {
|
||||
t := time.Unix(i, 0)
|
||||
|
||||
@@ -658,7 +658,7 @@ func (d *DatabaseApplicationService) GetDatabaseTableSchema(ctx context.Context,
|
||||
HeaderLineIdx: req.GetTableSheet().GetHeaderLineIdx(),
|
||||
StartLineIdx: req.GetTableSheet().GetStartLineIdx(),
|
||||
},
|
||||
// 不传默认返回所有数据
|
||||
// All data is returned by default without passing it on.
|
||||
TableDataType: tableType,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -39,7 +39,7 @@ var ModelmgrApplicationSVC = &ModelmgrApplicationService{}
|
||||
func (m *ModelmgrApplicationService) GetModelList(ctx context.Context, _ *developer_api.GetTypeListRequest) (
|
||||
resp *developer_api.GetTypeListResponse, err error,
|
||||
) {
|
||||
// 一般不太可能同时配置这么多模型
|
||||
// It is generally not possible to configure so many models simultaneously
|
||||
const modelMaxLimit = 300
|
||||
|
||||
modelResp, err := m.Mgr.ListModel(ctx, &modelmgr.ListModelRequest{
|
||||
@@ -121,7 +121,7 @@ func modelDo2To(model *modelmgr.Model, locale i18n.Locale) (*developer_api.Model
|
||||
ModelTagList: nil,
|
||||
IsUpRequired: nil,
|
||||
ModelBriefDesc: model.Description.Read(locale),
|
||||
ModelSeries: &developer_api.ModelSeriesInfo{ // TODO: 替换为真实配置
|
||||
ModelSeries: &developer_api.ModelSeriesInfo{ // TODO: Replace with real configuration
|
||||
SeriesName: "热门模型",
|
||||
},
|
||||
ModelStatusDetails: nil,
|
||||
|
||||
@@ -217,7 +217,7 @@ func (p *PluginApplicationService) toPluginInfoForPlayground(ctx context.Context
|
||||
UpdateTime: strconv.FormatInt(pl.UpdatedAt/1000, 10),
|
||||
ProjectID: strconv.FormatInt(pl.GetAPPID(), 10),
|
||||
VersionName: pl.GetVersion(),
|
||||
VersionTs: pl.GetVersion(), // 兼容前端逻辑,理论上应该使用 VersionName
|
||||
VersionTs: pl.GetVersion(), // Compatible with front-end logic, in theory VersionName should be used
|
||||
PluginApis: pluginAPIs,
|
||||
}
|
||||
|
||||
@@ -1237,7 +1237,7 @@ func (p *PluginApplicationService) PublicGetProductList(ctx context.Context, req
|
||||
resp = &productAPI.GetProductListResponse{
|
||||
Data: &productAPI.GetProductListData{
|
||||
Products: products,
|
||||
HasMore: false, // 一次性拉完
|
||||
HasMore: false, // Finish at one time
|
||||
Total: int32(res.Total),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func (s *SearchApplicationService) LibraryResourceList(ctx context.Context, req
|
||||
Limit: req.GetSize(),
|
||||
}
|
||||
|
||||
// 设置用户过滤
|
||||
// Set up user filtering
|
||||
if req.IsSetUserFilter() && req.GetUserFilter() > 0 {
|
||||
searchReq.OwnerID = ptr.From(userID)
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ func parametersDo2Vo(op *plugin.Openapi3Operation) []*playground.PluginParameter
|
||||
}
|
||||
}
|
||||
|
||||
break // 只取一种 MIME
|
||||
break // Take only one MIME.
|
||||
}
|
||||
|
||||
return params
|
||||
|
||||
@@ -156,7 +156,7 @@ func (s *SingleAgentApplicationService) UpdatePromptDisable(ctx context.Context,
|
||||
}
|
||||
|
||||
if len(draft.Database) == 0 {
|
||||
return nil, fmt.Errorf("agent %d has no database", agentID) // TODO(@fanlv): 错误码
|
||||
return nil, fmt.Errorf("agent %d has no database", agentID) // TODO (@fanlv): error code
|
||||
}
|
||||
|
||||
dbInfos := draft.Database
|
||||
@@ -170,7 +170,7 @@ func (s *SingleAgentApplicationService) UpdatePromptDisable(ctx context.Context,
|
||||
}
|
||||
|
||||
if !found {
|
||||
return nil, fmt.Errorf("database %d not found in agent %d", req.GetDatabaseID(), agentID) // TODO(@fanlv): 错误码
|
||||
return nil, fmt.Errorf("database %d not found in agent %d", req.GetDatabaseID(), agentID) // TODO (@fanlv): error code
|
||||
}
|
||||
|
||||
draft.Database = dbInfos
|
||||
@@ -606,7 +606,7 @@ func (s *SingleAgentApplicationService) ListAgentPublishHistory(ctx context.Cont
|
||||
Name: creator.Name,
|
||||
AvatarURL: creator.IconURL,
|
||||
Self: uid == v.CreatorID,
|
||||
// UserUniqueName: creator.UserUniqueName, // TODO(@fanlv) : user domain 补完以后再改
|
||||
// UserUniqueName: creator. UserUniqueName,//TODO (@fanlv): Change the user domain after it is completed
|
||||
// UserLabel TODO
|
||||
},
|
||||
PublishID: &v.PublishID,
|
||||
|
||||
@@ -486,7 +486,7 @@ func isImageUri(uri string) bool {
|
||||
"ico": true,
|
||||
}
|
||||
|
||||
// 检查扩展名是否在图片扩展名列表中
|
||||
// Check if the extension is in the picture extension list
|
||||
return imageExtensions[ext]
|
||||
}
|
||||
func (u *UploadService) GetObjInfoBySessionKey(ctx context.Context, sessionKey string) (*GetObjInfoBySessionKey, error) {
|
||||
@@ -534,7 +534,7 @@ type SVG struct {
|
||||
ViewBox string `xml:"viewBox,attr"`
|
||||
}
|
||||
|
||||
// 获取 SVG 尺寸
|
||||
// Get SVG size
|
||||
func getSVGDimensions(content []byte) (width, height int32, err error) {
|
||||
decoder := xml.NewDecoder(bytes.NewReader(content))
|
||||
|
||||
@@ -543,7 +543,7 @@ func getSVGDimensions(content []byte) (width, height int32, err error) {
|
||||
return 100, 100, nil
|
||||
}
|
||||
|
||||
// 尝试从width属性获取
|
||||
// Try to get from the width property
|
||||
if svg.Width != "" {
|
||||
w, err := parseDimension(svg.Width)
|
||||
if err == nil {
|
||||
@@ -551,7 +551,7 @@ func getSVGDimensions(content []byte) (width, height int32, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
// 尝试从height属性获取
|
||||
// Try to get from the height property
|
||||
if svg.Height != "" {
|
||||
h, err := parseDimension(svg.Height)
|
||||
if err == nil {
|
||||
@@ -559,7 +559,7 @@ func getSVGDimensions(content []byte) (width, height int32, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
// 如果width或height未设置,尝试从viewBox获取
|
||||
// If width or height is not set, try getting it from the viewBox
|
||||
if width == 0 || height == 0 {
|
||||
if svg.ViewBox != "" {
|
||||
parts := strings.Fields(svg.ViewBox)
|
||||
@@ -587,19 +587,19 @@ func getSVGDimensions(content []byte) (width, height int32, err error) {
|
||||
return width, height, nil
|
||||
}
|
||||
func parseDimension(dim string) (int32, error) {
|
||||
// 去除单位(px, pt, em, %等)和空格
|
||||
// Remove units (px, pt, em,%, etc.) and spaces
|
||||
dim = strings.TrimSpace(dim)
|
||||
dim = strings.TrimRightFunc(dim, func(r rune) bool {
|
||||
return (r < '0' || r > '9') && r != '.' && r != '-' && r != '+'
|
||||
})
|
||||
|
||||
// 解析为float64
|
||||
// Resolve to float64
|
||||
value, err := strconv.ParseFloat(dim, 64)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// 四舍五入转换为int32
|
||||
// Rounding converts to int32
|
||||
if value > math.MaxInt32 {
|
||||
return math.MaxInt32, nil
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ type UserApplicationService struct {
|
||||
DomainSVC user.User
|
||||
}
|
||||
|
||||
// 添加一个简单的 email 验证函数
|
||||
// Add a simple email verification function
|
||||
func isValidEmail(email string) bool {
|
||||
// 如果 email 字符串格式不正确,它会返回一个 error
|
||||
// If the email string is not in the correct format, it will return an error.
|
||||
_, err := mail.ParseAddress(email)
|
||||
return err == nil
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func isValidEmail(email string) bool {
|
||||
func (u *UserApplicationService) PassportWebEmailRegisterV2(ctx context.Context, locale string, req *passport.PassportWebEmailRegisterV2PostRequest) (
|
||||
resp *passport.PassportWebEmailRegisterV2PostResponse, sessionKey string, err error,
|
||||
) {
|
||||
// 验证 email 格式是否合法
|
||||
// Verify that the email format is legitimate
|
||||
if !isValidEmail(req.GetEmail()) {
|
||||
return nil, "", errorx.New(errno.ErrUserInvalidParamCode, errorx.KV("msg", "Invalid email"))
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func (u *UserApplicationService) allowRegisterChecker(email string) bool {
|
||||
return slices.Contains(strings.Split(allowedEmails, ","), strings.ToLower(email))
|
||||
}
|
||||
|
||||
// PassportWebLogoutGet 处理用户登出请求
|
||||
// PassportWebLogoutGet handle user logout requests
|
||||
func (u *UserApplicationService) PassportWebLogoutGet(ctx context.Context, req *passport.PassportWebLogoutGetRequest) (
|
||||
resp *passport.PassportWebLogoutGetResponse, err error,
|
||||
) {
|
||||
@@ -116,7 +116,7 @@ func (u *UserApplicationService) PassportWebLogoutGet(ctx context.Context, req *
|
||||
}, nil
|
||||
}
|
||||
|
||||
// PassportWebEmailLoginPost 处理用户邮箱登录请求
|
||||
// PassportWebEmailLoginPost handle user email login requests
|
||||
func (u *UserApplicationService) PassportWebEmailLoginPost(ctx context.Context, req *passport.PassportWebEmailLoginPostRequest) (
|
||||
resp *passport.PassportWebEmailLoginPostResponse, sessionKey string, err error,
|
||||
) {
|
||||
@@ -160,11 +160,11 @@ func (u *UserApplicationService) PassportAccountInfoV2(ctx context.Context, req
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UserUpdateAvatar 更新用户头像
|
||||
// UserUpdateAvatar Update user avatar
|
||||
func (u *UserApplicationService) UserUpdateAvatar(ctx context.Context, mimeType string, req *passport.UserUpdateAvatarRequest) (
|
||||
resp *passport.UserUpdateAvatarResponse, err error,
|
||||
) {
|
||||
// 根据 MIME type 获取文件后缀
|
||||
// Get file suffix by MIME type
|
||||
var ext string
|
||||
switch mimeType {
|
||||
case "image/jpeg", "image/jpg":
|
||||
@@ -195,7 +195,7 @@ func (u *UserApplicationService) UserUpdateAvatar(ctx context.Context, mimeType
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UserUpdateProfile 更新用户资料
|
||||
// UserUpdateProfile Update user profile
|
||||
func (u *UserApplicationService) UserUpdateProfile(ctx context.Context, req *passport.UserUpdateProfileRequest) (
|
||||
resp *passport.UserUpdateProfileResponse, err error,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user