MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / extractText

Function extractText

packages/parser/src/formats/utils/telegram-utils.ts:70–81  ·  view source on GitHub ↗
(text: string | Array<string | { type: string; text: string }>)

Source from the content-addressed store, hash-verified

68 * text 可以是字符串或 mixed 数组
69 */
70export function extractText(text: string | Array<string | { type: string; text: string }>): string {
71 if (typeof text === 'string') return text
72 if (!Array.isArray(text)) return ''
73
74 return text
75 .map((part) => {
76 if (typeof part === 'string') return part
77 if (part && typeof part === 'object' && 'text' in part) return part.text
78 return ''
79 })
80 .join('')
81}
82
83/**
84 * 从 from_id 提取平台 ID

Callers 1

buildContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected