This commit is contained in:
yumoqing 2024-06-17 21:03:34 +08:00
parent ae710ddc10
commit 09eb4e09a9

View File

@ -30,7 +30,7 @@ bricks.ModelOutput = class extends bricks.HBox {
}
}
bricks.LlmModel {
bricks.LlmModel = class {
/*
{
icon:
@ -64,10 +64,10 @@ bricks.LlmModel {
this.llmmodels.forEach(lm => {
var tw = ml.render_title();
w.add_widget(tw);
}
});
return w;
}
model_inputed(data){
async model_inputed(data){
var mout = new bricks.ModelOutput({icon:this.opts.icon, output_view:this.opts.output_view});
this.llmio.o_w.add_widget(mout);
var fmt = this.opts.user_message_format || { role:'user', content:'${prompt}'};
@ -146,7 +146,7 @@ bricks.LlmModel {
this.messages.push(lmsg);
}
}
bircks.LlmIO = class extends bricks.VBox {
bricks.LlmIO = class extends bricks.VBox {
/*
options:
{
@ -177,7 +177,7 @@ bircks.LlmIO = class extends bricks.VBox {
this.models.forEach( m =>{
var lm = new bricks.LlmModel(this, m);
this.llmmodels.push(lm);
}
});
this.title_w = new bricks.HBox({cheight:2});
this.i_w = new bricks.VBox({cheight:5});
this.o_w = new bricks.Filler({});
@ -189,11 +189,12 @@ bircks.LlmIO = class extends bricks.VBox {
async handle_input(event){
var params = event.params;
await this.show_input(params);
this.llmmodels.forEach(lm => {
for(var i=0;i<this.llmmodels.length;i++){
var lm = this.llmmodels[i];
if (lm.is_accept_source('userinput')){
lm.model_inputed(params);
await lm.model_inputed(params);
}
})
};
}
async show_input(params){
var box = new bricks.HBox({width:'100%'});