Compare commits

...

2 Commits

Author SHA1 Message Date
yumoqing
8462fdfe8d bigfix 2024-12-13 18:07:26 +08:00
yumoqing
05bea86069 bugfix 2024-12-13 18:07:16 +08:00
5 changed files with 38 additions and 9 deletions

View File

@ -48,9 +48,20 @@ params:
*/
bricks.uuid = function(){
try{
var d = crypto.randomUUID();
var lst = d.split('-');
return lst.join('');
} catch(e) {
const vv = '1234567890qwertyuiopasdfghjklzxcvbnm';
var ret = '';
for (var i=0;i<30;i++){
var j = parseInt(Math.random() * vv.length);
ret = ret + vv[j];
}
console.log('uuid() return', ret);
return ret;
}
}
bricks.deviceid = function(appname){
@ -522,6 +533,11 @@ bricks.App = class extends bricks.Layout {
this.video_devices = null
this.vpos = null;
document.addEventListener('keydown', this.key_down_action.bind(this));
this.screen_orient = window.screen.orientation.type;
window.screen.orientation.addEventListener('change', () => {
this.screen_orient = window.screen.orientation.type;
this.bind('orient_changed', this.screen_orient);
});
}
async getCameras() {
try {

BIN
bricks/imgs/input.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
bricks/imgs/search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -55,7 +55,11 @@ bricks.ModelOutput = class extends bricks.HBox {
opts.width = '100%';
super(opts);
this.logid = null;
this.img = new bricks.Icon({rate:2,url:this.icon||bricks_resource('imgs/llm.png')});
this.img = new bricks.Icon({
rate:2,
tip:this.opts.model,
url:this.icon||bricks_resource('imgs/llm.png')
});
this.run = new bricks.BaseRunning({target:this});
this.add_widget(this.img);
this.add_widget(this.run);
@ -163,7 +167,10 @@ bricks.LlmModel = class extends bricks.JsWidget {
render_title(){
var w = new bricks.HBox({});
w.bind('click', this.show_setup_panel.bind(this))
var img = new bricks.Icon({rate:2,url:this.opts.icon||bricks_resource('imgs/llm.png')});
var img = new bricks.Icon({
rate:2,
url:this.opts.icon||bricks_resource('imgs/llm.png')
});
var txt = new bricks.Text({text:this.opts.model});
w.add_widget(img);
w.add_widget(txt);
@ -200,6 +207,7 @@ bricks.LlmModel = class extends bricks.JsWidget {
textvoice:this.textvoice,
tts_url:this.tts_url,
icon:this.opts.icon,
model:this.opts.model,
estimate_url:this.llmio.estimate_url,
output_view:this.opts.output_view});
this.llmio.o_w.add_widget(mout);
@ -286,20 +294,25 @@ bricks.LlmIO = class extends bricks.VBox {
constructor(opts){
super(opts);
this.llmmodels = [];
this.title_w = new bricks.HBox({cheight:2});
this.title_w = new bricks.HBox({cheight:3});
var bottom_box = new bricks.HBox({cheight:3});
this.i_w = new bricks.Icon({
rate:2,
url:bricks_resource('imgs/input.png'),
margin:'14px',
tip:'input data',
css:'clickable'
});
this.nm_w = new bricks.Icon({
rate:2,
url:bricks_resource('imgs/add.png'),
margin:'14px',
tip:'add new model',
css:'clickable'
});
this.title_w.add_widget(this.nm_w);
bottom_box.add_widget(this.i_w);
bottom_box.add_widget(this.nm_w);
this.nm_w.bind('click', this.open_search_models.bind(this));
this.i_w.bind('click', this.open_input_widget.bind(this));
this.o_w = new bricks.Filler({overflow:'auto'});
@ -308,7 +321,7 @@ bricks.LlmIO = class extends bricks.VBox {
if (this.models.length < 2 && this.tts_url){
this.textvoice = true;
}
this.add_widget(this.i_w);
this.add_widget(bottom_box);
this.models.forEach( m =>{
this.show_added_model(m);
});