XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Add support image links in UI

28810e47
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +6 -2
Modified g4f/Provider/PollinationsAI.py +1 -1
@@ -389,7 +389,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
389 389 encoded_prompt = prompt
390 390 if model == "gptimage" and aspect_ratio is not None:
391 391 encoded_prompt = f"{encoded_prompt} aspect-ratio: {aspect_ratio}"
392 encoded_prompt = quote_plus(encoded_prompt)[:2048-len(cls.image_api_endpoint)-len(query)-8]
392 encoded_prompt = quote_plus(encoded_prompt)[:4096-len(cls.image_api_endpoint)-len(query)-8]
393 393 url = f"{cls.image_api_endpoint}prompt/{encoded_prompt}?{query}"
394 394 def get_url_with_seed(i: int, seed: Optional[int] = None):
395 395 if model == "gptimage":
Modified g4f/gui/server/backend_api.py +5 -1
@@ -107,13 +107,17 @@ class Backend_Api(Api):
107 107 else:
108 108 json_data = request.json
109 109 tempfiles = []
110 media = []
110 111 if "files" in request.files:
111 media = []
112 112 for file in request.files.getlist('files'):
113 113 if file.filename != '' and is_allowed_extension(file.filename):
114 114 newfile = get_tempfile(file)
115 115 tempfiles.append(newfile)
116 116 media.append((Path(newfile), file.filename))
117 if "media_url" in request.form:
118 for url in request.form.getlist("media_url"):
119 media.append((url, None))
120 if media:
117 121 json_data['media'] = media
118 122
119 123 if app.demo and not json_data.get("provider"):