Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -285,15 +285,19 @@ def vitalisasi(message, history, user_id):
|
|
285 |
if user_id not in context:
|
286 |
context[user_id] = ""
|
287 |
|
|
|
|
|
|
|
|
|
288 |
modified_input = (
|
289 |
f"System Instructions: {system_instructions}\n"
|
290 |
f"Previous Context: {context[user_id]}\n"
|
291 |
-
f"User Input: {
|
292 |
)
|
293 |
|
294 |
print("History:", history)
|
295 |
|
296 |
-
full_conversation = "\n".join([f"User: {item['content']}" if item['role'] == 'user' else f"AI: {item['content']}" for item in history])
|
297 |
|
298 |
consciousness_score = iit_consciousness_processing(dummy_input)
|
299 |
|
@@ -325,8 +329,8 @@ def vitalisasi(message, history, user_id):
|
|
325 |
response_api_four = client_api_four.predict(
|
326 |
message=f"{full_conversation}\nUser: {message}",
|
327 |
param_2=512,
|
328 |
-
|
329 |
-
|
330 |
api_name="/chat"
|
331 |
)
|
332 |
|
@@ -354,13 +358,14 @@ def vitalisasi(message, history, user_id):
|
|
354 |
api_name="/chat"
|
355 |
)
|
356 |
|
357 |
-
history.append({'role': 'user', 'content':
|
358 |
history.append({'role': 'assistant', 'content': response_main})
|
359 |
|
360 |
-
context[user_id] += f"
|
361 |
|
362 |
return "", history
|
363 |
|
|
|
364 |
theme ='Taithrah/Minimal'
|
365 |
|
366 |
with gr.Blocks(theme=theme) as demo:
|
|
|
285 |
if user_id not in context:
|
286 |
context[user_id] = ""
|
287 |
|
288 |
+
current_time = get_current_time()
|
289 |
+
|
290 |
+
timestamped_message = f"{current_time} - User: {message}"
|
291 |
+
|
292 |
modified_input = (
|
293 |
f"System Instructions: {system_instructions}\n"
|
294 |
f"Previous Context: {context[user_id]}\n"
|
295 |
+
f"User Input: {timestamped_message}\n"
|
296 |
)
|
297 |
|
298 |
print("History:", history)
|
299 |
|
300 |
+
full_conversation = "\n".join([f"{current_time} - User: {item['content']}" if item['role'] == 'user' else f"{current_time} - AI: {item['content']}" for item in history])
|
301 |
|
302 |
consciousness_score = iit_consciousness_processing(dummy_input)
|
303 |
|
|
|
329 |
response_api_four = client_api_four.predict(
|
330 |
message=f"{full_conversation}\nUser: {message}",
|
331 |
param_2=512,
|
332 |
+
param_3=0.7,
|
333 |
+
param_4=0.95,
|
334 |
api_name="/chat"
|
335 |
)
|
336 |
|
|
|
358 |
api_name="/chat"
|
359 |
)
|
360 |
|
361 |
+
history.append({'role': 'user', 'content': timestamped_message})
|
362 |
history.append({'role': 'assistant', 'content': response_main})
|
363 |
|
364 |
+
context[user_id] += f"{timestamped_message}\nAI: {response_main}\n"
|
365 |
|
366 |
return "", history
|
367 |
|
368 |
+
|
369 |
theme ='Taithrah/Minimal'
|
370 |
|
371 |
with gr.Blocks(theme=theme) as demo:
|