fix: streaming diff timestamp map is nil (#2185)

This commit is contained in:
yetone
2025-06-07 16:58:30 +08:00
committed by GitHub
parent a2f31bd2e2
commit fc0cfb5ec6

View File

@@ -113,9 +113,9 @@ function M.func(opts, on_log, on_complete, session_ctx)
local is_streaming = opts.streaming or false
session_ctx.prev_streaming_diff_timestamp_map = session_ctx.prev_streaming_diff_timestamp_map or {}
local current_timestamp = os.time()
if is_streaming then
session_ctx.prev_streaming_diff_timestamp_map = session_ctx.prev_streaming_diff_timestamp_map or {}
local prev_streaming_diff_timestamp = session_ctx.prev_streaming_diff_timestamp_map[opts.tool_use_id]
if prev_streaming_diff_timestamp ~= nil then
if current_timestamp - prev_streaming_diff_timestamp < 2 then