From 803f742a64e8e60be5b9acfd7a086325fd0c7861 Mon Sep 17 00:00:00 2001 From: qixinbo Date: Thu, 19 Mar 2026 14:57:42 +0800 Subject: [PATCH] fix: enter input fixed --- backend/app/database.py | 7 ++++++- backend/backend/dataclaw.db | 0 frontend/src/components/ChatInterface.tsx | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) delete mode 100644 backend/backend/dataclaw.db diff --git a/backend/app/database.py b/backend/app/database.py index 9154f4a..0c1b0e8 100644 --- a/backend/app/database.py +++ b/backend/app/database.py @@ -1,8 +1,13 @@ +import os from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker -SQLALCHEMY_DATABASE_URL = "sqlite:///./dataclaw.db" +# Use absolute path to ensure dataclaw.db is created in the backend root directory, +# preventing nested backend/backend/dataclaw.db issues when starting from different cwd. +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +DB_PATH = os.path.join(BASE_DIR, "dataclaw.db") +SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_PATH}" engine = create_engine( SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} diff --git a/backend/backend/dataclaw.db b/backend/backend/dataclaw.db deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/components/ChatInterface.tsx b/frontend/src/components/ChatInterface.tsx index 7c3d8d7..17ae049 100644 --- a/frontend/src/components/ChatInterface.tsx +++ b/frontend/src/components/ChatInterface.tsx @@ -122,7 +122,12 @@ export function ChatInterface() { setSlashQuery(null); }; - const handleInputKeyDown = (e: React.KeyboardEvent) => { + const handleInputKeyDown = (e: React.KeyboardEvent) => { + // Avoid triggering Enter when using IME (Input Method Editor) for CJK characters + if (e.nativeEvent.isComposing) { + return; + } + if (slashQuery !== null && filteredSlashSkills.length > 0) { if (e.key === 'ArrowUp') { e.preventDefault();