bugfix
This commit is contained in:
parent
a830bd6690
commit
656611ee23
@ -213,7 +213,7 @@ bricks.HttpResponseStream = class extends bricks.HttpResponse {
|
|||||||
buff_ += text;
|
buff_ += text;
|
||||||
const lines = buff_.split('\n');
|
const lines = buff_.split('\n');
|
||||||
for (var i=0;i<lines.length - 1; i++){
|
for (var i=0;i<lines.length - 1; i++){
|
||||||
console.log('line=', lines[i]);
|
// console.log('line=', lines[i]);
|
||||||
handler(lines[i]);
|
handler(lines[i]);
|
||||||
}
|
}
|
||||||
buff_ = lines[lines.length - 1];
|
buff_ = lines[lines.length - 1];
|
||||||
|
@ -87,7 +87,7 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
|||||||
var hr = new bricks.HttpResponseStream();
|
var hr = new bricks.HttpResponseStream();
|
||||||
var resp = await hr.post(this.opts.url, {params:d});
|
var resp = await hr.post(this.opts.url, {params:d});
|
||||||
await hr.handle_chunk(resp, this.chunk_response.bind(this, mout));
|
await hr.handle_chunk(resp, this.chunk_response.bind(this, mout));
|
||||||
this.chunk_ended(mout);
|
this.chunk_ended();
|
||||||
} else {
|
} else {
|
||||||
var hj = new bricks.HttpJson()
|
var hj = new bricks.HttpJson()
|
||||||
var resp = await hj.post(this.opts.url, {params:d});
|
var resp = await hj.post(this.opts.url, {params:d});
|
||||||
@ -122,12 +122,14 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
|||||||
mout.update_data(d);
|
mout.update_data(d);
|
||||||
}
|
}
|
||||||
chunk_ended(){
|
chunk_ended(){
|
||||||
if (! this.messages) return;
|
if (! this.messages) {
|
||||||
|
console.log('this.messages is null !!!!!!!!!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
var msg = this.llm_msg_format();
|
var msg = this.llm_msg_format();
|
||||||
var merge_field = this.opts.merge_field || 'content';
|
|
||||||
var txt = bricks.escapeSpecialChars(this.resp_data.content)
|
var txt = bricks.escapeSpecialChars(this.resp_data.content)
|
||||||
this.resp_data.content = txt;
|
this.resp_data.content = txt;
|
||||||
var lmsg = bricks.apply_data(msg, this.this.resp_data);
|
var lmsg = bricks.apply_data(msg, this.resp_data);
|
||||||
this.messages.push(lmsg);
|
this.messages.push(lmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user