diff --git a/searx/webapp.py b/searx/webapp.py index e87eb80e8..30b1a7390 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1377,9 +1377,9 @@ function modal_open(url, num) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -1713,10 +1713,10 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -1834,10 +1834,10 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -1922,10 +1922,10 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -2143,9 +2143,9 @@ fetch("https://search.kg/completions", optionsIntro) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTextRawPlusComment+=choices[0].content + chatTextRawPlusComment+=choices[0].delta.content } markdownToHtml(beautify(chatTextRawPlusComment), document.getElementById('chat')); @@ -2166,9 +2166,9 @@ fetch("https://search.kg/completions", optionsIntro) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTextRaw+=choices[0].content + chatTextRaw+=choices[0].delta.content } markdownToHtml(beautify(chatTextRaw), document.getElementById('chat')); @@ -2199,9 +2199,9 @@ fetch("https://search.kg/completions", optionsIntro) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTextRawIntro+=choices[0].content + chatTextRawIntro+=choices[0].delta.content } markdownToHtml(beautify(chatTextRawIntro+'\n'), document.getElementById('chat_intro')); diff --git a/searx/webapp1.py b/searx/webapp1.py index e87eb80e8..30b1a7390 100644 --- a/searx/webapp1.py +++ b/searx/webapp1.py @@ -1377,9 +1377,9 @@ function modal_open(url, num) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -1713,10 +1713,10 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -1834,10 +1834,10 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -1922,10 +1922,10 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTemp+=choices[0].content + chatTemp+=choices[0].delta.content } chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; @@ -2143,9 +2143,9 @@ fetch("https://search.kg/completions", optionsIntro) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTextRawPlusComment+=choices[0].content + chatTextRawPlusComment+=choices[0].delta.content } markdownToHtml(beautify(chatTextRawPlusComment), document.getElementById('chat')); @@ -2166,9 +2166,9 @@ fetch("https://search.kg/completions", optionsIntro) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTextRaw+=choices[0].content + chatTextRaw+=choices[0].delta.content } markdownToHtml(beautify(chatTextRaw), document.getElementById('chat')); @@ -2199,9 +2199,9 @@ fetch("https://search.kg/completions", optionsIntro) try{choices=JSON.parse(half+result)['choices'];half = '';} catch(e){choices=JSON.parse(result)['choices'];half = '';} }catch(e){half+=result} - if(choices && choices.length>0 && choices[0].content) + if(choices && choices.length>0 && choices[0].delta.content) { - chatTextRawIntro+=choices[0].content + chatTextRawIntro+=choices[0].delta.content } markdownToHtml(beautify(chatTextRawIntro+'\n'), document.getElementById('chat_intro'));