Fix conversation folder search targeting
This commit is contained in:
@@ -45,6 +45,7 @@ export interface ConversationItem {
|
||||
folderKey?: string;
|
||||
threadCount?: number;
|
||||
searchAliases?: string[];
|
||||
searchTargetProjectIds?: string[];
|
||||
preview: string;
|
||||
lastMessagePreview: string;
|
||||
activityIconCount: number;
|
||||
@@ -470,14 +471,19 @@ function sortConversationItems(items: ConversationItem[]) {
|
||||
|
||||
function buildFolderSearchAliases(items: ConversationItem[]) {
|
||||
const aliases: string[] = [];
|
||||
const seen = new Set<string>();
|
||||
const targetProjectIds: string[] = [];
|
||||
for (const item of items) {
|
||||
const alias = (item.threadTitle?.trim() || item.projectTitle?.trim() || "").trim();
|
||||
if (!alias || seen.has(alias)) continue;
|
||||
if (!alias) continue;
|
||||
aliases.push(alias);
|
||||
seen.add(alias);
|
||||
targetProjectIds.push(item.projectId);
|
||||
}
|
||||
return aliases.length > 0 ? aliases : undefined;
|
||||
return aliases.length > 0
|
||||
? {
|
||||
aliases,
|
||||
targetProjectIds,
|
||||
}
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export function getConversationItems(state: BossState): ConversationItem[] {
|
||||
@@ -541,6 +547,7 @@ export function getConversationHomeItems(state: BossState): ConversationItem[] {
|
||||
return b.latestReplyAt.localeCompare(a.latestReplyAt);
|
||||
})[0];
|
||||
const recentThreadLabel = latestItem.threadTitle.trim();
|
||||
const searchAliases = buildFolderSearchAliases(items);
|
||||
passthrough.push({
|
||||
conversationId: `folder-${folderKey}`,
|
||||
conversationType: "folder_archive",
|
||||
@@ -554,7 +561,12 @@ export function getConversationHomeItems(state: BossState): ConversationItem[] {
|
||||
folderLabel: recentThreadLabel ? `${items.length} 个线程 · 最近:${recentThreadLabel}` : `${items.length} 个线程`,
|
||||
folderKey,
|
||||
threadCount: items.length,
|
||||
searchAliases: buildFolderSearchAliases(items),
|
||||
...(searchAliases
|
||||
? {
|
||||
searchAliases: searchAliases.aliases,
|
||||
searchTargetProjectIds: searchAliases.targetProjectIds,
|
||||
}
|
||||
: {}),
|
||||
preview:
|
||||
latestItem.preview || `包含 ${items.length} 个线程,最近活跃:《${latestItem.threadTitle}》`,
|
||||
lastMessagePreview:
|
||||
|
||||
Reference in New Issue
Block a user