mirror of
https://gitflic.ru/project/alt-gnome/karkas.git
synced 2024-12-24 00:33:06 +03:00
Revert "Delete gnomik bot from OCAB Lite"
This reverts commit 984e4cf4e1
.
This commit is contained in:
parent
21ae060c81
commit
d987938ef9
23
src/gnomik/Dockerfile
Normal file
23
src/gnomik/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
FROM python:3.12-slim as builder
|
||||
|
||||
RUN pip install poetry
|
||||
RUN mkdir -p /app
|
||||
COPY . /app
|
||||
|
||||
# Фикс
|
||||
|
||||
RUN sed -i '/karkas-core = {/{s/, develop = true//}' /app/src/altlinux/pyproject.toml && \
|
||||
sed -i '/karkas-blocks = {/{s/, develop = true//}' /app/src/altlinux/pyproject.toml && \
|
||||
sed -i '/karkas-core = {/{s/, develop = true//}' /app/src/karkas_blocks/pyproject.toml
|
||||
|
||||
WORKDIR /app/src/gnomik
|
||||
|
||||
RUN poetry lock && poetry install
|
||||
|
||||
FROM python:3.12-slim as base
|
||||
|
||||
COPY --from=builder /app/src/gnomik /app
|
||||
|
||||
WORKDIR /app
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
CMD ["python", "-m", "gnomik"]
|
14
src/gnomik/Dockerfile.dockerignore
Normal file
14
src/gnomik/Dockerfile.dockerignore
Normal file
@ -0,0 +1,14 @@
|
||||
**/Dockerfile
|
||||
**/*.dockerignore
|
||||
**/docker-compose.yml
|
||||
|
||||
**/.git
|
||||
**/.gitignore
|
||||
|
||||
**/.venv
|
||||
|
||||
**/.mypy_cache
|
||||
**/__pycache__/
|
||||
|
||||
src/gnomik/config.yaml
|
||||
src/gnomik/database/*
|
55
src/gnomik/README.md
Normal file
55
src/gnomik/README.md
Normal file
@ -0,0 +1,55 @@
|
||||
# Gnomик
|
||||
|
||||
![Логотип](./docs/gnomik.jpg)
|
||||
|
||||
Чат-бот помощник в [ALT Gnome Chat](https://t.me/alt_gnome_chat).
|
||||
|
||||
|
||||
ALT Regular Gnome Community - открытое сообщество пользователей операционной системы ALT Regular Gnome.
|
||||
|
||||
- [Канал](https://t.me/alt_gnome)
|
||||
- [Wiki](https://alt-gnome.wiki)
|
||||
|
||||
## Описание
|
||||
|
||||
Gnomик - это чат-бот, разработанный на платформе Open Chat AI Bot (OCAB) для Telegram. Он предоставляет различные функции и возможности, помогающие пользователям операционной системы ALT Regular Gnome.
|
||||
|
||||
## Функционал
|
||||
|
||||
<!--
|
||||
TODO: описать функционал
|
||||
-->
|
||||
|
||||
## Запуск
|
||||
|
||||
### Docker
|
||||
|
||||
1. Соберите Docker-образ:
|
||||
```bash
|
||||
docker build -t gnomik .
|
||||
```
|
||||
2. Запустите контейнер:
|
||||
```bash
|
||||
docker run -p 9000:9000 -v ./config.yaml:/app/config.yaml -v ./database:/app/database gnomik
|
||||
```
|
||||
|
||||
Замените `./config.yaml` и `./database` на пути к вашим локальным файлам конфигурации и паки для базы данных.
|
||||
|
||||
### Вручную
|
||||
|
||||
1. Активируйте виртуальное окружение Gnomика:
|
||||
```bash
|
||||
poetry shell
|
||||
```
|
||||
2. Запустите бота:
|
||||
```bash
|
||||
python -m gnomik
|
||||
```
|
||||
|
||||
## Конфигурация
|
||||
|
||||
Конфигурация бота находится в файле `config.yaml`.
|
||||
|
||||
## Модули
|
||||
|
||||
Список загружаемых модулей указан в файле `__main__.py`.
|
18
src/gnomik/config-example.yaml
Normal file
18
src/gnomik/config-example.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
core:
|
||||
mode: WEBHOOK
|
||||
token: xxx
|
||||
webhook:
|
||||
public_url: xxx
|
||||
filters:
|
||||
approved_chat_id: -4128011756 | -4128011756
|
||||
default_chat_tag: '@alt_gnome_chat'
|
||||
miniapp:
|
||||
public_url: xxx
|
||||
yandexgpt:
|
||||
catalogid: xxx
|
||||
inword: помогите | не работает
|
||||
prompt: Ты чат-бот ...
|
||||
startword: Бот| Бот, | бот | бот,
|
||||
token: xxx
|
||||
token_for_answer: 2000
|
||||
token_for_request: 8000
|
0
src/gnomik/database/.gitkeep
Normal file
0
src/gnomik/database/.gitkeep
Normal file
12
src/gnomik/docker-compose.yml
Normal file
12
src/gnomik/docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: src/gnomik/Dockerfile
|
||||
ports:
|
||||
- 9000:9000
|
||||
volumes:
|
||||
- ./config.yaml:/app/config.yaml
|
||||
- ./database:/app/database
|
BIN
src/gnomik/docs/gnomik.jpg
Normal file
BIN
src/gnomik/docs/gnomik.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
0
src/gnomik/gnomik/__init__.py
Normal file
0
src/gnomik/gnomik/__init__.py
Normal file
29
src/gnomik/gnomik/__main__.py
Normal file
29
src/gnomik/gnomik/__main__.py
Normal file
@ -0,0 +1,29 @@
|
||||
import asyncio
|
||||
|
||||
from karkas_blocks import block_loader
|
||||
from karkas_core import Karkas
|
||||
|
||||
|
||||
async def main():
|
||||
ocab = Karkas()
|
||||
await ocab.init_app(
|
||||
[
|
||||
block_loader("standard", "config", safe=False),
|
||||
block_loader("standard", "database", safe=False),
|
||||
block_loader("standard", "fsm_database_storage", safe=False),
|
||||
block_loader("standard", "roles", safe=False),
|
||||
block_loader("external", "yandexgpt", safe=False),
|
||||
#
|
||||
block_loader("standard", "command_helper"),
|
||||
block_loader("standard", "info"),
|
||||
block_loader("standard", "filters"),
|
||||
block_loader("external", "create_report_apps"),
|
||||
block_loader("standard", "admin"),
|
||||
block_loader("standard", "message_processing"),
|
||||
block_loader("standard", "miniapp", safe=False),
|
||||
]
|
||||
)
|
||||
await ocab.start()
|
||||
|
||||
|
||||
asyncio.run(main())
|
2162
src/gnomik/poetry.lock
generated
Normal file
2162
src/gnomik/poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
src/gnomik/poetry.toml
Normal file
2
src/gnomik/poetry.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[virtualenvs]
|
||||
in-project = true
|
15
src/gnomik/pyproject.toml
Normal file
15
src/gnomik/pyproject.toml
Normal file
@ -0,0 +1,15 @@
|
||||
[tool.poetry]
|
||||
name = "gnomik"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Максим Слипенко <maxim@slipenko.com>"]
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "~3.12"
|
||||
ocab-core = { extras=["webhook"], path = "../ocab_core", develop = true }
|
||||
ocab-modules = { path = "../ocab_modules", develop = true }
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
Loading…
Reference in New Issue
Block a user