chore: replace all cn comments to en version by volc api (#313)
This commit is contained in:
@@ -56,7 +56,7 @@ func (a agentToolVersionPO) ToDO() *entity.ToolInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(@maronghong): 简化查询代码,封装查询条件
|
||||
// TODO (@maronghong): Simplify query code and encapsulate query conditions
|
||||
func (at *AgentToolVersionDAO) GetWithToolName(ctx context.Context, agentID int64, toolName string, agentVersion *string) (tool *entity.ToolInfo, exist bool, err error) {
|
||||
table := at.query.AgentToolVersion
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ func parseCURL(_ context.Context, rawCURL string) (req *curlRequest, err error)
|
||||
Method: "",
|
||||
Header: http.Header{},
|
||||
Query: url.Values{},
|
||||
Body: map[string]any{}, // TODO(@maronghong): 支持 array
|
||||
Body: map[string]any{}, // TODO (@maronghong): support array
|
||||
dataToQuery: false,
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ func parseRequestToBodySchemaRef(ctx context.Context, desc string, value any) (*
|
||||
}
|
||||
|
||||
func curlBodyToOpenAPI(ctx context.Context, mediaType string, bodyValue any, op *openapi3.Operation) (newOP *openapi3.Operation, err error) {
|
||||
bodyValue, ok := bodyValue.(map[string]any) // TODO(@maronghong): 支持 array
|
||||
bodyValue, ok := bodyValue.(map[string]any) // TODO (@maronghong): support array
|
||||
if !ok {
|
||||
return nil, errorx.New(errno.ErrPluginConvertProtocolFailed, errorx.KV(errno.PluginMsgKey,
|
||||
"request body only supports 'object' type"))
|
||||
|
||||
@@ -654,7 +654,7 @@ func (t *toolExecutor) preprocessArgumentsInJson(ctx context.Context, argumentsI
|
||||
return args, nil
|
||||
}
|
||||
|
||||
// body 限制为 object 类型
|
||||
// Body restricted to object type
|
||||
if bodySchema.Value.Type != openapi3.TypeObject {
|
||||
return nil, fmt.Errorf("[preprocessArgumentsInJson] requset body is not object, type=%s",
|
||||
bodySchema.Value.Type)
|
||||
@@ -753,7 +753,7 @@ func (t *toolExecutor) prepareArguments(_ context.Context, argumentsInJson strin
|
||||
decoder := sonic.ConfigDefault.NewDecoder(bytes.NewBufferString(argumentsInJson))
|
||||
decoder.UseNumber()
|
||||
|
||||
// 假设大模型的输出都是 object 类型
|
||||
// Suppose the output of the large model is of type object
|
||||
input := map[string]any{}
|
||||
err := decoder.Decode(&input)
|
||||
if err != nil {
|
||||
@@ -1108,7 +1108,7 @@ func (t *toolExecutor) processWithInvalidRespProcessStrategyOfReturnDefault(_ co
|
||||
|
||||
for paramName, _paramVal := range paramValMap {
|
||||
_paramSchema, ok := schemaVal.Properties[paramName]
|
||||
if !ok || t.disabledParam(_paramSchema.Value) { // 只有 object field 才能被禁用,request 和 response 顶层必定都是 object 结构
|
||||
if !ok || t.disabledParam(_paramSchema.Value) { // Only the object field can be disabled, and the top level of request and response must be the object structure
|
||||
continue
|
||||
}
|
||||
newParamVal, err := processor(_paramVal, _paramSchema.Value)
|
||||
|
||||
@@ -274,7 +274,7 @@ func (p *pluginServiceImpl) UpdateDraftPluginWithCode(ctx context.Context, req *
|
||||
}, e
|
||||
})
|
||||
|
||||
// 1. 删除 tool -> 关闭启用
|
||||
// 1. Delete tool - > Turn off Enable
|
||||
for api, oldTool := range oldDraftToolsMap {
|
||||
_, ok := apiSchemas[api]
|
||||
if !ok {
|
||||
@@ -286,7 +286,7 @@ func (p *pluginServiceImpl) UpdateDraftPluginWithCode(ctx context.Context, req *
|
||||
newDraftTools := make([]*entity.ToolInfo, 0, len(apis))
|
||||
for api, newOp := range apiSchemas {
|
||||
oldTool, ok := oldDraftToolsMap[api]
|
||||
if ok { // 2. 更新 tool -> 覆盖
|
||||
if ok { // 2. Update tool - > Overlay
|
||||
oldTool.ActivatedStatus = ptr.Of(model.ActivateTool)
|
||||
oldTool.Operation = newOp
|
||||
if needResetDebugStatusTool(ctx, newOp, oldTool.Operation) {
|
||||
@@ -295,7 +295,7 @@ func (p *pluginServiceImpl) UpdateDraftPluginWithCode(ctx context.Context, req *
|
||||
continue
|
||||
}
|
||||
|
||||
// 3. 新增 tool
|
||||
// 3. New tools
|
||||
newDraftTools = append(newDraftTools, &entity.ToolInfo{
|
||||
PluginID: req.PluginID,
|
||||
ActivatedStatus: ptr.Of(model.ActivateTool),
|
||||
|
||||
Reference in New Issue
Block a user