Merge pull request #1447 from trheyi/main
Refactor context ID generation to use UUID
This commit is contained in:
commit
7da36965c7
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