mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Add CORS support to MCP server and tools; enhance image URL handling in tools
This commit is contained in:
parent
5d53e58d2c
commit
a492352901
4 changed files with 29 additions and 12 deletions
|
|
@ -356,11 +356,13 @@ class Backend_Api(Api):
|
|||
if response.startswith("/media/"):
|
||||
media_dir = get_media_dir()
|
||||
filename = os.path.basename(response.split("?")[0])
|
||||
try:
|
||||
return send_from_directory(os.path.abspath(media_dir), filename)
|
||||
finally:
|
||||
if not cache_id:
|
||||
if not cache_id:
|
||||
try:
|
||||
return send_from_directory(os.path.abspath(media_dir), filename)
|
||||
finally:
|
||||
os.remove(os.path.join(media_dir, filename))
|
||||
else:
|
||||
return redirect(response)
|
||||
elif response.startswith("https://") or response.startswith("http://"):
|
||||
return redirect(response)
|
||||
if do_filter:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue