Skip to content

Commit

Permalink
fix: Improve Discord image URL retrieval and handle message attachments
Browse files Browse the repository at this point in the history
fix: replace the base_url in webui
  • Loading branch information
Feiyuyu0503 committed Jul 13, 2024
1 parent 20b5fb4 commit 06ea8b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Bots/discordClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ async def on_message(self, message):
else:
raise Exception("No message content found")
else:
await asyncio.sleep(5)
msg = message.content
await asyncio.sleep(10)
msg = message.attachments[0].url if message.attachments else None
self.pending_responses[reply_to_msg_id] = (response_event, msg)
except Exception as e:
logger.error(f"Discord client handle response error: {e}")
Expand Down
2 changes: 1 addition & 1 deletion webui/gradio_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
current_task = None

async def get_image_url(text,api_key,request:gr.Request):
base_url = request.headers.get("host")
base_url = request.headers.get("host").replace("localhost", "127.0.0.1")
scheme = request.headers.get("x-forwarded-proto") or "http"
global current_task
# 向 FastAPI 后端发送 POST 请求,并获取图片 URL
Expand Down

0 comments on commit 06ea8b2

Please sign in to comment.