(messages: T[])
| 132 | } |
| 133 | |
| 134 | function applyDenoise<T extends PreprocessableMessage>(messages: T[]): T[] { |
| 135 | return messages.filter((msg) => { |
| 136 | if (!msg.content) return false |
| 137 | if (msg.replyToMessageId) return true |
| 138 | const content = msg.content.trim() |
| 139 | if (content.length === 0) return false |
| 140 | if (content.length < 2) return false |
| 141 | if (SYSTEM_PLACEHOLDERS.has(content)) return false |
| 142 | if (isPureEmoji(content)) return false |
| 143 | return true |
| 144 | }) |
| 145 | } |
| 146 | |
| 147 | const SYSTEM_PLACEHOLDERS = new Set([ |
| 148 | '[图片]', |
no test coverage detected