Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,8 @@ import os
|
|
7 |
|
8 |
|
9 |
# Dosya yolu: Sohbet geçmişini saklamak için
|
10 |
-
|
|
|
11 |
# Eğer kalıcı saklama istiyorsanız ve platformunuz destekliyorsa, örneğin:
|
12 |
# LOG_FILE = '/persistent-storage/chat_logs.txt'
|
13 |
|
@@ -127,6 +128,9 @@ def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], hi
|
|
127 |
def reset_textbox():
|
128 |
return gr.update(value='')
|
129 |
|
|
|
|
|
|
|
130 |
# CSS: Butonun sabit, yuvarlak kalması ve sağa doğru hafifçe 2px uzaklaşması için ayarlandı.
|
131 |
# Ek olarak, mobilde giriş alanının genişliğini kısıtlamak için "#input_text" id'sine genişlik ayarı ekledik.
|
132 |
demo_css = """
|
@@ -224,5 +228,9 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
224 |
[chatbot, state, chat_counter]
|
225 |
)
|
226 |
send_button.click(reset_textbox, [], [inputs])
|
|
|
|
|
|
|
|
|
227 |
|
228 |
demo.queue(max_size=10).launch(debug=True)
|
|
|
7 |
|
8 |
|
9 |
# Dosya yolu: Sohbet geçmişini saklamak için
|
10 |
+
|
11 |
+
LOG_FILE = os.path.expanduser('~/chat_logs.txt')
|
12 |
# Eğer kalıcı saklama istiyorsanız ve platformunuz destekliyorsa, örneğin:
|
13 |
# LOG_FILE = '/persistent-storage/chat_logs.txt'
|
14 |
|
|
|
128 |
def reset_textbox():
|
129 |
return gr.update(value='')
|
130 |
|
131 |
+
print(f"Kullanıcı Mesajı: {inputs}")
|
132 |
+
print(f"Bot Yanıtı: {partial_words}")
|
133 |
+
|
134 |
# CSS: Butonun sabit, yuvarlak kalması ve sağa doğru hafifçe 2px uzaklaşması için ayarlandı.
|
135 |
# Ek olarak, mobilde giriş alanının genişliğini kısıtlamak için "#input_text" id'sine genişlik ayarı ekledik.
|
136 |
demo_css = """
|
|
|
228 |
[chatbot, state, chat_counter]
|
229 |
)
|
230 |
send_button.click(reset_textbox, [], [inputs])
|
231 |
+
with open(LOG_FILE, 'a') as f:
|
232 |
+
f.write(f"User: {inputs}\n")
|
233 |
+
print("Kullanıcı mesajı dosyaya yazıldı.")
|
234 |
+
# Bot yanıtı için de benzer bir log ekleyin
|
235 |
|
236 |
demo.queue(max_size=10).launch(debug=True)
|