From df53728e05129278d6ea26271ec086aa013bed90 Mon Sep 17 00:00:00 2001 From: WanTong Date: Wed, 6 Mar 2024 18:39:21 +0800 Subject: [PATCH] fix: json decode (#396) --- 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 c005806a..76f78a54 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