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