littlebird13 commited on
Commit
2d29182
1 Parent(s): ead35e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -9,10 +9,11 @@ dashscope.api_key = YOUR_API_TOKEN
9
 
10
  def add_text(chatbot, task_history, input):
11
  """Add text to the chat history."""
12
- task_history.append({"role": "user", "content": [{"text": input.text}]})
13
  if len (input.files) > 0:
14
- for i in input.files:
15
- task_history.append({"role": "user", "content": [{"audio": i.path}]})
 
 
16
  chatbot.append([{
17
  "text": input.text,
18
  "files": input.files,
 
9
 
10
  def add_text(chatbot, task_history, input):
11
  """Add text to the chat history."""
 
12
  if len (input.files) > 0:
13
+ audio_content = [{"audio": i.path } for i in input.files]
14
+ task_history.append({"role": "user", "content": audio_content + [{"text": input.text}]})
15
+ else:
16
+ task_history.append({"role": "user", "content": [{"text": input.text}]})
17
  chatbot.append([{
18
  "text": input.text,
19
  "files": input.files,