Spaces:
Sleeping
Sleeping
Update app.py
Browse files17 unmodified lines181920212122232425262728293031324 unmodified lines37383932404142434445464748495035515237535455395657585960616217 unmodified lines generation_config=generation_config,)
# Sohbet oturumu başlatmachat_session = model.start_chat(history=[])chat_session = model.start_chat( history=[ { "role": "model", "parts": ["Merhaba! Ben sanal diş hekiminiz. Nasıl yardımcı olabilirim? 🦷 😊"] } ])
# 3. Chatbot Yanıt Fonksiyonudef respond(4 unmodified lines temperature, top_p,): chat_session.history = [{"role": "system", "content": system_message}] # Sistemin başlangıç mesajını ayarlıyoruz chat_session.history = [ { "role": "system", "parts": [system_message] } ]
# Kullanıcı ve asistan mesajlarını ayarlıyoruz for user_msg, assistant_msg in history: if user_msg: chat_session.history.append({"role": "user", "content": user_msg}) chat_session.history.append({"role": "user", "parts": [user_msg]}) if assistant_msg: chat_session.history.append({"role": "assistant", "content": assistant_msg}) chat_session.history.append({"role": "assistant", "parts": [assistant_msg]})
# Yeni kullanıcının mesajını ekleyip yanıt alıyoruz chat_session.history.append({"role": "user", "content": message}) chat_session.history.append({"role": "user", "parts": [message]}) response = chat_session.send_message(message)
# Yanıtı döndürme return response.text
# 4. Gradio Arayüzüapp.py+24-5