refactor(frontend): 重构前端第二版

This commit is contained in:
sophie committed 2026-06-11 13:47:06 +08:00
1 parent 2631f78b00
commit 4b562cfa82
205 files changed
+15399 -12015

No files matched your search

@@ -0,0 +1,26 @@
/** 去除模型 reasoning 前奏,供 Markdown 展示与出货模块使用 */
export const stripReasoningPrelude = (text: string) => {
if (!text) return '';
let cleaned = text
.replace(/<think[\s\S]*?<\/think>/gi, '')
.replace(/<analysis[\s\S]*?<\/analysis>/gi, '')
.trim();
const reasoningMarkers = [
'让我分析',
'根据应答生成规则',
'分析知识库返回的内容',
'我需要直接给出答案',
'思考过程',
'推理过程',
];
const hasReasoningMarker = reasoningMarkers.some((marker) => cleaned.includes(marker));
if (!hasReasoningMarker) return cleaned;
const headingMatch = cleaned.match(/(^|\n)\s{0,3}#{1,6}\s+/);
if (headingMatch && typeof headingMatch.index === 'number') {
const start = headingMatch.index + (headingMatch[1] ? headingMatch[1].length : 0);
cleaned = cleaned.slice(start).trim();
}
return cleaned;
};