fix(web): 聊天列表恢复项目符号,收紧定义列表,压思考条间距(BUG-962/963/964)

This commit is contained in:
jesse-ux
2026-09-18 18:45:19 +08:00
parent 53d78137ff
commit dccedf372e
12 changed files with 214 additions and 9 deletions
+10 -1
View File
@@ -1,17 +1,26 @@
const FENCE = /(```[\s\S]*?```)/;
const DEFINITION_LINE = /^(.{2,80}?)[::](.+)$/u;
const SENTENCE_END = /[。!?;!?;]/u;
const BODY_MAX_CHARS = 40;
function isSkippableLine(line: string): boolean {
return /^(#{1,6}\s|>\s|[-*+]\s|\d+[.)]\s|\|)/.test(line) || line.startsWith("```");
}
function isSingleSentence(text: string): boolean {
return !SENTENCE_END.test(text.replace(/[。!?;!?;]$/u, ""));
}
function isDefinitionLine(block: string): boolean {
const trimmed = block.trim();
if (!trimmed || trimmed.includes("\n") || isSkippableLine(trimmed)) return false;
const match = DEFINITION_LINE.exec(trimmed);
if (!match) return false;
const term = match[1]?.trim() ?? "";
const body = match[2]?.trim() ?? "";
return body.length >= 4;
if (body.length < 4 || body.length > BODY_MAX_CHARS) return false;
if (SENTENCE_END.test(term)) return false;
return isSingleSentence(body);
}
function toListItem(block: string): string {