KaiChen1998 commited on
Commit
4c922d8
·
1 Parent(s): 4c8802b
Files changed (1) hide show
  1. conversation_public.py +4 -2
conversation_public.py CHANGED
@@ -196,7 +196,7 @@ class Conversation:
196
  def to_gradio_chatbot_public(self):
197
  ret = []
198
  for i, (role, msg) in enumerate(self.messages[self.offset:]):
199
- if i % 2 == 0:
200
  if type(msg) is tuple:
201
  msg, image, image_process_mode, audio_input = msg
202
  ret_msg = ""
@@ -219,7 +219,9 @@ class Conversation:
219
  if type(msg) is tuple:
220
  audio_b64_str = base64.b64encode(open(msg[1], "rb").read()).decode("utf-8")
221
  msg = f'<audio src="data:audio/wav;base64,{audio_b64_str}" controls autoplay></audio>'
222
- ret[-1][-1] = msg
 
 
223
  return ret
224
 
225
  def copy(self):
 
196
  def to_gradio_chatbot_public(self):
197
  ret = []
198
  for i, (role, msg) in enumerate(self.messages[self.offset:]):
199
+ if i == 0:
200
  if type(msg) is tuple:
201
  msg, image, image_process_mode, audio_input = msg
202
  ret_msg = ""
 
219
  if type(msg) is tuple:
220
  audio_b64_str = base64.b64encode(open(msg[1], "rb").read()).decode("utf-8")
221
  msg = f'<audio src="data:audio/wav;base64,{audio_b64_str}" controls autoplay></audio>'
222
+ if ret[-1][-1] is None:
223
+ ret[-1][-1] = ()
224
+ ret[-1][-1] += (msg, )
225
  return ret
226
 
227
  def copy(self):