Compare commits
No commits in common. "d6d3e61a9e99e5f49fb43d9a03ce33085f29f416" and "c6df7f18299a2c1dc663eb4696456680d411c36e" have entirely different histories.
d6d3e61a9e
...
c6df7f1829
@ -19,7 +19,7 @@
|
||||
if (!this.userId) this.userId = 'anonymous';
|
||||
|
||||
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
var url = protocol + '//' + window.location.host + '/wss/harnessed_reasoning/reasoning_console.wss';
|
||||
var url = protocol + '//' + window.location.host + '/harnessed_reasoning/reasoning_console.wss';
|
||||
this.ws = new WebSocket(url);
|
||||
|
||||
this.ws.onopen = function() {
|
||||
@ -40,8 +40,8 @@
|
||||
},
|
||||
|
||||
updateStatus: function(state, text) {
|
||||
var statusWidget = bricks.getWidgetById('status_text');
|
||||
var badgeWidget = bricks.getWidgetById('ws_status');
|
||||
var statusWidget = bricks.app.find_widget_by_id('status_text');
|
||||
var badgeWidget = bricks.app.find_widget_by_id('ws_status');
|
||||
if (statusWidget) statusWidget.set_text(text);
|
||||
if (badgeWidget) {
|
||||
var labels = {connected: '已连接', connecting: '连接中', disconnected: '未连接'};
|
||||
@ -53,7 +53,7 @@
|
||||
if (msg.type === 'connected' || msg.type === 'pong') return;
|
||||
if (msg.type === 'error') {
|
||||
this.addStep('error', msg.data ? msg.data.message : msg.message || '错误', msg.data || {});
|
||||
var btn = bricks.getWidgetById('start_btn');
|
||||
var btn = bricks.app.find_widget_by_id('start_btn');
|
||||
if (btn) btn.options.disabled = false;
|
||||
return;
|
||||
}
|
||||
@ -62,13 +62,13 @@
|
||||
var message = data.message || event;
|
||||
this.addStep(event, message, data);
|
||||
if (event === 'reasoning_complete' || event === 'execution_complete') {
|
||||
var btn = bricks.getWidgetById('start_btn');
|
||||
var btn = bricks.app.find_widget_by_id('start_btn');
|
||||
if (btn) btn.options.disabled = false;
|
||||
}
|
||||
},
|
||||
|
||||
addStep: function(event, message, data) {
|
||||
var container = bricks.getWidgetById('steps_container');
|
||||
var container = bricks.app.find_widget_by_id('steps_container');
|
||||
if (!container) return;
|
||||
this.stepCount++;
|
||||
|
||||
@ -105,7 +105,7 @@
|
||||
detailsHtml + '</div></div>';
|
||||
|
||||
container.el.insertAdjacentHTML('beforeend', stepHtml);
|
||||
var currentWidget = bricks.getWidgetById('current_step');
|
||||
var currentWidget = bricks.app.find_widget_by_id('current_step');
|
||||
if (currentWidget) currentWidget.set_text(message);
|
||||
container.el.scrollTop = container.el.scrollHeight;
|
||||
},
|
||||
@ -130,23 +130,23 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
var input = bricks.getWidgetById('reasoning_input');
|
||||
var input = bricks.app.find_widget_by_id('reasoning_input');
|
||||
if (!input || !input.options.text.trim()) {
|
||||
bricks.show_error_message && bricks.show_error_message('请输入推理请求');
|
||||
return;
|
||||
}
|
||||
var btn = bricks.getWidgetById('start_btn');
|
||||
var btn = bricks.app.find_widget_by_id('start_btn');
|
||||
if (btn) btn.options.disabled = true;
|
||||
ws.ws.send(JSON.stringify({cmd: 'start_reasoning', request: input.options.text.trim(), user_id: ws.userId}));
|
||||
});
|
||||
|
||||
bricks.RF.register('clearSteps', async function(params) {
|
||||
var container = bricks.getWidgetById('steps_container');
|
||||
var container = bricks.app.find_widget_by_id('steps_container');
|
||||
if (container) container.el.innerHTML = '';
|
||||
reasoningWS.stepCount = 0;
|
||||
var currentWidget = bricks.getWidgetById('current_step');
|
||||
var currentWidget = bricks.app.find_widget_by_id('current_step');
|
||||
if (currentWidget) currentWidget.set_text('');
|
||||
var btn = bricks.getWidgetById('start_btn');
|
||||
var btn = bricks.app.find_widget_by_id('start_btn');
|
||||
if (btn) btn.options.disabled = false;
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user