放开会话的评价回答功能,恢复在报表中显示

This commit is contained in:
sophie committed 2026-04-28 18:26:09 +08:00
1 parent 6cd2ac9bd1
commit fb71def840
6 files changed
+145 -25

No files matched your search

@@ -8,6 +8,27 @@ const level = ref<MessageLevel>('info');
const title = ref('');
const message = ref('');
const MAX_DIALOG_MESSAGE_LENGTH = 240;
const normalizeMessage = (raw: string) => {
if (!raw) return '';
return raw
.replace(/\s+/g, ' ')
.replace(/<[^>]*>/g, '')
.trim();
};
const formatMessageForDialog = (level: MessageLevel, raw: string) => {
const normalized = normalizeMessage(raw);
if (!normalized) return '';
// Error messages often include long backend stack/driver details.
if (level === 'error' && normalized.length > MAX_DIALOG_MESSAGE_LENGTH) {
return `${normalized.slice(0, MAX_DIALOG_MESSAGE_LENGTH)}...`;
}
return normalized;
};
export const useGlobalMessageDialog = () => {
const showMessageDialog = (
nextLevel: MessageLevel,
@@ -16,7 +37,7 @@ export const useGlobalMessageDialog = () => {
) => {
level.value = nextLevel;
title.value = nextTitle;
message.value = nextMessage;
message.value = formatMessageForDialog(nextLevel, nextMessage);
visible.value = true;
};