KingNish commited on
Commit
b2e8189
·
verified ·
1 Parent(s): 399775a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -22,9 +22,13 @@ def generate_response(prompt, chat_history):
22
  # Preprocess chat history to include thinking tags
23
  processed_chat_history = []
24
  for message in chat_history:
25
- # Skipping Thought Process in history
26
- if message["role"] == "assistant" and "metadata" in message and message["metadata"].get("title", "").startswith("Thought"):
27
- pass
 
 
 
 
28
  else:
29
  processed_chat_history.append(message)
30
 
 
22
  # Preprocess chat history to include thinking tags
23
  processed_chat_history = []
24
  for message in chat_history:
25
+ # Skipping Thought Process in history
26
+ if message["role"] == "assistant":
27
+ metadata = message.get("metadata", {})
28
+ if isinstance(metadata, dict) and metadata.get("title", "").startswith("Thought"):
29
+ pass
30
+ else:
31
+ processed_chat_history.append(message)
32
  else:
33
  processed_chat_history.append(message)
34