SimpleChatTC:Cleanup:ChatProps: Move bStream into it
This commit is contained in:
parent
a54fa472dd
commit
7409b29862
|
|
@ -177,17 +177,19 @@ It is attached to the document object. Some of these can also be updated using t
|
||||||
|
|
||||||
baseURL - the domain-name/ip-address and inturn the port to send the request.
|
baseURL - the domain-name/ip-address and inturn the port to send the request.
|
||||||
|
|
||||||
bStream - control between oneshot-at-end and live-stream-as-its-generated collating and showing
|
chatProps - maintain a set of properties which manipulate chatting with ai engine
|
||||||
of the generated response.
|
|
||||||
|
|
||||||
the logic assumes that the text sent from the server follows utf-8 encoding.
|
stream - control between oneshot-at-end and live-stream-as-its-generated collating and showing
|
||||||
|
of the generated response.
|
||||||
|
|
||||||
in streaming mode - if there is any exception, the logic traps the same and tries to ensure
|
the logic assumes that the text sent from the server follows utf-8 encoding.
|
||||||
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
|
in streaming mode - if there is any exception, the logic traps the same and tries to ensure
|
||||||
inturn the machine goes into power saving mode or so, the platform may stop network connection,
|
that text generated till then is not lost.
|
||||||
leading to exception.
|
|
||||||
|
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.
|
||||||
|
|
||||||
tools - contains controls related to tool calling
|
tools - contains controls related to tool calling
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ class SimpleChat {
|
||||||
for(let k in gMe.apiRequestOptions) {
|
for(let k in gMe.apiRequestOptions) {
|
||||||
obj[k] = gMe.apiRequestOptions[k];
|
obj[k] = gMe.apiRequestOptions[k];
|
||||||
}
|
}
|
||||||
if (gMe.bStream) {
|
if (gMe.chatProps.stream) {
|
||||||
obj["stream"] = true;
|
obj["stream"] = true;
|
||||||
}
|
}
|
||||||
if (gMe.tools.enabled) {
|
if (gMe.tools.enabled) {
|
||||||
|
|
@ -622,7 +622,7 @@ class SimpleChat {
|
||||||
*/
|
*/
|
||||||
async handle_response(resp, apiEP, elDiv) {
|
async handle_response(resp, apiEP, elDiv) {
|
||||||
let theResp = null;
|
let theResp = null;
|
||||||
if (gMe.bStream) {
|
if (gMe.chatProps.stream) {
|
||||||
try {
|
try {
|
||||||
theResp = await this.handle_response_multipart(resp, apiEP, elDiv);
|
theResp = await this.handle_response_multipart(resp, apiEP, elDiv);
|
||||||
this.latestResponse.clear();
|
this.latestResponse.clear();
|
||||||
|
|
@ -1015,11 +1015,13 @@ class Me {
|
||||||
this.baseURL = "http://127.0.0.1:8080";
|
this.baseURL = "http://127.0.0.1:8080";
|
||||||
this.defaultChatIds = [ "Default", "Other" ];
|
this.defaultChatIds = [ "Default", "Other" ];
|
||||||
this.multiChat = new MultiChatUI();
|
this.multiChat = new MultiChatUI();
|
||||||
this.bStream = true;
|
|
||||||
this.tools = {
|
this.tools = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
fetchProxyUrl: "http://127.0.0.1:3128"
|
fetchProxyUrl: "http://127.0.0.1:3128"
|
||||||
};
|
};
|
||||||
|
this.chatProps = {
|
||||||
|
stream: true,
|
||||||
|
}
|
||||||
this.bCompletionFreshChatAlways = true;
|
this.bCompletionFreshChatAlways = true;
|
||||||
this.bCompletionInsertStandardRolePrefix = false;
|
this.bCompletionInsertStandardRolePrefix = false;
|
||||||
this.bTrimGarbage = true;
|
this.bTrimGarbage = true;
|
||||||
|
|
@ -1092,9 +1094,9 @@ class Me {
|
||||||
* @param {boolean} bAll
|
* @param {boolean} bAll
|
||||||
*/
|
*/
|
||||||
show_info(elDiv, bAll=false) {
|
show_info(elDiv, bAll=false) {
|
||||||
let props = ["baseURL", "modelInfo","headers", "bStream", "tools", "apiRequestOptions", "apiEP", "iRecentUserMsgCnt", "bTrimGarbage", "bCompletionFreshChatAlways", "bCompletionInsertStandardRolePrefix"];
|
let props = ["baseURL", "modelInfo","headers", "tools", "apiRequestOptions", "apiEP", "chatProps", "iRecentUserMsgCnt", "bTrimGarbage", "bCompletionFreshChatAlways", "bCompletionInsertStandardRolePrefix"];
|
||||||
if (!bAll) {
|
if (!bAll) {
|
||||||
props = [ "baseURL", "modelInfo", "headers", "bStream", "tools", "apiRequestOptions", "apiEP", "iRecentUserMsgCnt" ];
|
props = [ "baseURL", "modelInfo", "headers", "tools", "apiRequestOptions", "apiEP", "chatProps", "iRecentUserMsgCnt" ];
|
||||||
}
|
}
|
||||||
fetch(`${this.baseURL}/props`).then(resp=>resp.json()).then(json=>{
|
fetch(`${this.baseURL}/props`).then(resp=>resp.json()).then(json=>{
|
||||||
this.modelInfo = {
|
this.modelInfo = {
|
||||||
|
|
@ -1110,7 +1112,7 @@ class Me {
|
||||||
* @param {HTMLDivElement} elDiv
|
* @param {HTMLDivElement} elDiv
|
||||||
*/
|
*/
|
||||||
show_settings(elDiv) {
|
show_settings(elDiv) {
|
||||||
ui.ui_show_obj_props_edit(elDiv, "", this, ["baseURL", "headers", "bStream", "tools", "apiRequestOptions", "apiEP", "iRecentUserMsgCnt", "bTrimGarbage", "bCompletionFreshChatAlways", "bCompletionInsertStandardRolePrefix"], "Settings", (prop, elProp)=>{
|
ui.ui_show_obj_props_edit(elDiv, "", this, ["baseURL", "headers", "tools", "apiRequestOptions", "apiEP", "chatProps", "iRecentUserMsgCnt", "bTrimGarbage", "bCompletionFreshChatAlways", "bCompletionInsertStandardRolePrefix"], "Settings", (prop, elProp)=>{
|
||||||
if (prop == "headers:Authorization") {
|
if (prop == "headers:Authorization") {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
elProp.placeholder = "Bearer OPENAI_API_KEY";
|
elProp.placeholder = "Bearer OPENAI_API_KEY";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue