This commit is contained in:
yumoqing 2024-07-12 17:06:01 +08:00
parent 48982ac6d9
commit aa87271637
4 changed files with 50 additions and 14 deletions

View File

@ -47,13 +47,12 @@ bricks.IconBar = class extends bricks.HBox {
dynsize:opts.dynsize||true dynsize:opts.dynsize||true
}); });
} }
var w = new bricks.Icon({ var opts1 = bricks.extend({}, opts);
url:opts.icon, opts1.url = opts.icon;
rate:opts.rate || rate, opts1.rate = opts.rate || rate;
dynsize:opts.dynsize||true, opts1.dynsize = opts.dynsize||true;
tip:opts.tip var w = new bricks.Icon(opts1);
}); w.bind('click', this.regen_event.bind(this, opts1));
w.bind('click', this.regen_event.bind(this,opts));
return w; return w;
} }
regen_event(desc, event){ regen_event(desc, event){

View File

@ -78,11 +78,16 @@ bricks.LlmModel = class extends bricks.JsWidget {
d = bricks.extend({}, data); d = bricks.extend({}, data);
d.messages = this.messages; d.messages = this.messages;
d.model = this.opts.model; d.model = this.opts.model;
d.modelinstanceid = this.opts.modelinstanceid;
d.modeltypeid = this.opts.modeltypeid;
} else { } else {
d = bricks.extend({}, data); d = bricks.extend({}, data);
d.model = this.opts.model; d.model = this.opts.model;
d.mapi = this.mapi; d.mapi = this.mapi;
d.modelinstanceid = this.opts.modelinstanceid;
d.modeltypeid = this.opts.modeltypeid;
} }
console.log('upload data=', d, this.options);
if (this.response_mode == 'stream') { if (this.response_mode == 'stream') {
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});
@ -181,7 +186,8 @@ bricks.LlmIO = class extends bricks.VBox {
for(var i=0;i<this.llmmodels.length;i++){ for(var i=0;i<this.llmmodels.length;i++){
var lm = this.llmmodels[i]; var lm = this.llmmodels[i];
if (lm.is_accept_source('userinput')){ if (lm.is_accept_source('userinput')){
await lm.model_inputed(params); schedule_once(lm.model_inputed.bind(lm, params), 0.01);
// await lm.model_inputed(params);
} }
}; };
} }

View File

@ -172,7 +172,7 @@ bricks.Tree = class extends bricks.VScrollPanel {
this.multitype_tree = this.opts.multitype_tree||false; this.multitype_tree = this.opts.multitype_tree||false;
this.selected_node = null; this.selected_node = null;
this.create_toolbar(); this.create_toolbar();
this.checked_nodes = []; this.checked_data = [];
this.container = new bricks.VBox({ this.container = new bricks.VBox({
"width":"100%", "width":"100%",
"height":"auto", "height":"auto",
@ -221,11 +221,37 @@ bricks.Tree = class extends bricks.VScrollPanel {
return; return;
} }
toolbar.tools = tools; toolbar.tools = tools;
this.toolbar_w = new bricks.IconBar(toolbar); this.toolbar_w = new bricks.IconTextBar(toolbar);
this.add_widget(this.toolbar_w); this.add_widget(this.toolbar_w);
this.toolbar_w.bind('add', this.add_new_node.bind(this)); this.toolbar_w.bind('command', this.toolbar_command.bind(this))
this.toolbar_w.bind('delete', this.delete_node.bind(this)); }
this.toolbar_w.bind('update', this.update_node.bind(this)); toolbar_command(event){
var opts = event.params;
switch (opts.name){
case 'add':
this.add_new_node();
breaks;
case 'delete':
this.delete_node();
break;
case 'update':
this.update_node();
break;
default:
console.log('opts=', opts);
var d = null;
if (opts.checked_data){
d = {
checked_data:JSON.stringify(this.checked_data)
}
} else if (opts.selected_node){
d = {
selected_data:JSON.stringify(this.selected_node.user_data)
}
}
this.dispatch(opts.name, d);
break;
}
} }
async add_new_node(){ async add_new_node(){
var w = new bricks.ModalForm({ var w = new bricks.ModalForm({
@ -428,6 +454,11 @@ bricks.Tree = class extends bricks.VScrollPanel {
async node_checked(node, event){ async node_checked(node, event){
var cb = event.target.bricks_widget; var cb = event.target.bricks_widget;
var stat = cb.getValue().check; var stat = cb.getValue().check;
if (stat){
this.checked_data.push(node.user_data);
} else {
this.checked_data = this.checked_data.filter((d , idnex) => d.id == node.user_data.id);
}
node.user_data[this.checkField] = stat; node.user_data[this.checkField] = stat;
if (stat){ if (stat){
console.log('value=', cb.getValue(), 'node=', node); console.log('value=', cb.getValue(), 'node=', node);

View File

@ -399,7 +399,7 @@ bricks.Tooltip = class extends bricks.Text {
if (ey < (ysize / 2)) { if (ey < (ysize / 2)) {
y = ey + bricks.app.charsize; y = ey + bricks.app.charsize;
} else { } else {
x = ey - mys - bricks.app.charsize; y = ey - mys - bricks.app.charsize;
} }
this.set_style('left', x + 'px'); this.set_style('left', x + 'px');
this.set_style('top', y + 'px'); this.set_style('top', y + 'px');