Merge 14a2ca7a21 into 177c75852a
This commit is contained in:
commit
53b86a3dca
|
|
@ -6,6 +6,9 @@
|
||||||
import { conversationsStore } from '$lib/stores/conversations.svelte';
|
import { conversationsStore } from '$lib/stores/conversations.svelte';
|
||||||
import { DatabaseService } from '$lib/services';
|
import { DatabaseService } from '$lib/services';
|
||||||
import { SYSTEM_MESSAGE_PLACEHOLDER } from '$lib/constants';
|
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 { MessageRole, AttachmentType } from '$lib/enums';
|
||||||
import {
|
import {
|
||||||
ChatMessageAssistant,
|
ChatMessageAssistant,
|
||||||
|
|
@ -128,6 +131,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCopy() {
|
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);
|
chatActions.copy(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,11 @@
|
||||||
label: 'Copy text attachments as plain text',
|
label: 'Copy text attachments as plain text',
|
||||||
type: SettingsFieldType.CHECKBOX
|
type: SettingsFieldType.CHECKBOX
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: SETTINGS_KEYS.COPY_WITHOUT_THINKING,
|
||||||
|
label: 'Copy response without thinking content',
|
||||||
|
type: SettingsFieldType.CHECKBOX
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: SETTINGS_KEYS.ENABLE_CONTINUE_GENERATION,
|
key: SETTINGS_KEYS.ENABLE_CONTINUE_GENERATION,
|
||||||
label: 'Enable "Continue" button',
|
label: 'Enable "Continue" button',
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean |
|
||||||
askForTitleConfirmation: false,
|
askForTitleConfirmation: false,
|
||||||
pasteLongTextToFileLen: 2500,
|
pasteLongTextToFileLen: 2500,
|
||||||
copyTextAttachmentsAsPlainText: false,
|
copyTextAttachmentsAsPlainText: false,
|
||||||
|
copyWithoutThinking: false,
|
||||||
pdfAsImage: false,
|
pdfAsImage: false,
|
||||||
disableAutoScroll: false,
|
disableAutoScroll: false,
|
||||||
renderUserContentAsMarkdown: 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.',
|
'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:
|
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.',
|
'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:
|
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',
|
'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:
|
backend_sampling:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export const SETTINGS_KEYS = {
|
||||||
SYSTEM_MESSAGE: 'systemMessage',
|
SYSTEM_MESSAGE: 'systemMessage',
|
||||||
PASTE_LONG_TEXT_TO_FILE_LEN: 'pasteLongTextToFileLen',
|
PASTE_LONG_TEXT_TO_FILE_LEN: 'pasteLongTextToFileLen',
|
||||||
COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT: 'copyTextAttachmentsAsPlainText',
|
COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT: 'copyTextAttachmentsAsPlainText',
|
||||||
|
COPY_WITHOUT_THINKING: 'copyWithoutThinking',
|
||||||
ENABLE_CONTINUE_GENERATION: 'enableContinueGeneration',
|
ENABLE_CONTINUE_GENERATION: 'enableContinueGeneration',
|
||||||
PDF_AS_IMAGE: 'pdfAsImage',
|
PDF_AS_IMAGE: 'pdfAsImage',
|
||||||
ASK_FOR_TITLE_CONFIRMATION: 'askForTitleConfirmation',
|
ASK_FOR_TITLE_CONFIRMATION: 'askForTitleConfirmation',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue