Refactor context ID generation to use UUID
- Replace the existing NanoID generation in generateContextID with UUID for improved uniqueness. - Update RequestID method to return the context ID directly instead of generating a new NanoID. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
702b743de7
commit
3d7b0a2dbd
1 changed files with 3 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/yaoapp/yao/agent/memory"
|
"github.com/yaoapp/yao/agent/memory"
|
||||||
"github.com/yaoapp/yao/agent/output/message"
|
"github.com/yaoapp/yao/agent/output/message"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
|
|
@ -410,12 +411,12 @@ func SendInterrupt(contextID string, signal *InterruptSignal) error {
|
||||||
|
|
||||||
// generateContextID generates a unique context ID
|
// generateContextID generates a unique context ID
|
||||||
func generateContextID() string {
|
func generateContextID() string {
|
||||||
return message.GenerateNanoID()
|
return uuid.New().String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestID returns a unique request ID using NanoID
|
// RequestID returns a unique request ID using NanoID
|
||||||
func (ctx *Context) RequestID() string {
|
func (ctx *Context) RequestID() string {
|
||||||
return message.GenerateNanoID()
|
return ctx.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// TraceID returns the trace ID for the context
|
// TraceID returns the trace ID for the context
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue