support eval again
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
|||||||
Plus, Search, Trash2, Send, User, Type, ChevronDown, Check,
|
Plus, Search, Trash2, Send, User, Type, ChevronDown, Check,
|
||||||
MessageSquare, Loader2, Copy,
|
MessageSquare, Loader2, Copy,
|
||||||
X, Sparkles, Languages, Venus, Mars, CircleSlash,
|
X, Sparkles, Languages, Venus, Mars, CircleSlash,
|
||||||
ShieldCheck
|
ShieldCheck, RotateCcw
|
||||||
} from 'lucide-vue-next';
|
} from 'lucide-vue-next';
|
||||||
import {
|
import {
|
||||||
useSettingsStore,
|
useSettingsStore,
|
||||||
@@ -218,7 +218,7 @@ const translateMessage = async (sender: 'me' | 'partner') => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const evaluateMessage = async (messageId: string) => {
|
const evaluateMessage = async (messageId: string, force = false) => {
|
||||||
if (!activeSession.value) return;
|
if (!activeSession.value) return;
|
||||||
const msg = activeSession.value.messages.find(m => m.id === messageId);
|
const msg = activeSession.value.messages.find(m => m.id === messageId);
|
||||||
if (!msg) return;
|
if (!msg) return;
|
||||||
@@ -229,9 +229,9 @@ const evaluateMessage = async (messageId: string) => {
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
isAuditModalOpen.value = true;
|
isAuditModalOpen.value = true;
|
||||||
|
|
||||||
if (msg.evaluation || msg.isEvaluating) return;
|
if (!force && (msg.evaluation || msg.isEvaluating)) return;
|
||||||
|
|
||||||
settings.updateChatMessage(activeSession.value.id, messageId, { isEvaluating: true });
|
settings.updateChatMessage(activeSession.value.id, messageId, { isEvaluating: true, evaluation: undefined });
|
||||||
|
|
||||||
const historyLimit = 10;
|
const historyLimit = 10;
|
||||||
const recentMessages = activeSession.value.messages.filter(m => m.id !== messageId).slice(-historyLimit);
|
const recentMessages = activeSession.value.messages.filter(m => m.id !== messageId).slice(-historyLimit);
|
||||||
@@ -953,6 +953,15 @@ onUnmounted(() => window.removeEventListener('click', handleGlobalClick));
|
|||||||
|
|
||||||
<!-- Footer Action -->
|
<!-- Footer Action -->
|
||||||
<div class="p-8 border-t dark:border-slate-800 bg-slate-50/50 dark:bg-slate-950/50 flex items-center gap-4 shrink-0">
|
<div class="p-8 border-t dark:border-slate-800 bg-slate-50/50 dark:bg-slate-950/50 flex items-center gap-4 shrink-0">
|
||||||
|
<button
|
||||||
|
v-if="activeAuditMessage.evaluation && !activeAuditMessage.isEvaluating"
|
||||||
|
@click="evaluateMessage(activeAuditMessage.id, true)"
|
||||||
|
class="p-4 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-500 dark:text-slate-400 rounded-2xl font-bold transition-all shrink-0"
|
||||||
|
title="重新审计"
|
||||||
|
>
|
||||||
|
<RotateCcw class="w-5 h-5" />
|
||||||
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@click="isAuditModalOpen = false"
|
@click="isAuditModalOpen = false"
|
||||||
class="flex-1 py-4 bg-slate-200 dark:bg-slate-800 hover:bg-slate-300 dark:hover:bg-slate-700 text-slate-600 dark:text-slate-300 rounded-2xl font-bold transition-all"
|
class="flex-1 py-4 bg-slate-200 dark:bg-slate-800 hover:bg-slate-300 dark:hover:bg-slate-700 text-slate-600 dark:text-slate-300 rounded-2xl font-bold transition-all"
|
||||||
|
|||||||
Reference in New Issue
Block a user