You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

"""Страница настроек: статус LLM-ключа и проверка подключения (E1.8).
Ключ — общий, читается из ENV (`DEEPSEEK_API_KEY` / `OPENAI_API_KEY`). Здесь —
только просмотр статуса и smoke-проверка. Изменение ключа — через `.env` и
рестарт процесса.
"""
from __future__ import annotations
from flask import Blueprint, jsonify, render_template
from ..auth.decorators import login_required
from ..services.llm_client import get_llm_config, ping_llm
settings_bp = Blueprint('settings', __name__)
@settings_bp.route('/settings', methods=['GET'])
@login_required
def settings_page():
cfg = get_llm_config()
return render_template(
'settings.html',
configured=cfg is not None,
provider=cfg.provider if cfg else None,
model=cfg.model if cfg else None,
base_url=cfg.base_url if cfg else None,
)
@settings_bp.route('/api/llm/ping', methods=['POST', 'GET'])
@login_required
def api_llm_ping():
return jsonify(ping_llm())