Spaces:
Running
Running
File size: 792 Bytes
d86715f fd459d5 d86715f fd459d5 d86715f fd459d5 d86715f fd459d5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
def analyze_user_input(user_input):
"""Определяет тип запроса пользователя (код, текст, объяснение)"""
text = user_input.lower()
if any(x in text for x in ["код", "python", "js", "html", "function"]):
return {"category": "coding"}
elif any(x in text for x in ["объясни", "как работает", "почему"]):
return {"category": "science"}
elif any(x in text for x in ["напиши", "создай", "расскажи"]):
return {"category": "creative"}
else:
return {"category": "general"}
def adapt_answer(answer):
"""Делает стиль ответа дружелюбным"""
if not answer.endswith("😊"):
answer += " 😊"
return answer
|