v1.6.0: max_bot fixes — feature keys, flush→commit, test-run, categories, broadcast page, proxy error handling, deploy scripts

This commit is contained in:
2026-05-24 07:50:38 +03:00
parent bd048ea23d
commit 493e0b37a1
127 changed files with 6082 additions and 65 deletions
+28
View File
@@ -0,0 +1,28 @@
from app.settings_cache import SettingsCache
from app.integrations.yandex_gpt import analyze_emotion_with_gpt
_NEGATIVE_WORDS = [
"ужасно", "плохо", "долго", "кошмар", "отвратительно", "невыносимо",
"бесполезно", "халтура", "безобразие", "позор", "разочарован", "злюсь",
"раздражён", "недоволен", "жалоба", "претензия", "скандал", "суд",
"верните деньги", "мошенники", "обман",
]
async def detect_emotion(text: str) -> str:
gpt_key = SettingsCache.get("yandex_gpt_key")
if gpt_key:
try:
result = await analyze_emotion_with_gpt(text)
if result in ("positive", "neutral", "negative"):
return result
except Exception:
pass
return _keyword_fallback(text)
def _keyword_fallback(text: str) -> str:
text_lower = text.lower()
if any(word in text_lower for word in _NEGATIVE_WORDS):
return "negative"
return "neutral"