Go: refactor UUID functions (#16695)

As title

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-07 17:22:08 +08:00
committed by GitHub
parent 5236c8f659
commit 7df7384b21
38 changed files with 104 additions and 170 deletions

View File

@@ -52,12 +52,11 @@ import (
"encoding/json"
"errors"
"fmt"
"ragflow/internal/utility"
"runtime/debug"
"strings"
"sync"
"time"
"github.com/google/uuid"
"go.uber.org/zap"
"ragflow/internal/agent/runtime"
@@ -250,13 +249,13 @@ func (r *Runner) Run(
// message_id is generated per-run so the front-end can correlate
// all events for a single user turn. task_id is the published
// version id (if available) or a per-run UUID.
messageID := strings.ReplaceAll(uuid.New().String(), "-", "")
messageID := utility.GenerateToken()
taskID := ""
if v, ok := root["version_id"].(string); ok && v != "" {
taskID = v
}
if taskID == "" {
taskID = strings.ReplaceAll(uuid.New().String(), "-", "")
taskID = utility.GenerateToken()
}
// Inject the output channel + metadata so the RunFunc can emit