mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
enh: only copy text message content
This commit is contained in:
parent
bdef1001ac
commit
c3497da5dd
@ -24,7 +24,9 @@
|
|||||||
getMessageContentParts,
|
getMessageContentParts,
|
||||||
sanitizeResponseContent,
|
sanitizeResponseContent,
|
||||||
createMessagesList,
|
createMessagesList,
|
||||||
formatDate
|
formatDate,
|
||||||
|
removeDetails,
|
||||||
|
removeAllDetails
|
||||||
} from '$lib/utils';
|
} from '$lib/utils';
|
||||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||||
|
|
||||||
@ -152,6 +154,7 @@
|
|||||||
let showRateComment = false;
|
let showRateComment = false;
|
||||||
|
|
||||||
const copyToClipboard = async (text) => {
|
const copyToClipboard = async (text) => {
|
||||||
|
text = removeAllDetails(text);
|
||||||
const res = await _copyToClipboard(text);
|
const res = await _copyToClipboard(text);
|
||||||
if (res) {
|
if (res) {
|
||||||
toast.success($i18n.t('Copying to clipboard was successful!'));
|
toast.success($i18n.t('Copying to clipboard was successful!'));
|
||||||
|
@ -683,6 +683,11 @@ export const removeDetails = (content, types) => {
|
|||||||
return content;
|
return content;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const removeAllDetails = (content) => {
|
||||||
|
content = content.replace(/<details[^>]*>.*?<\/details>/gis, '');
|
||||||
|
return content;
|
||||||
|
};
|
||||||
|
|
||||||
export const processDetails = (content) => {
|
export const processDetails = (content) => {
|
||||||
content = removeDetails(content, ['reasoning', 'code_interpreter']);
|
content = removeDetails(content, ['reasoning', 'code_interpreter']);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user