MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / deriveChatName

Function deriveChatName

packages/parser/src/formats/google-chat-takeout.ts:258–274  ·  view source on GitHub ↗
(
  manifest: GoogleChatManifest,
  groupInfo: GoogleChatGroupInfo,
  ownerId: string | undefined
)

Source from the content-addressed store, hash-verified

256}
257
258function deriveChatName(
259 manifest: GoogleChatManifest,
260 groupInfo: GoogleChatGroupInfo,
261 ownerId: string | undefined
262): string {
263 if (manifest.chatName?.trim()) return manifest.chatName.trim()
264 if (manifest.chatType === 'group' && groupInfo.name?.trim()) return groupInfo.name.trim()
265
266 const otherMember = (groupInfo.members ?? [])
267 .map(normalizeIdentity)
268 .find((member) => !ownerId || member.platformId !== ownerId)
269 return (
270 otherMember?.name ||
271 groupInfo.members?.map((member) => normalizeIdentity(member).name).join(', ') ||
272 manifest.chatId
273 )
274}
275
276async function* parseGoogleChat(options: ParseOptions): AsyncGenerator<ParseEvent, void, unknown> {
277 const { filePath, batchSize = 5000, onProgress, onLog } = options

Callers 1

parseGoogleChatFunction · 0.85

Calls 1

normalizeIdentityFunction · 0.85

Tested by

no test coverage detected