Update app.py
Browse files
app.py
CHANGED
@@ -121,6 +121,12 @@ def initialize_chat_engine(index):
|
|
121 |
|
122 |
# Fungsi untuk menghasilkan respons chatbot
|
123 |
def generate_response(message, history, chat_engine):
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
response = chat_engine.stream_chat(message)
|
125 |
text = "".join(response.response_gen) # Gabungkan semua token menjadi string
|
126 |
history.append((message, text)) # Tambahkan ke riwayat
|
|
|
121 |
|
122 |
# Fungsi untuk menghasilkan respons chatbot
|
123 |
def generate_response(message, history, chat_engine):
|
124 |
+
chat_messages = [
|
125 |
+
ChatMessage(
|
126 |
+
role="system",
|
127 |
+
content="Anda adalah chatbot yang selalu menjawab pertanyaan secara singkat, ramah, dan jelas dalam bahasa Indonesia."
|
128 |
+
),
|
129 |
+
]
|
130 |
response = chat_engine.stream_chat(message)
|
131 |
text = "".join(response.response_gen) # Gabungkan semua token menjadi string
|
132 |
history.append((message, text)) # Tambahkan ke riwayat
|