XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Improve show result in gui

84b3a19c
Heiner Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +10 -6
Modified g4f/gui/client/js/chat.v1.js +10 -6
@@ -268,6 +268,11 @@ const ask_gpt = async () => {
268 268 }
269 269 }
270 270 if (!error) {
271 // Remove cursor
272 html = markdown_render(text);
273 content_inner.innerHTML = html;
274 highlight(content_inner);
275
271 276 if (imageInput) imageInput.value = "";
272 277 if (cameraInput) cameraInput.value = "";
273 278 if (fileInput) fileInput.value = "";
@@ -275,20 +280,19 @@ const ask_gpt = async () => {
275 280 } catch (e) {
276 281 console.error(e);
277 282
278 if (e.name != `AbortError`) {
279 text = `oops ! something went wrong, please try again / reload. [stacktrace in console]`;
283 if (e.name != "AbortError") {
284 error = true;
285 text = "oops ! something went wrong, please try again / reload. [stacktrace in console]";
280 286 content_inner.innerHTML = text;
281 287 } else {
282 288 content_inner.innerHTML += ` [aborted]`;
283 289 text += ` [aborted]`
284 290 }
285 291 }
286 let cursorDiv = document.getElementById(`cursor`);
287 if (cursorDiv) cursorDiv.parentNode.removeChild(cursorDiv);
288 if (text) {
292 if (!error) {
289 293 await add_message(window.conversation_id, "assistant", text, provider);
294 await load_conversation(window.conversation_id);
290 295 }
291 await load_conversation(window.conversation_id);
292 296 message_box.scrollTop = message_box.scrollHeight;
293 297 await remove_cancel_button();
294 298 await register_remove_message();