feat: 新增会话与结果管理功能及扩展字段

重构执行列表树状结构,扁平化日期节点下的输出项,新增会话列表查询、结果删除与软删除标记,引入扩展字段与模板配置,升级依赖版本。
This commit is contained in:
2026-07-08 09:22:54 +08:00
parent 4ccb81b34a
commit 14c88efe79
13 changed files with 257 additions and 122 deletions
+33 -3
View File
@@ -413,7 +413,9 @@ func GetModelResult(ctx context.Context, sessionId string, nodeInput *flowDto.No
// 加锁写入map,解决并发竞态
mu.Lock()
fmt.Println("taskResult======================", idx, taskResult)
mapTaskResult[idx] = taskResult
fmt.Println("mapTaskResult======================", mapTaskResult)
mu.Unlock()
//updateTokenCount(ctx, nodeInput.NodeExecutionId, modelInfo.Model.ResponseTokenField, taskResult)
@@ -440,13 +442,17 @@ func GetModelResult(ctx context.Context, sessionId string, nodeInput *flowDto.No
//updateTokenCount(ctx, nodeInput.NodeExecutionId, modelInfo.Model.ResponseTokenField, item)
}
}
fmt.Println("mapTaskResult--------------------------------------", mapTaskResult)
return mapTaskResult, nil
}
func BuildNestedJson(body g.Map, mockConfigMap map[string]*entity.FlowNode) g.Map {
func BuildNestedJson(body g.Map, global *flowDto.FlowExecutionInput) g.Map {
jsonStr := "{}"
for originKey, originItem := range body {
if originKey == "templates" && !g.IsEmpty(global.Templates) {
jsonStr, _ = sjson.Set(jsonStr, originKey, global.Templates)
continue
}
bodyItemMap := gconv.Map(originItem)
val := bodyItemMap["value"]
if v, ok := bodyItemMap["value"]; ok {
@@ -457,7 +463,7 @@ func BuildNestedJson(body g.Map, mockConfigMap map[string]*entity.FlowNode) g.Ma
valMap := gconv.Map(val)
nodeId := gconv.String(valMap["nodeId"])
fieldName := gconv.String(valMap["field"])
if configValue, ok := mockConfigMap[nodeId]; ok {
if configValue, ok := global.ConfigMap[nodeId]; ok {
if !g.IsEmpty(configValue.OutputResult) {
for _, v := range configValue.OutputResult {
if strings.Contains(v.Field, fieldName) {
@@ -659,6 +665,30 @@ func GetUrlSuffix(rawUrl string, withDot bool) string {
return suffix
}
// ProcessPath 处理请求路径
// 1. 判断是否为合法完整请求路径(以/开头)
// 2. 包含 tenantId-1 则截断其及前面所有内容
func ProcessPath(ctx context.Context, path string) string {
// 判断是否是完整请求路径:以 / 开头
if strings.HasPrefix(path, "/") {
return path
}
target, err := utils.GetBucketName(ctx)
if err != nil {
return path
}
idx := strings.Index(path, target)
if idx == -1 {
// 不包含目标字符串,原样返回
return path
}
// 截取 tenantId-1 后面的内容
newPath := path[idx+len(target):]
return newPath
}
func BuildText(text string) string {
// 生成单条HTML
var htmlBuilder strings.Builder