SamiKoen commited on
Commit
7fbd340
·
verified ·
1 Parent(s): d6b6f80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -122,8 +122,9 @@ def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], hi
122
  print(f"Dosya yazma hatası (Bot): {e}")
123
 
124
  def save_chat(chatbot):
125
- """ Sohbeti dosyaya kaydetme fonksiyonu """
126
- file_path = os.path.abspath(LOG_FILE) # Dosyanın tam yolunu al
 
127
  try:
128
  with open(LOG_FILE, 'a', encoding='utf-8') as f:
129
  f.write("\n--- Kayıt Edilen Sohbet ---\n")
@@ -139,6 +140,8 @@ def save_chat(chatbot):
139
  def reset_textbox():
140
  return gr.update(value='')
141
 
 
 
142
  # Gradio arayüzü
143
  demo_css = """
144
  #send_button, #save_button {
 
122
  print(f"Dosya yazma hatası (Bot): {e}")
123
 
124
  def save_chat(chatbot):
125
+ file_path = os.path.abspath(LOG_FILE)
126
+ if not chatbot:
127
+ return f"Hata: Kaydedilecek sohbet yok!\nDosya: {file_path}"
128
  try:
129
  with open(LOG_FILE, 'a', encoding='utf-8') as f:
130
  f.write("\n--- Kayıt Edilen Sohbet ---\n")
 
140
  def reset_textbox():
141
  return gr.update(value='')
142
 
143
+
144
+
145
  # Gradio arayüzü
146
  demo_css = """
147
  #send_button, #save_button {