AnatoliiG commited on
Commit ·
929276c
1
Parent(s): f9aca5d
Update callbacks.py
Browse files3 unmodified lines4567893 unmodified linesfrom src.utils.helpers import get_clean_textdef bot_response(history, system_prompt, temperature, max_tokens):messages = [{"role": "system", "content": system_prompt}]for msg in history[-7:]:3 unmodified lines45678910111213141516171819202122232425262728293031323334353 unmodified linesfrom src.utils.helpers import get_clean_textdef user_input(user_message, history):"""Добавляет сообщение пользователя в историю и очищает поле ввода."""if not user_message:return None, historyhistory = history or []history.append({"role": "user", "content": str(user_message)})return "", historydef set_interactive(is_interactive):"""Блокирует/разблокирует интерфейс во время генерации."""return (gr.update(interactive=is_interactive,placeholder="Wait..."if not is_interactiveelse "Type your message here...",),gr.update(interactive=is_interactive),)def bot_response(history, system_prompt, temperature, max_tokens):messages = [{"role": "system", "content": system_prompt}]for msg in history[-7:]:
src/ui/callbacks.py+26