fix(frontend): prevent submit during IME composition (#1562)

This commit is contained in:
Sleepy Ranx 🌙
2026-03-29 22:36:38 +08:00
committed by GitHub
parent d475de7997
commit 866cf4ef73
4 changed files with 17 additions and 3 deletions
@@ -20,6 +20,7 @@ import { checkAgentName, getAgent } from "@/core/agents/api";
import { useI18n } from "@/core/i18n/hooks";
import { useThreadStream } from "@/core/threads/hooks";
import { uuid } from "@/core/utils/uuid";
import { isIMEComposing } from "@/lib/ime";
import { cn } from "@/lib/utils";
type Step = "name" | "chat";
@@ -98,7 +99,7 @@ export default function NewAgentPage() {
]);
const handleNameKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === "Enter") {
if (e.key === "Enter" && !isIMEComposing(e)) {
e.preventDefault();
void handleConfirmName();
}