chore: update dependencies

This commit is contained in:
2025-06-03 23:47:05 +04:00
parent c569b0d586
commit 0950698242
5 changed files with 2399 additions and 3 deletions

3
.env Normal file
View File

@ -0,0 +1,3 @@
BOT_TOKEN=7745542423:AAHc3JM1kvO-Z_1OBp1L95T9QWr4jRrbfpY
LLM_API_URL=http://localhost:4001/generate
HF_TOKEN=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

3
.env.example Normal file
View File

@ -0,0 +1,3 @@
BOT_TOKEN=7745542423:AAHc3JM1kvO-Z_1OBp1L95T9QWr4jRrbfpY
LLM_API_URL=http://localhost:4001/generate
HF_TOKEN=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

37
index.js Normal file
View File

@ -0,0 +1,37 @@
import { Telegraf } from "telegraf";
import axios from "axios";
const botToken = "7745542423:AAHc3JM1kvO-Z_1OBp1L95T9QWr4jRrbfpY";
const bot = new Telegraf(botToken);
const MODEL_URL = "https://llm.miduway.space/generate";
bot.start((ctx) => ctx.reply("Привет! Я — RuGPT-бот. Напиши что-нибудь."));
bot.on("text", async (ctx) => {
const input = ctx.message.text;
ctx.sendChatAction("typing");
try {
const res = await axios.post(MODEL_URL, {
inputs: input,
parameters: {
do_sample: true,
top_k: 50,
top_p: 0.95,
temperature: 1,
},
});
const generated =
res.data.generated_text ||
res.data.generated_texts?.[0] ||
"Не удалось сгенерировать.";
ctx.reply(generated);
} catch (err) {
console.error("Ошибка при запросе к модели:", err.message);
ctx.reply("Произошла ошибка при генерации текста.");
}
});
bot.launch();
console.log("🤖 Бот запущен и использует модель от Сбербанка.");

2349
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,10 @@
"version": "1.0.0",
"description": "Бот для AI ассистента ###",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node index.js",
"dev": "nodemon index.js"
},
"repository": {
"type": "git",
@ -14,10 +16,14 @@
"author": "",
"license": "ISC",
"dependencies": {
"@xenova/transformers": "^2.15.1",
"axios": "^1.9.0",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"express": "^5.1.0",
"node-telegram-bot-api": "^0.66.0",
"nodemon": "^3.1.10"
"nodemon": "^3.1.10",
"pm2": "^6.0.6",
"telegraf": "^4.15.3"
}
}