Skip to content

Commit

Permalink
Add handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed May 1, 2024
1 parent d5c860a commit 203a776
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions agixt/Interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,15 @@ async def run(
image_generation_prompt = image_generation_prompt.split(
"```"
)[0]
generated_image = await self.agent.generate_image(
prompt=image_generation_prompt
)
self.response = f"{self.response}\n\n![Image generated by {self.agent_name}]({generated_image})"
try:
generated_image = await self.agent.generate_image(
prompt=image_generation_prompt
)
self.response = f"{self.response}\n\n![Image generated by {self.agent_name}]({generated_image})"
except:
logging.warning(
f"[IMG] Failed to generate image for prompt: {image_generation_prompt}"
)
log_interaction(
agent_name=self.agent_name,
conversation_name=conversation_name,
Expand Down
2 changes: 1 addition & 1 deletion agixt/providers/ezlocalai.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ async def text_to_speech(self, text: str):
async def generate_image(self, prompt: str) -> str:
filename = f"{uuid.uuid4()}.png"
image_path = f"./WORKSPACE/{filename}"
openai.base_url = self.API_URI if self.API_URI else "https://api.openai.com/v1/"
openai.base_url = self.API_URI
openai.api_key = self.EZLOCALAI_API_KEY
response = openai.images.generate(
prompt=prompt,
Expand Down

0 comments on commit 203a776

Please sign in to comment.