Chandima Prabhath commited on
Commit
f8e6b2e
·
1 Parent(s): 3ad83d3

Enhance voice reply processing to include a friendly tone in prompts; fix minor logging issue in worker function.

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -131,7 +131,7 @@ def worker():
131
  elif task["type"] == "audio":
132
  _fn_voice_reply(task["message_id"],
133
  task["chat_id"],
134
- task["prompt"])
135
  except Exception as e:
136
  logging.error(f"Worker error {task}: {e}")
137
  finally:
@@ -273,7 +273,8 @@ def _fn_generate_images(message_id, chat_id, prompt, count=1):
273
  f"😢 Failed to generate image {i}/{count}.")
274
 
275
  def _fn_voice_reply(message_id, chat_id, prompt):
276
- result = generate_voice_reply(prompt,
 
277
  model="openai-audio",
278
  voice="coral",
279
  audio_dir=BotConfig.AUDIO_DIR)
 
131
  elif task["type"] == "audio":
132
  _fn_voice_reply(task["message_id"],
133
  task["chat_id"],
134
+ task['prompt'])
135
  except Exception as e:
136
  logging.error(f"Worker error {task}: {e}")
137
  finally:
 
273
  f"😢 Failed to generate image {i}/{count}.")
274
 
275
  def _fn_voice_reply(message_id, chat_id, prompt):
276
+ processed_prompt = f"Say this dialog in a friendly tone:\n\n{prompt}"
277
+ result = generate_voice_reply(processed_prompt,
278
  model="openai-audio",
279
  voice="coral",
280
  audio_dir=BotConfig.AUDIO_DIR)