chore: replace all cn comments to en version by volc api (#313)
This commit is contained in:
@@ -61,7 +61,7 @@ func (v SysConfVariables) GroupByName() []*kvmemory.GroupVariableInfo {
|
||||
|
||||
groupName := variable.GroupName
|
||||
if groupName == "" {
|
||||
groupName = "未分组" // 处理空分组名
|
||||
groupName = "未分组" // Handling empty group names
|
||||
}
|
||||
|
||||
if _, ok := groups[groupName]; !ok {
|
||||
@@ -75,13 +75,13 @@ func (v SysConfVariables) GroupByName() []*kvmemory.GroupVariableInfo {
|
||||
groups[groupName].VarInfoList = append(groups[groupName].VarInfoList, variable)
|
||||
}
|
||||
|
||||
// 转换为切片并按组名排序
|
||||
// Convert to slices and sort by group name
|
||||
result := make([]*kvmemory.GroupVariableInfo, 0, len(groups))
|
||||
for _, group := range groups {
|
||||
result = append(result, group)
|
||||
}
|
||||
|
||||
// 可选:按组名排序
|
||||
// Optional: sort by group name
|
||||
sort.Slice(result, func(i, j int) bool {
|
||||
return result[i].GroupName < result[j].GroupName
|
||||
})
|
||||
|
||||
@@ -60,7 +60,7 @@ const (
|
||||
)
|
||||
|
||||
func (v *UserVariableMeta) GenSystemKV(ctx context.Context, keyword string) (*kvmemory.KVItem, error) {
|
||||
if keyword != sysUUIDKey { // 外场暂时只支持这一个变量
|
||||
if keyword != sysUUIDKey { // The outfield only supports this one variable for the time being
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ func (v *UserVariableMeta) genUUID(ctx context.Context) (*kvmemory.KVItem, error
|
||||
}
|
||||
|
||||
func (v *UserVariableMeta) encryptSysUUIDKey(ctx context.Context) string {
|
||||
// 拼接四个字段,中间用特殊分隔符(如 | )
|
||||
// Combine four fields with a special delimiter (e.g. |)
|
||||
plain := fmt.Sprintf("%d|%s|%s|%d", v.BizType, v.BizID, v.ConnectorUID, v.ConnectorID)
|
||||
return base64.StdEncoding.EncodeToString([]byte(plain))
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ func (v *VariableMetaSchema) nameValidate() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查是否符合后面的部分正则规则
|
||||
// Check if some of the following regular rules are met
|
||||
pattern := `^[a-zA-Z_][a-zA-Z_$0-9]*$`
|
||||
match, _ := regexp.MatchString(pattern, identifier)
|
||||
|
||||
|
||||
@@ -8,17 +8,17 @@ const TableNameVariableInstance = "variable_instance"
|
||||
|
||||
// VariableInstance KV Memory
|
||||
type VariableInstance struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:主键ID" json:"id"` // 主键ID
|
||||
BizType int32 `gorm:"column:biz_type;not null;comment:1 for agent,2 for app" json:"biz_type"` // 1 for agent,2 for app
|
||||
BizID string `gorm:"column:biz_id;not null;comment:1 for agent_id,2 for app_id" json:"biz_id"` // 1 for agent_id,2 for app_id
|
||||
Version string `gorm:"column:version;not null;comment:agent or project 版本,为空代表草稿态" json:"version"` // agent or project 版本,为空代表草稿态
|
||||
Keyword string `gorm:"column:keyword;not null;comment:记忆的KEY" json:"keyword"` // 记忆的KEY
|
||||
Type int32 `gorm:"column:type;not null;comment:记忆类型 1 KV 2 list" json:"type"` // 记忆类型 1 KV 2 list
|
||||
Content string `gorm:"column:content;comment:记忆内容" json:"content"` // 记忆内容
|
||||
ConnectorUID string `gorm:"column:connector_uid;not null;comment:二方用户ID" json:"connector_uid"` // 二方用户ID
|
||||
ConnectorID int64 `gorm:"column:connector_id;not null;comment:二方id, e.g. coze = 10000010" json:"connector_id"` // 二方id, e.g. coze = 10000010
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;autoUpdateTime:milli;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:id" json:"id"` // id
|
||||
BizType int32 `gorm:"column:biz_type;not null;comment:1 for agent,2 for app" json:"biz_type"` // 1 for agent,2 for app
|
||||
BizID string `gorm:"column:biz_id;not null;comment:1 for agent_id,2 for app_id" json:"biz_id"` // 1 for agent_id,2 for app_id
|
||||
Version string `gorm:"column:version;not null;comment:agent or project version empty represents draft status" json:"version"` // agent or project version empty represents draft status
|
||||
Keyword string `gorm:"column:keyword;not null;comment:Keyword to Memory" json:"keyword"` // Keyword to Memory
|
||||
Type int32 `gorm:"column:type;not null;comment:Memory type 1 KV 2 list" json:"type"` // Memory type 1 KV 2 list
|
||||
Content string `gorm:"column:content;comment:content" json:"content"` // content
|
||||
ConnectorUID string `gorm:"column:connector_uid;not null;comment:connector_uid" json:"connector_uid"` // connector_uid
|
||||
ConnectorID int64 `gorm:"column:connector_id;not null;comment:connector_id, e.g. coze = 10000010" json:"connector_id"` // connector_id, e.g. coze = 10000010
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;autoUpdateTime:milli;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
|
||||
}
|
||||
|
||||
// TableName VariableInstance's table name
|
||||
|
||||
@@ -10,14 +10,14 @@ const TableNameVariablesMeta = "variables_meta"
|
||||
|
||||
// VariablesMeta KV Memory meta
|
||||
type VariablesMeta struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:主键ID" json:"id"` // 主键ID
|
||||
CreatorID int64 `gorm:"column:creator_id;not null;comment:创建者ID" json:"creator_id"` // 创建者ID
|
||||
BizType int32 `gorm:"column:biz_type;not null;comment:1 for agent,2 for app" json:"biz_type"` // 1 for agent,2 for app
|
||||
BizID string `gorm:"column:biz_id;not null;comment:1 for agent_id,2 for app_id" json:"biz_id"` // 1 for agent_id,2 for app_id
|
||||
VariableList []*entity.VariableMeta `gorm:"column:variable_list;comment:变量配置的json数据;serializer:json" json:"variable_list"` // 变量配置的json数据
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:create time" json:"created_at"` // create time
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;autoUpdateTime:milli;comment:update time" json:"updated_at"` // update time
|
||||
Version string `gorm:"column:version;not null;comment:project版本,为空代表草稿态" json:"version"` // project版本,为空代表草稿态
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:id" json:"id"` // id
|
||||
CreatorID int64 `gorm:"column:creator_id;not null;comment:creator id" json:"creator_id"` // creator id
|
||||
BizType int32 `gorm:"column:biz_type;not null;comment:1 for agent,2 for app" json:"biz_type"` // 1 for agent,2 for app
|
||||
BizID string `gorm:"column:biz_id;not null;comment:1 for agent_id,2 for app_id" json:"biz_id"` // 1 for agent_id,2 for app_id
|
||||
VariableList []*entity.VariableMeta `gorm:"column:variable_list;comment:JSON data for variable configuration;serializer:json" json:"variable_list"` // JSON data for variable configuration
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;autoUpdateTime:milli;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
|
||||
Version string `gorm:"column:version;not null;comment:Project version, empty represents draft status" json:"version"` // Project version, empty represents draft status
|
||||
}
|
||||
|
||||
// TableName VariablesMeta's table name
|
||||
|
||||
@@ -49,17 +49,17 @@ type variableInstance struct {
|
||||
variableInstanceDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键ID
|
||||
ID field.Int64 // id
|
||||
BizType field.Int32 // 1 for agent,2 for app
|
||||
BizID field.String // 1 for agent_id,2 for app_id
|
||||
Version field.String // agent or project 版本,为空代表草稿态
|
||||
Keyword field.String // 记忆的KEY
|
||||
Type field.Int32 // 记忆类型 1 KV 2 list
|
||||
Content field.String // 记忆内容
|
||||
ConnectorUID field.String // 二方用户ID
|
||||
ConnectorID field.Int64 // 二方id, e.g. coze = 10000010
|
||||
CreatedAt field.Int64 // 创建时间
|
||||
UpdatedAt field.Int64 // 更新时间
|
||||
Version field.String // agent or project version empty represents draft status
|
||||
Keyword field.String // Keyword to Memory
|
||||
Type field.Int32 // Memory type 1 KV 2 list
|
||||
Content field.String // content
|
||||
ConnectorUID field.String // connector_uid
|
||||
ConnectorID field.Int64 // connector_id, e.g. coze = 10000010
|
||||
CreatedAt field.Int64 // Create Time in Milliseconds
|
||||
UpdatedAt field.Int64 // Update Time in Milliseconds
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ type variablesMeta struct {
|
||||
variablesMetaDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键ID
|
||||
CreatorID field.Int64 // 创建者ID
|
||||
ID field.Int64 // id
|
||||
CreatorID field.Int64 // creator id
|
||||
BizType field.Int32 // 1 for agent,2 for app
|
||||
BizID field.String // 1 for agent_id,2 for app_id
|
||||
VariableList field.Field // 变量配置的json数据
|
||||
CreatedAt field.Int64 // create time
|
||||
UpdatedAt field.Int64 // update time
|
||||
Version field.String // project版本,为空代表草稿态
|
||||
VariableList field.Field // JSON data for variable configuration
|
||||
CreatedAt field.Int64 // Create Time in Milliseconds
|
||||
UpdatedAt field.Int64 // Update Time in Milliseconds
|
||||
Version field.String // Project version, empty represents draft status
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func (m *VariablesDAO) UpdateProjectVariable(ctx context.Context, do *entity.Var
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetVariableMeta 获取变量元数据 , 不存在返回 nil
|
||||
// GetVariableMeta Gets variable metadata, returns nil if it does not exist
|
||||
func (m *VariablesDAO) GetVariableMeta(ctx context.Context, bizID string, bizType project_memory.VariableConnector, version string) (*entity.VariablesMeta, error) {
|
||||
table := query.VariablesMeta
|
||||
condWhere := []gen.Condition{
|
||||
@@ -103,7 +103,7 @@ func (m *VariablesDAO) GetVariableMeta(ctx context.Context, bizID string, bizTyp
|
||||
return do, nil
|
||||
}
|
||||
|
||||
// GetVariableMetaByID 获取变量元数据, 不存在返回 nil
|
||||
// GetVariableMetaByID Gets variable metadata, returns nil if there is no such thing
|
||||
func (m *VariablesDAO) GetVariableMetaByID(ctx context.Context, id int64) (*entity.VariablesMeta, error) {
|
||||
table := query.VariablesMeta
|
||||
condWhere := []gen.Condition{
|
||||
|
||||
@@ -133,7 +133,7 @@ func (*variablesImpl) mergeVariableList(_ context.Context, sysVarsList, variable
|
||||
mergedMap[sysVar.Keyword] = sysVar
|
||||
}
|
||||
|
||||
// 可以覆盖 sysVar
|
||||
// Can overwrite sysVar
|
||||
for _, variable := range variablesList {
|
||||
mergedMap[variable.Keyword] = variable
|
||||
}
|
||||
@@ -420,7 +420,7 @@ func (v *variablesImpl) sortKVItem(items []*kvmemory.KVItem, meta *entity.Variab
|
||||
i := items[ii]
|
||||
j := items[jj]
|
||||
|
||||
// 如果都是系统变量,这里不需要变换位置
|
||||
// If they are all system variables, there is no need to change positions here
|
||||
if i.IsSystem && !j.IsSystem {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user