Skip to content

ai chat boxes: enter for new line, ctrl/cmd+enter for submit. good for your context managing.

License

Notifications You must be signed in to change notification settings

cafe3310/ai-chat-enter-for-new-line

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

ai-chat-enter-for-new-line

这是什么

这是一个用户脚本(Userscript),可以改变 AI 聊天界面的输入行为,让你在输入时:

  • 按 Enter 键:换行(而不是发送消息)
  • 按 Ctrl+Enter(或 Mac 上的 Cmd+Enter):发送消息

支持的平台包括:

  • ChatGPT (chatgpt.com)
  • Claude (claude.ai)
  • Google Gemini (gemini.google.com)
  • Perplexity (perplexity.ai)
  • Microsoft Copilot (bing.com/chat)
  • DuckDuckGo AI (duckduckgo.com)
  • 以及其他 AI 聊天平台(可自定义 URL 模式)

原作者

本项目 Fork 自 @ChippppppppppChat UI Ctrl+Enter Sender。 感谢原作者提供的优秀基础实现!

如何使用

1. 安装用户脚本管理器

首先,你需要在浏览器中安装一个用户脚本管理器扩展:

2. 安装脚本

  1. 访问 https://github.com/cafe3310/ai-chat-enter-for-new-line/raw/refs/heads/main/main.user.js
  2. TamperMonkey/GreaseMonkey 应该会引导你安装脚本。

或者你也可以 copy 代码到上述插件手动安装。

3. 使用脚本

安装完成后:

  1. 访问任何支持的 AI 聊天平台(如 ChatGPT、Claude 等)
  2. 在输入框中:
    • Enter 键换行
    • Ctrl+Enter(Windows/Linux)或 Cmd+Enter(Mac)发送消息

4. 管理 URL 模式(可选)

脚本默认在常见 AI 聊天平台上启用。如果需要添加其他网站:

  1. 点击 Tampermonkey 图标
  2. 选择 "Chat UI Ctrl/Cmd+Enter Sender" → "Manage URL patterns"
  3. 添加、编辑或删除 URL 模式

解决的问题

在大多数 AI 聊天界面中,默认按 Enter 键会直接发送消息。这在以下场景中会带来不便:

  1. 需要输入多行文本时:比如编写代码、长篇提问、结构化内容时,需要频繁按 Shift+Enter 换行
  2. 误触发送:习惯性按 Enter 换行时,消息会被提前发送,导致上下文不完整
  3. 降低效率:不断修改和重发消息浪费时间和 token

使用该 user script 后:

  • Enter 换行:符合大多数文本编辑器的习惯,方便输入多行内容
  • Ctrl/Cmd+Enter 发送:明确的发送意图,避免误操作
  • 更好的上下文管理:可以从容地组织和编辑完整的提问内容

License

MIT

About

ai chat boxes: enter for new line, ctrl/cmd+enter for submit. good for your context managing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •