mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-05-02 13:20:30 +00:00
fix: fix provider routing for podcasts and add a try block to catch podcast generation issues
This commit is contained in:
parent
0a5504744c
commit
61b3583a57
1 changed files with 25 additions and 19 deletions
|
|
@ -111,35 +111,41 @@ class PodcastConfig(ObjectModel):
|
|||
api_key_label = "GOOGLE_API_KEY"
|
||||
llm_model_name = self.transcript_model
|
||||
|
||||
if self.provider == "gemini":
|
||||
tts_model = "geminimulti"
|
||||
if self.provider == "google":
|
||||
tts_model = "gemini"
|
||||
elif self.provider == "openai":
|
||||
tts_model = "openai"
|
||||
elif self.provider == "anthropic":
|
||||
tts_model = "anthropic"
|
||||
elif self.provider == "vertexai":
|
||||
tts_model = "geminimulti"
|
||||
elif self.provider == "elevenlabs":
|
||||
tts_model = "elevenlabs"
|
||||
|
||||
logger.debug(
|
||||
logger.info(
|
||||
f"Generating episode {episode_name} with config {conversation_config} and using model {llm_model_name}, tts model {tts_model}"
|
||||
)
|
||||
|
||||
audio_file = generate_podcast(
|
||||
conversation_config=conversation_config,
|
||||
text=text,
|
||||
tts_model=tts_model,
|
||||
llm_model_name=llm_model_name,
|
||||
api_key_label=api_key_label,
|
||||
longform=longform,
|
||||
)
|
||||
episode = PodcastEpisode(
|
||||
name=episode_name,
|
||||
template=self.name,
|
||||
instructions=instructions,
|
||||
text=str(text),
|
||||
audio_file=audio_file,
|
||||
)
|
||||
episode.save()
|
||||
try:
|
||||
audio_file = generate_podcast(
|
||||
conversation_config=conversation_config,
|
||||
text=text,
|
||||
tts_model=tts_model,
|
||||
llm_model_name=llm_model_name,
|
||||
api_key_label=api_key_label,
|
||||
longform=longform,
|
||||
)
|
||||
episode = PodcastEpisode(
|
||||
name=episode_name,
|
||||
template=self.name,
|
||||
instructions=instructions,
|
||||
text=str(text),
|
||||
audio_file=audio_file,
|
||||
)
|
||||
episode.save()
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to generate episode {episode_name}: {e}")
|
||||
raise
|
||||
|
||||
@field_validator(
|
||||
"name", "podcast_name", "podcast_tagline", "output_language", "model"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue