mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
Image: Add a revised_prompt field to API results for OpenAI compatibility
This commit is contained in:
parent
56f2a9512f
commit
15c6e43597
|
|
@ -47,10 +47,15 @@ def generations(request):
|
|||
resp = {'created': int(time.time()), 'data': []}
|
||||
for img in images:
|
||||
b64 = _image_to_base64(img)
|
||||
|
||||
image_obj = {'revised_prompt': request.prompt}
|
||||
|
||||
if request.response_format == 'b64_json':
|
||||
resp['data'].append({'b64_json': b64})
|
||||
image_obj['b64_json'] = b64
|
||||
else:
|
||||
resp['data'].append({'url': f'data:image/png;base64,{b64}'})
|
||||
image_obj['url'] = f'data:image/png;base64,{b64}'
|
||||
|
||||
resp['data'].append(image_obj)
|
||||
|
||||
return resp
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue