feat(AgentIO): 正文输入回车直接发送、Ctrl+回车换行——UiText新增opt-in的enter_sends选项(默认关,不影响其他表单),submit图标功能不变
This commit is contained in:
parent
a77200c5ae
commit
6a94f10370
@ -17,11 +17,13 @@ bricks.AgentInput = class extends bricks.VBox {
|
|||||||
this.file_names = [];
|
this.file_names = [];
|
||||||
this.inputfilew.bind('changed', this.file_added.bind(this));
|
this.inputfilew.bind('changed', this.file_added.bind(this));
|
||||||
|
|
||||||
// text input
|
// text input — 回车直接发送;Ctrl+回车换行(enter_sends 为 UiText 的 opt-in 选项)
|
||||||
this.textw = new bricks.UiText({
|
this.textw = new bricks.UiText({
|
||||||
name: 'prompt',
|
name: 'prompt',
|
||||||
placeholder: opts.placeholder || ''
|
placeholder: opts.placeholder || '',
|
||||||
|
enter_sends: true
|
||||||
});
|
});
|
||||||
|
this.textw.bind('enter_send', this.input_finished.bind(this));
|
||||||
|
|
||||||
// model selector — 直接用 UiCode,不用 Form
|
// model selector — 直接用 UiCode,不用 Form
|
||||||
// session_id 自动注入:模型下拉按会话解析当前项目(多 tab 各自项目),
|
// session_id 自动注入:模型下拉按会话解析当前项目(多 tab 各自项目),
|
||||||
|
|||||||
@ -1064,7 +1064,12 @@ bricks.UiText =class extends bricks.UiType {
|
|||||||
break;
|
break;
|
||||||
case 'Enter':
|
case 'Enter':
|
||||||
e.preventDefault(); // 阻止默认行为
|
e.preventDefault(); // 阻止默认行为
|
||||||
this.handle_enter();
|
if (this.opts.enter_sends && !e.ctrlKey && !e.metaKey) {
|
||||||
|
// 回车直接发送(AgentIO 正文输入);Ctrl+回车 / Cmd+回车仍插入换行
|
||||||
|
this.dispatch('enter_send');
|
||||||
|
} else {
|
||||||
|
this.handle_enter();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'ArrowUp':
|
case 'ArrowUp':
|
||||||
case 'ArrowDown':
|
case 'ArrowDown':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user