feat: GODEL AI

This commit is contained in:
GramingFoxTeam
2022-12-25 12:49:16 +03:00
parent 18e57b0c32
commit 0ba525c4a5
14 changed files with 197 additions and 289 deletions

View File

@@ -2,24 +2,13 @@ export default {
name: 'aiResponse',
once: false,
async execute(bot, config, aiRes) {
const response = config.responses.find(
(res) => res.label === aiRes.predictions[0].label
);
if (!response) return;
const ids = aiRes.id.split('/');
if (Number(aiRes.predictions[0].score) >= response.threshold) {
const ids = aiRes.id.split('/');
bot.sendMessage(ids[0], aiRes.response, {
message_thread_id: ids[1],
reply_to_message_id: ids[2]
});
if (!response.responses[0]) return;
const replyMsg = response.responses.find(res => res.p === 'telegram').text;
bot.sendMessage(ids[0], replyMsg, {
message_thread_id: ids[1],
reply_to_message_id: ids[2]
});
return;
}
return;
}
};