Metal3d commited on
Commit
6beeab4
·
unverified ·
1 Parent(s): 547adee

Use status

Browse files

Gradio allow the change of status from pending to done. It's a bit more
clear for the user.

Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -96,6 +96,7 @@ def bot(history: list, max_num_tokens: int, final_num_tokens: int):
96
  content=str(""),
97
  metadata={
98
  "title": "Thinking",
 
99
  },
100
  )
101
  )
@@ -123,6 +124,7 @@ def bot(history: list, max_num_tokens: int, final_num_tokens: int):
123
  # rebuild the history with the new content
124
  history[-1].content += prepend.format(question=question)
125
  if ANSWER_MARKER in prepend:
 
126
  # stop thinking, this is the answer now (no metadata for intermediate steps)
127
  history.append(gr.ChatMessage(role="assistant", content=""))
128
  for token in streamer:
 
96
  content=str(""),
97
  metadata={
98
  "title": "Thinking",
99
+ "status": "pending",
100
  },
101
  )
102
  )
 
124
  # rebuild the history with the new content
125
  history[-1].content += prepend.format(question=question)
126
  if ANSWER_MARKER in prepend:
127
+ history[-1].metadata["status"] = "done"
128
  # stop thinking, this is the answer now (no metadata for intermediate steps)
129
  history.append(gr.ChatMessage(role="assistant", content=""))
130
  for token in streamer: