Chandima Prabhath commited on
Commit
3250556
·
1 Parent(s): c187bdf

Refactor generate_voice_reply to use the original prompt instead of appending system prompt for audio generation

Browse files
Files changed (2) hide show
  1. VoiceReply.py +3 -3
  2. app.py +1 -1
VoiceReply.py CHANGED
@@ -28,10 +28,10 @@ def generate_voice_reply(prompt, model="openai-audio", voice="coral", audio_dir=
28
  randomSeed = random.randint(0, 9999999)
29
  # Append system prompt to the user's prompt
30
  system_prompt = pre_process()
31
- full_prompt = f"{prompt}\n\n{system_prompt}"
32
- print(f"DEBUG: Full prompt: {full_prompt}")
33
 
34
- encoded_prompt = urllib.parse.quote(full_prompt)
35
  url = f"http://text.pollinations.ai/{encoded_prompt}?model={model}&voice={voice}&seed={randomSeed}"
36
  print(f"DEBUG: Fetching audio with URL: {url}")
37
 
 
28
  randomSeed = random.randint(0, 9999999)
29
  # Append system prompt to the user's prompt
30
  system_prompt = pre_process()
31
+ #full_prompt = f"{prompt}\n\n{system_prompt}"
32
+ #print(f"DEBUG: Full prompt: {full_prompt}")
33
 
34
+ encoded_prompt = urllib.parse.quote(prompt)
35
  url = f"http://text.pollinations.ai/{encoded_prompt}?model={model}&voice={voice}&seed={randomSeed}"
36
  print(f"DEBUG: Fetching audio with URL: {url}")
37
 
app.py CHANGED
@@ -194,7 +194,7 @@ def _fn_send_text(mid,cid,message):
194
  client.send_message(mid,cid,message)
195
 
196
  def _fn_voice_reply(mid,cid,prompt):
197
- proccessed_prompt = f"Just say this dialog eaxcatly as it is in a frinedly and helpful manner as a secretary: {prompt}"
198
  res = generate_voice_reply(proccessed_prompt,model="openai-audio",voice="coral",audio_dir=BotConfig.AUDIO_DIR)
199
  if res and res[0]:
200
  path,_ = res
 
194
  client.send_message(mid,cid,message)
195
 
196
  def _fn_voice_reply(mid,cid,prompt):
197
+ proccessed_prompt = f"Just say this dialog eaxcatly as it is in a frinedly, playful and helpful manner as a cute secretary: {prompt}"
198
  res = generate_voice_reply(proccessed_prompt,model="openai-audio",voice="coral",audio_dir=BotConfig.AUDIO_DIR)
199
  if res and res[0]:
200
  path,_ = res