Skip to content

armgit / ARTEX

Public Imported from GitHub
0

ARTEX - AI autonomous penetration testing system (English translation; upstream: Autumn-27/ARTEX, AGPL-3.0)

fix(chat): 会话输入框改为 Enter 发送、Shift+Enter 换行

Autumn-275db70f29916c
diff --git a/web/src/app/(main)/chat/page.tsx b/web/src/app/(main)/chat/page.tsx
index 2b6a7fb..32ecdb2 100644
--- a/web/src/app/(main)/chat/page.tsx
+++ b/web/src/app/(main)/chat/page.tsx
@@ -77,8 +77,8 @@ function LiveBadge() {
);
}
-// Composer is the shared bottom input (textarea grows to a cap, Enter newlines,
-// Ctrl/Cmd+Enter sends) — the same affordance across DraftChat and ChatView.
+// Composer is the shared bottom input (textarea grows to a cap, Enter sends,
+// Shift+Enter newlines) — the same affordance across DraftChat and ChatView.
function Composer({
value,
onChange,
@@ -112,11 +112,10 @@ function Composer({
const fileInputRef = React.useRef<HTMLInputElement>(null);
const atts = attachments ?? [];
function onKeyDown(e: React.KeyboardEvent<HTMLTextAreaElement>) {
- // Enter 换行;只有 Ctrl/Cmd+Enter 才发送(避免长消息误发)。
- if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
- e.preventDefault();
- onSend();
- }
+ // Enter 发送;Shift+Enter 换行。isComposing 时是中文等输入法在选字,不拦截。
+ if (e.key !== "Enter" || e.shiftKey || e.nativeEvent.isComposing) return;
+ e.preventDefault();
+ onSend();
}
return (
<div className="border-t p-3">
@@ -364,7 +363,7 @@ function DraftChat({
onChange={setInput}
onSend={send}
disabled={sending || uploading || !agentKey}
- placeholder="输入消息,Enter 换行,Ctrl+Enter 发送"
+ placeholder="输入消息,Enter 发送,Shift+Enter 换行"
leftSlot={agentPicker}
onPickFiles={pickFiles}
uploading={uploading}
@@ -692,7 +691,7 @@ function ChatView({
onChange={setInput}
onSend={send}
disabled={running}
- placeholder={running ? "Agent 正在回复…" : "输入消息,Enter 换行,Ctrl+Enter 发送"}
+ placeholder={running ? "Agent 正在回复…" : "输入消息,Enter 发送,Shift+Enter 换行"}
running={running}
onStop={stop}
stopDisabled={stopping}