mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add Cmd/Ctrl+Enter send setting (#25062)
Adds an Agents General setting to require Cmd/Ctrl+Enter before sending
chat messages. When enabled, plain Enter inserts a newline in agent chat
inputs while the send button remains available.
The preference is now persisted server-side through
`/api/v2/users/{user}/preferences`, alongside the existing user
preference settings, and is applied to both the create-agent input and
existing chat composer. Storybook and API coverage verify the setting,
keyboard behavior, validation, and persistence.
<details>
<summary>Coder Agents notes</summary>
Generated by Coder Agents from a Slack request. Dogfooded with
agent-browser against the Storybook settings and chat input stories.
</details>
This commit is contained in:
@@ -327,6 +327,29 @@ WHERE user_configs.user_id = @user_id
|
||||
AND user_configs.key = 'preference_code_diff_display_mode'
|
||||
RETURNING value AS code_diff_display_mode;
|
||||
|
||||
-- name: GetUserAgentChatSendShortcut :one
|
||||
SELECT
|
||||
value AS agent_chat_send_shortcut
|
||||
FROM
|
||||
user_configs
|
||||
WHERE
|
||||
user_id = @user_id
|
||||
AND key = 'preference_agent_chat_send_shortcut';
|
||||
|
||||
-- name: UpdateUserAgentChatSendShortcut :one
|
||||
INSERT INTO
|
||||
user_configs (user_id, key, value)
|
||||
VALUES
|
||||
(@user_id, 'preference_agent_chat_send_shortcut', @agent_chat_send_shortcut::text)
|
||||
ON CONFLICT
|
||||
ON CONSTRAINT user_configs_pkey
|
||||
DO UPDATE
|
||||
SET
|
||||
value = @agent_chat_send_shortcut
|
||||
WHERE user_configs.user_id = @user_id
|
||||
AND user_configs.key = 'preference_agent_chat_send_shortcut'
|
||||
RETURNING value AS agent_chat_send_shortcut;
|
||||
|
||||
-- name: UpdateUserRoles :one
|
||||
UPDATE
|
||||
users
|
||||
|
||||
Reference in New Issue
Block a user