Revert "fix: construct handler opts in the parse function" (#79)
This reverts commit 5c57daea2e9cfbeed428d4d01d71bd8b08549953.
This commit is contained in:
		
							parent
							
								
									5c57daea2e
								
							
						
					
					
						commit
						c5b8662835
					
				@ -488,6 +488,7 @@ 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
 | 
				
			||||||
@ -509,7 +510,6 @@ 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