bugfix
This commit is contained in:
parent
d3b1a1f75b
commit
03179fa970
@ -94,7 +94,7 @@ bricks.HttpText = class {
|
|||||||
var data = this.add_own_params(params);
|
var data = this.add_own_params(params);
|
||||||
var header = this.add_own_headers(headers);
|
var header = this.add_own_headers(headers);
|
||||||
var _params = {
|
var _params = {
|
||||||
"method":method,
|
method:method
|
||||||
}
|
}
|
||||||
// _params.headers = headers;
|
// _params.headers = headers;
|
||||||
if (method == 'GET' || method == 'HEAD') {
|
if (method == 'GET' || method == 'HEAD') {
|
||||||
|
@ -57,7 +57,7 @@ bricks.ModelOutput = class extends bricks.HBox {
|
|||||||
var icon = event.target.bricks_widget;
|
var icon = event.target.bricks_widget;
|
||||||
icon.rate = 2;
|
icon.rate = 2;
|
||||||
icon.charsize_sizing();
|
icon.charsize_sizing();
|
||||||
w = await bricks.widgetBuild(desc, this);
|
var w = await bricks.widgetBuild(desc, this);
|
||||||
this.estimate_w.disabled(true);
|
this.estimate_w.disabled(true);
|
||||||
}
|
}
|
||||||
async update_data(data){
|
async update_data(data){
|
||||||
@ -65,6 +65,7 @@ bricks.ModelOutput = class extends bricks.HBox {
|
|||||||
this.run.stop_timepass();
|
this.run.stop_timepass();
|
||||||
this.remove_widget(this.run);
|
this.remove_widget(this.run);
|
||||||
}
|
}
|
||||||
|
console.log('update_data():data=', data);
|
||||||
this.run = null;
|
this.run = null;
|
||||||
var w = await bricks.widgetBuild(this.output_view, this.llmio, data);
|
var w = await bricks.widgetBuild(this.output_view, this.llmio, data);
|
||||||
w.set_css('llm_msg');
|
w.set_css('llm_msg');
|
||||||
@ -140,7 +141,7 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
|||||||
d.modeltypeid = this.opts.modeltypeid;
|
d.modeltypeid = this.opts.modeltypeid;
|
||||||
}
|
}
|
||||||
console.log('upload data=', d, this.options);
|
console.log('upload data=', d, this.options);
|
||||||
if (this.response_mode == 'stream') {
|
if (this.response_mode == 'stream' || this.response_mode == 'async') {
|
||||||
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));
|
||||||
@ -177,6 +178,7 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
|||||||
d.content = bricks.escapeSpecialChars(d.content);
|
d.content = bricks.escapeSpecialChars(d.content);
|
||||||
this.resp_data = d;
|
this.resp_data = d;
|
||||||
mout.update_data(d);
|
mout.update_data(d);
|
||||||
|
console.log('stream data=', d);
|
||||||
}
|
}
|
||||||
chunk_ended(){
|
chunk_ended(){
|
||||||
if (! this.messages) {
|
if (! this.messages) {
|
||||||
|
@ -39,7 +39,6 @@ bricks.Video = class extends bricks.Layout {
|
|||||||
this.hidedbtn = new bricks.Button({text:'click me'});
|
this.hidedbtn = new bricks.Button({text:'click me'});
|
||||||
this.hidedbtn.hide();
|
this.hidedbtn.hide();
|
||||||
this.add_widget(this.hidedbtn);
|
this.add_widget(this.hidedbtn);
|
||||||
this.hidedbtn.bind('click', this.play.bind(this));
|
|
||||||
}
|
}
|
||||||
destroy_resource(params, event){
|
destroy_resource(params, event){
|
||||||
var w = event.target.bricks_widget;
|
var w = event.target.bricks_widget;
|
||||||
@ -61,24 +60,25 @@ bricks.Video = class extends bricks.Layout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto_play(){
|
auto_play(){
|
||||||
this.hidedbtn.dispatch('click');
|
|
||||||
schedule_once(this.disable_captions.bind(this), 2);
|
schedule_once(this.disable_captions.bind(this), 2);
|
||||||
this.player.on('error',this.report_error.bind(this));
|
this.player.on('error',this.report_error.bind(this));
|
||||||
this.player.on('play', this.report_playok.bind(this));
|
this.player.on('play', this.report_playok.bind(this));
|
||||||
this.player.on('ended', this.report_ended.bind(this));
|
this.player.on('ended', this.report_ended.bind(this));
|
||||||
|
this.hidedbtn.dispatch('click');
|
||||||
}
|
}
|
||||||
play(){
|
play(){
|
||||||
this.player.play();
|
this.player.play();
|
||||||
}
|
}
|
||||||
create_player(){
|
create_player(){
|
||||||
this.player = videojs(this.video_body.dom_element, {
|
if(this.url){
|
||||||
controls:true,
|
this.player = videojs(this.video_body.dom_element, {
|
||||||
nativeTextTracks:false,
|
controls:true,
|
||||||
textTrackSettings: false
|
nativeTextTracks:false,
|
||||||
});
|
textTrackSettings: false
|
||||||
|
});
|
||||||
this.player.ready(this.auto_play.bind(this));
|
this.player.ready(this.auto_play.bind(this));
|
||||||
this._set_source();
|
this._set_source();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
report_ended(){
|
report_ended(){
|
||||||
this.dispatch('play_end',{src:this.video_body.cur_url,type:this.video_body.cur_vtype});
|
this.dispatch('play_end',{src:this.video_body.cur_url,type:this.video_body.cur_vtype});
|
||||||
@ -92,15 +92,19 @@ bricks.Video = class extends bricks.Layout {
|
|||||||
this.dispatch('play_failed', {'src':this.video_body.cur_url, type:this.video_body.cur_vtype});
|
this.dispatch('play_failed', {'src':this.video_body.cur_url, type:this.video_body.cur_vtype});
|
||||||
}
|
}
|
||||||
_set_source(){
|
_set_source(){
|
||||||
this.player.src({
|
if (this.player){
|
||||||
src:this.video_body.cur_url,
|
this.player.src({
|
||||||
type:this.video_body.cur_vtype
|
src:this.video_body.cur_url,
|
||||||
});
|
type:this.video_body.cur_vtype
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
set_source(url, vtype){
|
set_source(url, vtype){
|
||||||
this.video_body.cur_url = url;
|
if(this.player){
|
||||||
this.video_body.cur_vtype = vtype;
|
this.video_body.cur_url = url;
|
||||||
this._set_source();
|
this.video_body.cur_vtype = vtype;
|
||||||
|
this._set_source();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user