This commit is contained in:
rankaiyx 2026-03-24 01:39:48 +01:00 committed by GitHub
commit e2fde3e592
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 0 deletions

View File

@ -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);
}

View File

@ -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',

View File

@ -16,6 +16,7 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean |
askForTitleConfirmation: false,
pasteLongTextToFileLen: 2500,
copyTextAttachmentsAsPlainText: false,
copyWithoutThinking: false,
pdfAsImage: false,
disableAutoScroll: false,
renderUserContentAsMarkdown: false,
@ -70,6 +71,8 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
'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:

View File

@ -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',