返回提交历史
Modified
g4f/Provider/PollinationsAI.py
+1
-1
Modified
g4f/gui/server/backend_api.py
+5
-1
XFEstudio/gpt4free
Add support image links in UI
28810e47
代码差异
2 个文件
+6
-2
@@ -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":
@@ -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"):