From 8176ff684d28788d0bfbd34110c90ed896446a00 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Fri, 7 Apr 2023 05:01:41 +0100 Subject: [PATCH] feat: skip scoring for content that is too short in length --- data/showcase.json | 2 +- data/topics.json | 15 ++++++++++++--- src/pages/api/score.ts | 7 ++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/data/showcase.json b/data/showcase.json index ad32c585..d4f77257 100644 --- a/data/showcase.json +++ b/data/showcase.json @@ -10,5 +10,5 @@ 43625, 42787, 43258, 33462, 47109, 46939, 45701, 33233, 37346, 40671, 51552, 51585, 48937, 51379, 51460, 51084, 51509, 51478, 51639, 48910, 51139, 39329, 51683, 51077, 51374, 49120, 47356, 17096, 50708, 51430, 51935, 51756, 6558, - 49392, 52186, 52055, 52282, 52270, 5825, 51351, 52233 + 49392, 52186, 52055, 52282, 52270, 5825, 51351, 52233, 51308 ] diff --git a/data/topics.json b/data/topics.json index 92891da7..c200e812 100644 --- a/data/topics.json +++ b/data/topics.json @@ -52,7 +52,11 @@ "52270-127", "52258-1", "52319-1", - "52299-1" + "52299-1", + "52220-2", + "52387-1", + "52314-1", + "52336-2" ] }, { @@ -126,7 +130,11 @@ "50622-16", "50622-15", "33492-5", - "52242-1" + "52242-1", + "52388-2", + "52242-16", + "51084-7", + "50708-12" ] }, { @@ -276,7 +284,8 @@ "51124-29", "31132-7", "31132-5", - "48910-9" + "48910-9", + "48910-11" ] } ] diff --git a/src/pages/api/score.ts b/src/pages/api/score.ts index 5f17a97a..04449465 100644 --- a/src/pages/api/score.ts +++ b/src/pages/api/score.ts @@ -8,7 +8,7 @@ const getOriginalScore = async (cid: string) => { try { const { content } = await (await fetch(toGateway(`ipfs://${cid}`))).json() - if (content) { + if (content?.length > 200) { console.time(`fetching score ${cid}`) const prompt = `According to rule 1 not too short content, rule 2 good originality and innovation, and rule 3 good fun or logic, give this article a score in the range of 0-100 and explain the reason: @@ -45,6 +45,11 @@ const getOriginalScore = async (cid: string) => { .replace(/^Reason:/, "") .trim(), } + } else { + return { + number: 0, + reason: "Content too short", + } } } catch (error) { console.error(error)