fix: escape original_content (#5)
This commit is contained in:
parent
0b6a85ee64
commit
1634abb9cd
@ -353,6 +353,7 @@ local function call_openai_api_stream(question, code_lang, code_content, on_chun
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function call_ai_api_stream(question, code_lang, code_content, on_chunk, on_complete)
|
local function call_ai_api_stream(question, code_lang, code_content, on_chunk, on_complete)
|
||||||
|
code_content = utils.escape(code_content)
|
||||||
if M.config.provider == "openai" or M.config.provider == "azure" then
|
if M.config.provider == "openai" or M.config.provider == "azure" then
|
||||||
call_openai_api_stream(question, code_lang, code_content, on_chunk, on_complete)
|
call_openai_api_stream(question, code_lang, code_content, on_chunk, on_complete)
|
||||||
elseif M.config.provider == "claude" then
|
elseif M.config.provider == "claude" then
|
||||||
|
@ -4,4 +4,8 @@ function M.trim_suffix(str, suffix)
|
|||||||
return string.gsub(str, suffix .. "$", "")
|
return string.gsub(str, suffix .. "$", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.escape(str)
|
||||||
|
return string.gsub(str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1")
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
Loading…
x
Reference in New Issue
Block a user