feat: 标题去除特殊tag

This commit is contained in:
ZyGuo committed 2026-06-02 16:24:01 +08:00
1 parent 0122d3e361
commit 3c92e87156
2 files changed
+41 -25

No files matched your search

+12
View File
@@ -65,3 +65,15 @@ export function textOfMessage(message: Message) {
export function titleOfThread(thread: AgentThread) {
return thread.values?.title ?? "Untitled";
}
export function sanitizeThreadTitleForDisplay(title: string | null | undefined) {
if (!title) return "Untitled";
const cleaned = title
.replace(/<\/?[^>\n]+>/g, " ")
.replace(/<[^>\n]*$/g, " ")
.replace(/\s+/g, " ")
.trim();
return cleaned || "Untitled";
}