Compare commits

...

7 Commits

Author SHA1 Message Date
1512c7c23a initial commit
Some checks failed
Deploy Bot / build-and-deploy (push) Failing after 9s
2025-06-07 21:54:08 +04:00
be53654811 initial commit
Some checks failed
Deploy Bot / build-and-deploy (push) Failing after 3s
2025-06-07 21:31:49 +04:00
b05ba61ac1 chore: update index.js
Some checks failed
Deploy Bot / build-and-deploy (push) Failing after 10s
2025-06-07 21:21:59 +04:00
b653c29e0b update deploy.yml
Some checks failed
Deploy Bot / build-and-deploy (push) Failing after 9s
2025-06-07 17:14:46 +00:00
124f367b5e Merge pull request 'develop' (#1) from develop into production
Reviewed-on: #1
2025-06-03 19:48:48 +00:00
0950698242 chore: update dependencies 2025-06-03 23:47:05 +04:00
c569b0d586 initial commit 2025-06-03 22:46:28 +04:00
7 changed files with 5832 additions and 0 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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

View File

@ -0,0 +1,23 @@
name: Deploy Bot
on:
push:
branches: [production]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build Docker Image
run: docker build -t my-telegram-bot .
- name: Run Container
run: |
docker stop my-telegram-bot || true
docker rm my-telegram-bot || true
docker run -d --name my-telegram-bot --restart unless-stopped \
-e TELEGRAM_TOKEN=7745542423:AAHc3JM1kvO-Z_1OBp1L95T9QWr4jRrbfpY \
my-telegram-bot

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

35
index.js Normal file
View File

@ -0,0 +1,35 @@
import { Telegraf } from "telegraf";
import axios from "axios";
const botToken = "7745542423:AAHc3JM1kvO-Z_1OBp1L95T9QWr4jRrbfpY"; // замени на свой
const bot = new Telegraf(botToken);
// Новый API Ollama
const OLLAMA_URL = "https://ollama.miduway.space/api/generate";
bot.start((ctx) =>
ctx.reply("Привет! Я — Mistral-бoт через Ollama. Напиши что-нибудь.")
);
bot.on("text", async (ctx) => {
const input = ctx.message.text;
ctx.sendChatAction("typing");
try {
const response = await axios.post(OLLAMA_URL, {
model: "mistral:instruct",
prompt: input,
stream: false,
});
const generated =
response.data.response || "Не удалось сгенерировать ответ.";
ctx.reply(generated.trim());
} catch (err) {
console.error("Ошибка при запросе к Ollama:", err.message);
ctx.reply("Произошла ошибка при генерации текста.");
}
});
bot.launch();
console.log("🤖 Бот запущен и использует Ollama + Mistral.");

5738
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "bot-tg-assistent",
"version": "1.0.0",
"description": "Бот для AI ассистента ###",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js"
},
"repository": {
"type": "git",
"url": "https://gitea.miduway.space/levis/bot-tg-assistent.git"
},
"keywords": [],
"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",
"pm2": "^6.0.6",
"telegraf": "^4.15.3"
}
}