diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a69e5d3..0000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM python:3.12-slim - -WORKDIR /app - -# Зависимости -COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt - -# Код -COPY . . - -# Порт -EXPOSE 5000 - -# Запуск -CMD ["python", "app.py"] diff --git a/app.py b/site/app.py similarity index 100% rename from app.py rename to site/app.py diff --git a/site/config.py b/site/config.py new file mode 100644 index 0000000..4af27b7 --- /dev/null +++ b/site/config.py @@ -0,0 +1,87 @@ +""" +Централизованная конфигурация приложения Say. + +Все настройки читаются из переменных окружения с разумными значениями по умолчанию. +""" + +import os + +# ============================================================================= +# API — единый эндпоинт (aillm.ru) +# ============================================================================= + +API_BASE = os.environ.get("API_BASE", "https://api.aillm.ru") +API_KEY = os.environ.get("API_KEY", "") # ⚠️ Без ключа — только через env! + +# ============================================================================= +# Whisper (распознавание речи) +# ============================================================================= + +WHISPER_URL = os.environ.get( + "WHISPER_URL", + f"{API_BASE}/v1/audio/transcriptions", +) +WHISPER_KEY = os.environ.get("WHISPER_KEY", API_KEY) +WHISPER_MODEL = os.environ.get("WHISPER_MODEL", "whisper-large-v3") + +# ============================================================================= +# Три LLM-профиля — каждый со своим именем, моделью и системным промптом +# ============================================================================= + +LLM_PROFILES = [ + { + "id": "ddm", + "name": "DDM-120", + "description": "Быстрая модель, общие вопросы", + "url": os.environ.get("LLM_URL_DDM", f"{API_BASE}/v1/chat/completions"), + "key": os.environ.get("LLM_KEY_DDM", API_KEY), + "model": os.environ.get("LLM_MODEL_DDM", "ddm-120"), + "system_prompt": os.environ.get( + "LLM_SYSTEM_DDM", + "Ты — полезный ассистент. Отвечай кратко и по делу на том же языке, что и запрос.", + ), + "temperature": float(os.environ.get("LLM_TEMP_DDM", "0.7")), + "max_tokens": int(os.environ.get("LLM_TOKENS_DDM", "1024")), + }, + { + "id": "qwen", + "name": "Qwen", + "description": "Мощная модель, сложные задачи", + "url": os.environ.get("LLM_URL_QWEN", f"{API_BASE}/v1/chat/completions"), + "key": os.environ.get("LLM_KEY_QWEN", API_KEY), + "model": os.environ.get("LLM_MODEL_QWEN", "qwen-plus"), + "system_prompt": os.environ.get( + "LLM_SYSTEM_QWEN", + "Ты — эксперт-аналитик. Отвечай развернуто, структурированно, на языке запроса.", + ), + "temperature": float(os.environ.get("LLM_TEMP_QWEN", "0.7")), + "max_tokens": int(os.environ.get("LLM_TOKENS_QWEN", "2048")), + }, + { + "id": "deepseek", + "name": "DeepSeek", + "description": "Глубокая аналитика, код, рассуждения", + "url": os.environ.get("LLM_URL_DEEPSEEK", f"{API_BASE}/v1/chat/completions"), + "key": os.environ.get("LLM_KEY_DEEPSEEK", API_KEY), + "model": os.environ.get("LLM_MODEL_DEEPSEEK", "deepseek-chat"), + "system_prompt": os.environ.get( + "LLM_SYSTEM_DEEPSEEK", + "Ты — глубокий аналитик и программист. Думай step-by-step, отвечай на языке запроса.", + ), + "temperature": float(os.environ.get("LLM_TEMP_DEEPSEEK", "0.7")), + "max_tokens": int(os.environ.get("LLM_TOKENS_DEEPSEEK", "4096")), + }, +] + +# ============================================================================= +# Flask +# ============================================================================= + +FLASK_HOST = os.environ.get("HOST", "0.0.0.0") +FLASK_PORT = int(os.environ.get("PORT", "5000")) + +# ============================================================================= +# Логирование +# ============================================================================= + +LOG_LEVEL = os.environ.get("LOG_LEVEL", "INFO") diff --git a/routes/__init__.py b/site/routes/__init__.py similarity index 100% rename from routes/__init__.py rename to site/routes/__init__.py diff --git a/routes/api.py b/site/routes/api.py similarity index 100% rename from routes/api.py rename to site/routes/api.py diff --git a/routes/pages.py b/site/routes/pages.py similarity index 100% rename from routes/pages.py rename to site/routes/pages.py diff --git a/services/__init__.py b/site/services/__init__.py similarity index 100% rename from services/__init__.py rename to site/services/__init__.py diff --git a/services/llm.py b/site/services/llm.py similarity index 100% rename from services/llm.py rename to site/services/llm.py diff --git a/services/whisper.py b/site/services/whisper.py similarity index 100% rename from services/whisper.py rename to site/services/whisper.py diff --git a/static/favicon.png b/site/static/favicon.png similarity index 100% rename from static/favicon.png rename to site/static/favicon.png diff --git a/static/nubes-logo.svg b/site/static/nubes-logo.svg similarity index 100% rename from static/nubes-logo.svg rename to site/static/nubes-logo.svg diff --git a/static/style.css b/site/static/style.css similarity index 100% rename from static/style.css rename to site/static/style.css diff --git a/templates/index.html b/site/templates/index.html similarity index 100% rename from templates/index.html rename to site/templates/index.html