mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
fix(server): check if text is already in train data
This commit is contained in:
@@ -6,9 +6,12 @@ export default function addTrainData(eventData) {
|
||||
join(global.__dirname, global.config.fasttext.trainFile),
|
||||
'utf-8'
|
||||
);
|
||||
const data = file.split('\n');
|
||||
const { label, text } = eventData;
|
||||
|
||||
if (file.includes(text)) return;
|
||||
|
||||
const data = file.split('\n');
|
||||
|
||||
const labelIndex = data.findIndex((data) => data.startsWith(label));
|
||||
|
||||
data.splice(labelIndex === -1 ? 0 : labelIndex, 0, `${label} ${text}`);
|
||||
|
||||
Reference in New Issue
Block a user