diff --git a/bricks/agent.js b/bricks/agent.js index 7430077..7d518ad 100644 --- a/bricks/agent.js +++ b/bricks/agent.js @@ -343,11 +343,6 @@ bricks.AgentIO = class extends bricks.VBox { console.log('chunk end'); } async user_inputed(e){ - // 中止上一次请求 - if (this._current_hr) { - this._current_hr.abort(); - this._current_hr = null; - } this.show_input(e.params); var params = e.params; params.llmid = this.agent_using_llmid; @@ -366,15 +361,12 @@ bricks.AgentIO = class extends bricks.VBox { }); this.msg_box.add_widget(mout); var hr = new bricks.HttpResponseStream(); - this._current_hr = hr; var resp = await hr.post(this.opts.url, {params:params}); if (! resp) { mout.run_stopped(); - this._current_hr = null; return; } await hr.handle_chunk(resp, this.chunk_response.bind(this, mout)); - this._current_hr = null; this.chunk_ended(); } async show_input(params){ diff --git a/bricks/jsoncall.js b/bricks/jsoncall.js index c31f9ee..02d1bcc 100644 --- a/bricks/jsoncall.js +++ b/bricks/jsoncall.js @@ -247,34 +247,6 @@ bricks.HttpResponse = class extends bricks.HttpText { } bricks.HttpResponseStream = class extends bricks.HttpResponse { - constructor(){ - super(); - this._controller = new AbortController(); - } - abort(){ - this._controller.abort(); - } - async bricks_fetch(url, {method='GET', headers=null, params=null, signal=null}={}){ - url = this.url_parse(url); - var data = this.add_own_params(params); - var header = this.add_own_headers(headers); - var _params = { - method:method, - signal: signal || this._controller.signal - } - if (data instanceof FormData){ - method = 'POST'; - _params.body = data; - } else { - if (method == 'GET' || method == 'HEAD') { - let pstr = url_params(data); - url = url + '?' + pstr; - } else { - _params.body = JSON.stringify(data); - } - } - return await fetch(url, _params); - } async handle_chunk(resp, handler){ const reader = resp.body.getReader(); const decoder = new TextDecoder('utf-8');