feat: 标题去除特殊tag
This commit is contained in:
1 parent
0122d3e361
commit
3c92e87156
2 files changed
+41
-25
No files matched your search
@@ -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";
|
||||
}
|
||||
Reference in new issue
Block a user