fix: construct handler opts in the parse function (#78)
This commit is contained in:
parent
b71e43d69e
commit
5c57daea2e
@ -488,7 +488,6 @@ M.stream = function(question, code_lang, code_content, selected_content_content,
|
|||||||
code_content = code_content,
|
code_content = code_content,
|
||||||
selected_code_content = selected_content_content,
|
selected_code_content = selected_content_content,
|
||||||
}
|
}
|
||||||
local handler_opts = { on_chunk = on_chunk, on_complete = on_complete, event_state = nil }
|
|
||||||
|
|
||||||
---@type AvanteCurlOutput
|
---@type AvanteCurlOutput
|
||||||
local spec = nil
|
local spec = nil
|
||||||
@ -510,6 +509,7 @@ M.stream = function(question, code_lang, code_content, selected_content_content,
|
|||||||
|
|
||||||
---@param line string
|
---@param line string
|
||||||
local function parse_and_call(line)
|
local function parse_and_call(line)
|
||||||
|
local handler_opts = { on_chunk = on_chunk, on_complete = on_complete, event_state = nil }
|
||||||
local event = line:match("^event: (.+)$")
|
local event = line:match("^event: (.+)$")
|
||||||
if event then
|
if event then
|
||||||
handler_opts.event_state = event
|
handler_opts.event_state = event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user