From 863d62eb1fd899732e3b958a6933f612a3a4de17 Mon Sep 17 00:00:00 2001 From: rankaiyx Date: Sun, 8 Mar 2026 21:54:20 +0800 Subject: [PATCH 1/4] Add COPY_WITHOUT_THINKING constant to settings keys --- tools/server/webui/src/lib/constants/settings-keys.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/server/webui/src/lib/constants/settings-keys.ts b/tools/server/webui/src/lib/constants/settings-keys.ts index 1209103578..24b192400c 100644 --- a/tools/server/webui/src/lib/constants/settings-keys.ts +++ b/tools/server/webui/src/lib/constants/settings-keys.ts @@ -11,6 +11,7 @@ export const SETTINGS_KEYS = { SYSTEM_MESSAGE: 'systemMessage', PASTE_LONG_TEXT_TO_FILE_LEN: 'pasteLongTextToFileLen', COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT: 'copyTextAttachmentsAsPlainText', + COPY_WITHOUT_THINKING: 'copyWithoutThinking', ENABLE_CONTINUE_GENERATION: 'enableContinueGeneration', PDF_AS_IMAGE: 'pdfAsImage', ASK_FOR_TITLE_CONFIRMATION: 'askForTitleConfirmation', From 7db21e01593a7e6f9368e4b2c6dd4e6228019615 Mon Sep 17 00:00:00 2001 From: rankaiyx Date: Sun, 8 Mar 2026 21:58:20 +0800 Subject: [PATCH 2/4] Add 'copyWithoutThinking' setting to configuration Added a new setting to control copying behavior of assistant messages. --- tools/server/webui/src/lib/constants/settings-config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/server/webui/src/lib/constants/settings-config.ts b/tools/server/webui/src/lib/constants/settings-config.ts index e76fa89e9a..8fa17e8314 100644 --- a/tools/server/webui/src/lib/constants/settings-config.ts +++ b/tools/server/webui/src/lib/constants/settings-config.ts @@ -16,6 +16,7 @@ export const SETTING_CONFIG_DEFAULT: Record = askForTitleConfirmation: false, pasteLongTextToFileLen: 2500, copyTextAttachmentsAsPlainText: false, + copyWithoutThinking: false, pdfAsImage: false, disableAutoScroll: false, renderUserContentAsMarkdown: false, @@ -67,6 +68,8 @@ export const SETTING_CONFIG_INFO: Record = { 'On pasting long text, it will be converted to a file. You can control the file length by setting the value of this parameter. Value 0 means disable.', copyTextAttachmentsAsPlainText: 'When copying a message with text attachments, combine them into a single plain text string instead of a special format that can be pasted back as attachments.', + copyWithoutThinking: + 'When copying an assistant message, strip the thinking/reasoning block and only copy the final response.', samplers: 'The order at which samplers are applied, in simplified way. Default is "top_k;typ_p;top_p;min_p;temperature": top_k->typ_p->top_p->min_p->temperature', backend_sampling: From 3dd083dce958010731ddf6da12e73ed626ce7eeb Mon Sep 17 00:00:00 2001 From: rankaiyx Date: Sun, 8 Mar 2026 22:00:47 +0800 Subject: [PATCH 3/4] Add setting to copy response without thinking content --- .../lib/components/app/chat/ChatSettings/ChatSettings.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/server/webui/src/lib/components/app/chat/ChatSettings/ChatSettings.svelte b/tools/server/webui/src/lib/components/app/chat/ChatSettings/ChatSettings.svelte index 44d59e2b36..1cb7a758e0 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatSettings/ChatSettings.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatSettings/ChatSettings.svelte @@ -69,6 +69,11 @@ label: 'Copy text attachments as plain text', type: SettingsFieldType.CHECKBOX }, + { + key: SETTINGS_KEYS.COPY_WITHOUT_THINKING, + label: 'Copy response without thinking content', + type: SettingsFieldType.CHECKBOX + }, { key: SETTINGS_KEYS.ENABLE_CONTINUE_GENERATION, label: 'Enable "Continue" button', From 14a2ca7a2186be9ee6bcfa8e219e2685d6231fe6 Mon Sep 17 00:00:00 2001 From: rankaiyx Date: Sun, 8 Mar 2026 22:08:22 +0800 Subject: [PATCH 4/4] Update ChatMessage.svelte --- .../app/chat/ChatMessages/ChatMessage.svelte | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/server/webui/src/lib/components/app/chat/ChatMessages/ChatMessage.svelte b/tools/server/webui/src/lib/components/app/chat/ChatMessages/ChatMessage.svelte index 52a9355104..d04a5fbb6c 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatMessages/ChatMessage.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatMessages/ChatMessage.svelte @@ -6,6 +6,9 @@ import { conversationsStore } from '$lib/stores/conversations.svelte'; import { DatabaseService } from '$lib/services'; import { SYSTEM_MESSAGE_PLACEHOLDER } from '$lib/constants'; + import { AGENTIC_REGEX, TRIM_NEWLINES_REGEX } from '$lib/constants/agentic'; + import { copyToClipboard } from '$lib/utils/clipboard'; + import { config } from '$lib/stores/settings.svelte'; import { MessageRole, AttachmentType } from '$lib/enums'; import { ChatMessageAssistant, @@ -128,6 +131,18 @@ } function handleCopy() { + if ( + config().copyWithoutThinking && + message.role === MessageRole.ASSISTANT && + message.content + ) { + const stripped = message.content + .replace(AGENTIC_REGEX.REASONING_BLOCK, '') + .replace(AGENTIC_REGEX.REASONING_OPEN, '') + .replace(TRIM_NEWLINES_REGEX, ''); + void copyToClipboard(stripped); + return; + } chatActions.copy(message); }