From 475981e93c1fbe75e52be393cc5951e4b5ad978b Mon Sep 17 00:00:00 2001 From: WanTong Date: Wed, 28 Feb 2024 12:07:08 +0800 Subject: [PATCH] fix: json decode --- lua/chatgpt/api.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/chatgpt/api.lua b/lua/chatgpt/api.lua index 596dd932..497ce34d 100644 --- a/lua/chatgpt/api.lua +++ b/lua/chatgpt/api.lua @@ -54,7 +54,12 @@ function Api.chat_completions(custom_params, cb, should_stop) if raw_json == "[DONE]" then cb(raw_chunks, "END") else - ok, json = pcall(vim.json.decode, raw_json) + ok, json = pcall(vim.json.decode, raw_json, { + luanil = { + object = true, + array = true, + }, + }) if ok and json ~= nil then if json