diff --git a/bricks/build.sh b/bricks/build.sh index cd56490..81a9310 100755 --- a/bricks/build.sh +++ b/bricks/build.sh @@ -6,9 +6,9 @@ SOURCES=" page_data_loader.js factory.js uitypesdef.js utils.js uitype.js \ tree.js multiple_state_image.js dynamiccolumn.js form.js message.js conform.js \ paging.js datagrid.js iframe.js cols.js echartsext.js \ floaticonbar.js miniform.js wterm.js dynamicaccordion.js \ - binstreaming.js streaming_audio.js vadtext.js rtc.js \ + binstreaming.js streaming_audio.js vadtext.js rtc.js docxviewer.js \ llm_dialog.js llm.js websocket.js datarow.js tabular.js \ - line.js pie.js bar.js gobang.js period.js pdfviewer.js " + line.js pie.js bar.js gobang.js period.js " echo ${SOURCES} cat ${SOURCES} > ../dist/bricks.js # uglifyjs --compress --mangle -- ../dist/bricks.js > ../dist/bricks.min.js diff --git a/bricks/header.tmpl b/bricks/header.tmpl index ba0a53d..2f8ee11 100644 --- a/bricks/header.tmpl +++ b/bricks/header.tmpl @@ -5,6 +5,7 @@ + @@ -15,7 +16,9 @@ + --> + diff --git a/bricks/input.js b/bricks/input.js index 8e959fd..1dd4fe9 100644 --- a/bricks/input.js +++ b/bricks/input.js @@ -393,6 +393,8 @@ bricks.UiImage =class extends bricks.VBox { if (this.imgw){ this.remove_widget(this.imgw); } + this.value = e.target.result; + console.log('this.value=', this.value); this.imgw = new bricks.Image({ url:e.target.result, width:'100%' @@ -404,7 +406,8 @@ bricks.UiImage =class extends bricks.VBox { getValue(){ var ret = {} if (this.imgw){ - ret[this.name] = this.imgw.base64() + // ret[this.name] = this.imgw.base64() + ret[this.name] = this.value; } else { ret[this.name] = null; } diff --git a/bricks/jsoncall.js b/bricks/jsoncall.js index d491553..21fc3ac 100644 --- a/bricks/jsoncall.js +++ b/bricks/jsoncall.js @@ -44,9 +44,9 @@ bricks.HttpText = class { }; bricks.extend(this.headers, headers); var width=0, height=0; - var is_mobile = 0 + var is_mobile = '0' if (bricks.is_mobile()){ - is_mobile = 1; + is_mobile = '1'; } if (bricks.app) { width = bricks.app.screenWidth(); @@ -187,6 +187,11 @@ bricks.HttpText = class { } } +bricks.HttpBin = class extends bricks.HttpText { + async get_result_data(resp){ + return await resp.blob() + } +} bricks.HttpResponse = class extends bricks.HttpText { async get_result_data(resp){ return resp; diff --git a/bricks/llm.js b/bricks/llm.js index 43aa7cf..a805165 100644 --- a/bricks/llm.js +++ b/bricks/llm.js @@ -185,23 +185,30 @@ bricks.LlmModel = class extends bricks.JsWidget { this.llmio.o_w.add_widget(mout); var fmt = this.opts.user_message_format || { role:'user', content:'${prompt}'}; var umsg = bricks.apply_data(fmt, data); - var d = data; + var d = {}; 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') { + d = {}; + d.messages = this.messages; + d.model = this.opts.model; + d.modelinstanceid = this.opts.modelinstanceid; + d.modeltypeid = this.opts.modeltypeid; var hr = new bricks.HttpResponseStream(); var resp = await hr.post(this.opts.url, {params:d}); await hr.handle_chunk(resp, this.chunk_response.bind(this, mout)); this.chunk_ended(); } else { + d = data + d.model = this.opts.model; + d.modelinstanceid = this.opts.modelinstanceid; + d.modeltypeid = this.opts.modeltypeid; var hj = new bricks.HttpJson() var resp = await hj.post(this.opts.url, {params:d}); if (this.response_mode == 'sync'){ + resp.content = bricks.escapeSpecialChars(resp.content) mout.update_data(resp); if (this.messages){ var msg = this.llm_msg_format();