fix: remove duplicated model badge display
This commit is contained in:
parent
4167f30fce
commit
82162f8936
@ -482,7 +482,7 @@ function extractCanvasModelName(text: string): string {
|
|||||||
if (!source) return "";
|
if (!source) return "";
|
||||||
|
|
||||||
const badgeMatch = source.match(
|
const badgeMatch = source.match(
|
||||||
/^\s*[◈◇◆🔹⬡✦•·]\s*([A-Za-z][A-Za-z0-9 .:+\-_/()]{2,})\s*$/im
|
/^\s*[◈◇◆🔹⬡✦•·]\s*([^\n]+?)\s*$/im
|
||||||
);
|
);
|
||||||
if (badgeMatch?.[1]) {
|
if (badgeMatch?.[1]) {
|
||||||
return badgeMatch[1].trim();
|
return badgeMatch[1].trim();
|
||||||
@ -501,7 +501,7 @@ function extractCanvasModelName(text: string): string {
|
|||||||
function stripCanvasModelRoutingLines(text: string): string {
|
function stripCanvasModelRoutingLines(text: string): string {
|
||||||
return String(text || "")
|
return String(text || "")
|
||||||
.replace(/^\s*(?:Routed to|Using model)\s*[::].*$/gim, "")
|
.replace(/^\s*(?:Routed to|Using model)\s*[::].*$/gim, "")
|
||||||
.replace(/^\s*[◈◇◆🔹⬡✦•·]\s*[A-Za-z][A-Za-z0-9 .:+\-_/()]{2,}\s*$/gim, "")
|
.replace(/^\s*[◈◇◆🔹⬡✦•·]\s*[^\n]+\s*$/gim, "")
|
||||||
.replace(/\n{3,}/g, "\n\n")
|
.replace(/\n{3,}/g, "\n\n")
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
@ -761,7 +761,7 @@ function shouldSplitCanvasAnalysisAfterLine(line: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 模型徽标行(例如:◈ Nano Banana Pro)
|
// 模型徽标行(例如:◈ Nano Banana Pro)
|
||||||
return /^[◈◇◆🔹⬡✦•·]\s*[A-Za-z][A-Za-z0-9 .:+\-_/()]{2,}\s*$/i.test(normalized);
|
return /^[◈◇◆🔹⬡✦•·]\s*[^\n]+$/i.test(normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractCanvasImageAnalysisSection(content: string): CanvasAnalysisSection | null {
|
function extractCanvasImageAnalysisSection(content: string): CanvasAnalysisSection | null {
|
||||||
|
|||||||
@ -161,9 +161,7 @@ function filterAgentRoutingNoise(text: string): string {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 如果文本里没有现成的模型展示行,则补一行友好的模型名
|
// 如果文本里没有现成的模型展示行,则补一行友好的模型名
|
||||||
const hasModelBadgeLine = /^\s*[◈◇◆🔹⬡✦•·]\s*[A-Za-z][A-Za-z0-9 .:+\-_/()]{2,}\s*$/im.test(
|
const hasModelBadgeLine = /^\s*[◈◇◆🔹⬡✦•·]\s*[^\n]+$/im.test(filtered);
|
||||||
filtered
|
|
||||||
);
|
|
||||||
if (routedModelName && !hasModelBadgeLine) {
|
if (routedModelName && !hasModelBadgeLine) {
|
||||||
filtered = `◈ ${routedModelName}\n\n${filtered}`;
|
filtered = `◈ ${routedModelName}\n\n${filtered}`;
|
||||||
}
|
}
|
||||||
@ -179,9 +177,9 @@ const ASSISTANT_TYPEWRITER_SECTION_REGEX =
|
|||||||
/(?:###\s*需求理解|【\s*需求理解\s*】|###\s*图片分析|【\s*图片分析\s*】|###\s*执行计划|【\s*执行计划\s*】|###\s*输出设置|【\s*输出设置\s*】)/;
|
/(?:###\s*需求理解|【\s*需求理解\s*】|###\s*图片分析|【\s*图片分析\s*】|###\s*执行计划|【\s*执行计划\s*】|###\s*输出设置|【\s*输出设置\s*】)/;
|
||||||
const ASSISTANT_TYPEWRITER_STORAGE_KEY = "assistant-typewriter-completed-keys-v1";
|
const ASSISTANT_TYPEWRITER_STORAGE_KEY = "assistant-typewriter-completed-keys-v1";
|
||||||
const MODEL_BADGE_LINE_REGEX =
|
const MODEL_BADGE_LINE_REGEX =
|
||||||
/^\s*[◈◇◆🔹⬡✦•·]\s*([A-Za-z][A-Za-z0-9 .:+\-_/()]{2,})\s*$/im;
|
/^\s*[◈◇◆🔹⬡✦•·]\s*([^\n]+?)\s*$/im;
|
||||||
const MODEL_BADGE_LINE_GLOBAL_REGEX =
|
const MODEL_BADGE_LINE_GLOBAL_REGEX =
|
||||||
/^\s*[◈◇◆🔹⬡✦•·]\s*[A-Za-z][A-Za-z0-9 .:+\-_/()]{2,}\s*$/gim;
|
/^\s*[◈◇◆🔹⬡✦•·]\s*[^\n]+\s*$/gim;
|
||||||
|
|
||||||
function extractModelBadgeName(text: string): string {
|
function extractModelBadgeName(text: string): string {
|
||||||
if (!text) return "";
|
if (!text) return "";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user