feat: skip scoring for content that is too short in length

This commit is contained in:
DIYgod
2023-04-07 05:01:41 +01:00
parent 4c279bdc0d
commit 8176ff684d
3 changed files with 19 additions and 5 deletions
+1 -1
View File
@@ -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
]
+12 -3
View File
@@ -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"
]
}
]
+6 -1
View File
@@ -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)