merge conflict

This commit is contained in:
sophie committed 2026-05-26 10:48:01 +08:00
commit 03570dbf5a
25 files changed
+444 -64

No files matched your search

+25 -8
View File
@@ -24,6 +24,7 @@ import { useMessage } from '../composables/useMessage';
import { useIsMobile } from '../composables/useIsMobile';
import { useTheme } from '../composables/useTheme';
import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth';
import { copyTextToClipboard } from '../utils/clipboard';
const { t, locale } = useI18n();
const { appliedTheme, toggleLightDark } = useTheme();
@@ -1613,16 +1614,29 @@ const confirmLeaveSubmission = async (msg: any) => {
}
};
const copyToClipboard = async (text: string, index: number) => {
try {
await navigator.clipboard.writeText(text);
const getMessageCopyText = (msg: { role?: string; content?: string; type?: string }) => {
const content = String(msg?.content ?? '').trim();
if (content) return content;
return '';
};
const copyToClipboard = async (msg: { role?: string; content?: string; type?: string }, index: number) => {
const text = getMessageCopyText(msg);
if (!text) {
showMessageDialog('warning', t('chat.actions.copyEmpty'));
return;
}
const ok = await copyTextToClipboard(text);
if (ok) {
copiedIndex.value = index;
setTimeout(() => {
copiedIndex.value = null;
}, 2000);
} catch (err) {
console.error('Failed to copy:', err);
return;
}
showMessageDialog('error', t('chat.actions.copyFailed'));
};
const regenerate = () => {
@@ -2364,7 +2378,8 @@ const showChatRating = ref(false);
:class="msg.role === 'user' ? 'justify-end text-slate-500' : 'justify-start text-slate-500'"
>
<button
@click="copyToClipboard(msg.content, index)"
type="button"
@click.stop="copyToClipboard(msg, index)"
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
:title="$t('chat.actions.copy')"
>
@@ -2374,14 +2389,16 @@ const showChatRating = ref(false);
<template v-if="msg.role === 'user'">
<button
@click="input = msg.content"
type="button"
@click.stop="input = msg.content"
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
:title="$t('chat.actions.edit')"
>
<Edit2 class="h-3.5 w-3.5" />
</button>
<button
@click="handleSend(msg.content)"
type="button"
@click.stop="handleSend(msg.content)"
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
:title="$t('chat.actions.resend')"
>