This commit is contained in:
yumoqing 2024-12-04 18:51:05 +08:00
parent 680fcfd434
commit 1e6acc19ca
5 changed files with 27 additions and 9 deletions

View File

@ -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

View File

@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/bricks/3parties/xterm.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/js-docx-viewer/dist/css/docxviewer.min.css">
<link href="/bricks/3parties/video-js.css" rel="stylesheet" />
<link rel="stylesheet" href="/bricks/css/bricks.css">
<link rel="stylesheet", href="/css/myapp.css">
@ -15,7 +16,9 @@
<script>eruda.init();</script>
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.7/dist/bundle.min.js"></script>
<script src="https://unpkg.com/docx-js@3.2.0/lib/docx.min.js"></script>
-->
<script src="https://cdn.jsdelivr.net/npm/js-docx-viewer/dist/js-docx-viewer.min.js"></script>
<script type="text/javascript" src="https://registry.npmmirror.com/echarts/5.5.1/files/dist/echarts.min.js"></script>
<script src="/bricks/3parties/marked.min.js"></script>

View File

@ -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;
}

View File

@ -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;

View File

@ -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();