bugfix
This commit is contained in:
parent
c5812e8762
commit
9f3b4cf05d
0
bricks/build.sh
Normal file → Executable file
0
bricks/build.sh
Normal file → Executable file
@ -360,7 +360,12 @@ bricks.UiImage =class extends bricks.VBox {
|
||||
this.imgw = null;
|
||||
}
|
||||
take_photo(){
|
||||
var camera = new bricks.Camera({});
|
||||
var camera = new bricks.Camera({
|
||||
"archor":"cc",
|
||||
"auto_open":true,
|
||||
"height":"90%",
|
||||
"width":"90%"
|
||||
});
|
||||
camera.bind('shot', function(d){
|
||||
if (this.imgw){
|
||||
this.remove_widget(this.imgw);
|
||||
|
@ -157,9 +157,7 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
||||
constructor(llmio, opts){
|
||||
super(opts);
|
||||
this.llmio = llmio;
|
||||
if (opts.use_session){
|
||||
this.messages = [];
|
||||
}
|
||||
this.messages = [];
|
||||
}
|
||||
render_title(){
|
||||
var w = new bricks.HBox({});
|
||||
@ -174,6 +172,9 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
||||
|
||||
}
|
||||
async model_inputed(data){
|
||||
if (!opts.use_session){
|
||||
this.messages = [];
|
||||
}
|
||||
var mout = new bricks.ModelOutput({
|
||||
textvoice:this.textvoice,
|
||||
tts_url:this.tts_url,
|
||||
@ -184,20 +185,12 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
||||
var fmt = this.opts.user_message_format || { role:'user', content:'${prompt}'};
|
||||
var umsg = bricks.apply_data(fmt, data);
|
||||
var d = data;
|
||||
if (this.messages){
|
||||
this.messages.push(umsg);
|
||||
d = bricks.extend({}, data);
|
||||
d.messages = this.messages;
|
||||
d.model = this.opts.model;
|
||||
d.modelinstanceid = this.opts.modelinstanceid;
|
||||
d.modeltypeid = this.opts.modeltypeid;
|
||||
} else {
|
||||
d = bricks.extend({}, data);
|
||||
d.model = this.opts.model;
|
||||
d.mapi = this.mapi;
|
||||
d.modelinstanceid = this.opts.modelinstanceid;
|
||||
d.modeltypeid = this.opts.modeltypeid;
|
||||
}
|
||||
this.messages.push(umsg);
|
||||
d = {};
|
||||
d.messages = this.messages;
|
||||
d.model = this.opts.model;
|
||||
d.modelinstanceid = this.opts.modelinstanceid;
|
||||
d.modeltypeid = this.opts.modeltypeid;
|
||||
console.log('upload data=', d, this.options);
|
||||
if (this.response_mode == 'stream' || this.response_mode == 'async') {
|
||||
var hr = new bricks.HttpResponseStream();
|
||||
|
@ -96,13 +96,12 @@ bricks.LlmMsgBox = class extends bricks.HBox {
|
||||
var d = {
|
||||
messages:this.messages,
|
||||
mapi:this.mapi,
|
||||
prompt:prompt,
|
||||
model:this.model,
|
||||
}
|
||||
// console.log('messages=', this.messages, 'msg=', msg, 'umsg=', umsg);
|
||||
if (this.response_mode == 'stream') {
|
||||
var hr = new bricks.HttpResponseStream();
|
||||
var resp = await hr.post(this.url, {params:d});
|
||||
var resp = await hr.post(this.url, {data:d});
|
||||
this.responsed();
|
||||
await hr.handle_chunk(resp, this.chunk_response.bind(this));
|
||||
this.chunk_ended();
|
||||
|
Loading…
Reference in New Issue
Block a user