diff --git a/examples/server/public_simplechat/readme.md b/examples/server/public_simplechat/readme.md index 83dec817d..1643485f8 100644 --- a/examples/server/public_simplechat/readme.md +++ b/examples/server/public_simplechat/readme.md @@ -108,6 +108,9 @@ Once inside * Using NewChat one can start independent chat sessions. * two independent chat sessions are setup by default. +* When you want to print, switching ChatHistoryInCtxt to Full and clicking on the chat session button of + interest, will display the full chat history till then wrt same, if you want full history for printing. + ## Devel note @@ -135,6 +138,13 @@ It is attached to the document object. Some of these can also be updated using t the logic assumes that the text sent from the server follows utf-8 encoding. + in streaming mode - if there is any exception, the logic traps the same and tries to ensure + that text generated till then is not lost. + + if a very long text is being generated, which leads to no user interaction for sometime and + inturn the machine goes into power saving mode or so, the platform may stop network connection, + leading to exception. + apiEP - select between /completions and /chat/completions endpoint provided by the server/ai-model. bCompletionFreshChatAlways - whether Completion mode collates complete/sliding-window history when diff --git a/examples/server/public_simplechat/simplechat.js b/examples/server/public_simplechat/simplechat.js index d77e27108..298ec8e60 100644 --- a/examples/server/public_simplechat/simplechat.js +++ b/examples/server/public_simplechat/simplechat.js @@ -428,6 +428,8 @@ class SimpleChat { this.latestResponse = ""; } catch (error) { theResp.assistant = this.latestResponse; + this.add(Roles.Assistant, theResp.assistant); + this.latestResponse = ""; throw error; } } else { @@ -438,6 +440,7 @@ class SimpleChat { theResp.assistant = du.trim_garbage_at_end(origMsg); theResp.trimmed = origMsg.substring(theResp.assistant.length); } + this.add(Roles.Assistant, theResp.assistant); return theResp; } @@ -601,7 +604,6 @@ class MultiChatUI { }); let theResp = await chat.handle_response(resp, apiEP, this.elDivChat); - chat.add(Roles.Assistant, theResp.assistant); if (chatId == this.curChatId) { chat.show(this.elDivChat); if (theResp.trimmed.length > 0) {