(summary: string, lengthLimit: number)
| 219 | // ==================== Post-processing ==================== |
| 220 | |
| 221 | function postProcessSummary(summary: string, lengthLimit: number): string { |
| 222 | let result = summary |
| 223 | if ((result.startsWith('"') && result.endsWith('"')) || (result.startsWith('「') && result.endsWith('」'))) { |
| 224 | result = result.slice(1, -1) |
| 225 | } |
| 226 | const hardLimit = Math.floor(lengthLimit * 1.5) |
| 227 | if (result.length > hardLimit) { |
| 228 | result = result.slice(0, hardLimit - 3) + '...' |
| 229 | } |
| 230 | return result |
| 231 | } |
| 232 | |
| 233 | // ==================== Public API ==================== |
| 234 |
no outgoing calls
no test coverage detected