This commit is contained in:
yumoqing 2024-06-17 21:32:44 +08:00
parent 5da4f203c4
commit 5fd801d5b9

View File

@ -79,21 +79,21 @@ bricks.LlmModel = class {
messages:this.messages, messages:this.messages,
mapi:this.mapi, mapi:this.mapi,
prompt:prompt, prompt:prompt,
model:this.model model:this.opts.model
} }
} else { } else {
d = bricks.extend({}, data); d = bricks.extend({}, data);
d.model = this.model; d.model = this.opts.model;
} }
if (this.response_mode == 'stream') { if (this.response_mode == 'stream') {
var hr = new bricks.HttpResponseStream(); var hr = new bricks.HttpResponseStream();
this.set_stream_data(); this.set_stream_data();
var resp = await hr.post(this.url, {params:d}); var resp = await hr.post(this.opts.url, {params:d});
await hr.handle_chunk(resp, this.chunk_response.bind(this, mout)); await hr.handle_chunk(resp, this.chunk_response.bind(this, mout));
this.chunk_ended(mout); this.chunk_ended(mout);
} else { } else {
var hj = new bricks.HttpJson() var hj = new bricks.HttpJson()
var resp = await hj.post(this.url, {params:d}); var resp = await hj.post(this.opts.url, {params:d});
if (this.response_mode == 'sync'){ if (this.response_mode == 'sync'){
mout.update_data(resp); mout.update_data(resp);
if (this.messages){ if (this.messages){