fix: correct token calculation error caused by ctxcache init (#559)
This commit is contained in:
@@ -32,7 +32,6 @@ import (
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/execute"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes/llm"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/ctxcache"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
)
|
||||
|
||||
@@ -47,8 +46,6 @@ func (r *WorkflowRunner) designateOptions(ctx context.Context) (context.Context,
|
||||
sw = r.streamWriter
|
||||
)
|
||||
|
||||
const tokenCallbackKey = "token_callback_key"
|
||||
|
||||
if wb.AppID != nil && exeCfg.AppID == nil {
|
||||
exeCfg.AppID = wb.AppID
|
||||
}
|
||||
@@ -124,12 +121,6 @@ func (r *WorkflowRunner) designateOptions(ctx context.Context) (context.Context,
|
||||
opts = append(opts, einoCompose.WithCheckPointID(strconv.FormatInt(executeID, 10)))
|
||||
}
|
||||
|
||||
if !ctxcache.HasKey(ctx, tokenCallbackKey) {
|
||||
opts = append(opts, einoCompose.WithCallbacks(execute.GetTokenCallbackHandler()))
|
||||
ctx = ctxcache.Init(ctx)
|
||||
ctxcache.Store(ctx, tokenCallbackKey, true)
|
||||
}
|
||||
|
||||
return ctx, opts, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user