This commit is contained in:
Luk
2025-09-24 11:46:52 +08:00
parent 0c05bfd464
commit f9ffbb4989
2 changed files with 14 additions and 8 deletions

View File

@@ -363,7 +363,7 @@ module.exports = {
summarize_story (story = []) {
// story is an array of objects, each object could either be {text:'some string'}, {image: url} or {video:url}. Please construct a summary object as result: { textLength, imageCount, VideoCount }
return story.reduce(
(summary, { text, image, video, audio, file, linkTarget } = {}) => {
(summary, { text, image, video, audio, file, linkTarget, _autocontent } = {}) => {
if (text) {
summary.textLength += text.length
summary.wordCount += text.split(/\s+/).length
@@ -377,12 +377,14 @@ module.exports = {
summary.fileCount++
} else if (linkTarget) {
summary.linkCount++
} else if (_autocontent) {
summary.emptyContent++
} else {
summary.untypeCount++
}
return summary
},
{ textLength: 0, wordCount: 0, imageCount: 0, videoCount: 0, audioCount: 0, fileCount: 0, linkCount: 0, untypeCount: 0 }
{ textLength: 0, wordCount: 0, imageCount: 0, videoCount: 0, audioCount: 0, fileCount: 0, linkCount: 0, emptyContent: 0, untypeCount: 0 }
)
},