shgao commited on
Commit
cbc1723
·
1 Parent(s): 7b94e0e

Update app and utils, add image with Git LFS

Browse files
Files changed (4) hide show
  1. .gitattributes +4 -0
  2. app.py +0 -0
  3. static/images/txagent-new.jpg +3 -0
  4. utils.py +14 -3
.gitattributes CHANGED
@@ -44,3 +44,7 @@ static/images/txagent_train.jpg filter=lfs diff=lfs merge=lfs -text
44
  static/images/txagent.jpg filter=lfs diff=lfs merge=lfs -text
45
  anatomyofAgentResponse.jpg filter=lfs diff=lfs merge=lfs -text
46
  anatomyofAgentResponse.pptx filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
44
  static/images/txagent.jpg filter=lfs diff=lfs merge=lfs -text
45
  anatomyofAgentResponse.jpg filter=lfs diff=lfs merge=lfs -text
46
  anatomyofAgentResponse.pptx filter=lfs diff=lfs merge=lfs -text
47
+ static/images/txagent-new.jpg filter=lfs diff=lfs merge=lfs -text
48
+ *.jpg filter=lfs diff=lfs merge=lfs -text
49
+ *.png filter=lfs diff=lfs merge=lfs -text
50
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
The diff for this file is too large to render. See raw diff
 
static/images/txagent-new.jpg ADDED

Git LFS Details

  • SHA256: 29b2c43102bdb6a87d447b8a7cd7a244e7a9a3cbd5037becfe92091d68cf79d8
  • Pointer size: 131 Bytes
  • Size of remote file: 646 kB
utils.py CHANGED
@@ -247,8 +247,7 @@ def format_chat(response, tool_database_labels):
247
 
248
  # Clear after rendering
249
  last_tool_calls = []
250
- # Post-process: replace [FinalAnswer] with "\n***Answer:**\n" in the last message's content if present
251
- # Insert "**Rasoning:**\n" at the beginning of the first assistant message if [FinalAnswer] is in the last assistant message
252
  if chat_history:
253
  last_msg = chat_history[-1]
254
  if isinstance(last_msg.content, str) and "[FinalAnswer]" in last_msg.content:
@@ -261,4 +260,16 @@ def format_chat(response, tool_database_labels):
261
  last_msg = chat_history[-1]
262
  if isinstance(last_msg.content, str) and "[FinalAnswer]" in last_msg.content:
263
  last_msg.content = last_msg.content.replace("[FinalAnswer]", "\n**Answer:**\n")
264
- return chat_history
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  # Clear after rendering
249
  last_tool_calls = []
250
+
 
251
  if chat_history:
252
  last_msg = chat_history[-1]
253
  if isinstance(last_msg.content, str) and "[FinalAnswer]" in last_msg.content:
 
260
  last_msg = chat_history[-1]
261
  if isinstance(last_msg.content, str) and "[FinalAnswer]" in last_msg.content:
262
  last_msg.content = last_msg.content.replace("[FinalAnswer]", "\n**Answer:**\n")
263
+
264
+
265
+ final_answer_messages = [gr.ChatMessage(role="assistant", content=chat_history[-1].content.split("\n**Answer:**\n")[-1].strip())]
266
+ assistant_count = sum(1 for msg in chat_history if msg.role == "assistant")
267
+ if assistant_count == 1:
268
+ # If only one assistant message, show "No reasoning conducted."
269
+ reasoning_messages = [gr.ChatMessage(role="assistant", content="No reasoning was conducted.")]
270
+ else:
271
+ # Include ALL messages in reasoning_messages, including the last one
272
+ reasoning_messages = chat_history.copy()
273
+
274
+
275
+ return final_answer_messages, reasoning_messages, chat_history