mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Add multiple images support (#2478)
* Add multiple images support * Add multiple images support in gui * Support multiple images in legacy client and in the api Fix some model names in provider model list * Fix unittests * Add vision and providers docs
This commit is contained in:
parent
bb9132bcb4
commit
335c971f6a
26 changed files with 1006 additions and 324 deletions
|
|
@ -10,7 +10,7 @@ import aiohttp
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from ..typing import AsyncResult, Messages, ImageType
|
||||
from ..typing import AsyncResult, Messages, ImagesType
|
||||
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
|
||||
from ..image import ImageResponse, to_data_uri
|
||||
from ..cookies import get_cookies_dir
|
||||
|
|
@ -197,8 +197,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
|
|||
prompt: str = None,
|
||||
proxy: str = None,
|
||||
web_search: bool = False,
|
||||
image: ImageType = None,
|
||||
image_name: str = None,
|
||||
images: ImagesType = None,
|
||||
top_p: float = 0.9,
|
||||
temperature: float = 0.5,
|
||||
max_tokens: int = 1024,
|
||||
|
|
@ -212,13 +211,14 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
|
|||
|
||||
messages = [{"id": message_id, "content": formatted_message, "role": "user"}]
|
||||
|
||||
if image is not None:
|
||||
if images is not None:
|
||||
messages[-1]['data'] = {
|
||||
"imagesData": [
|
||||
{
|
||||
"filePath": f"MultipleFiles/{image_name}",
|
||||
"contents": to_data_uri(image)
|
||||
}
|
||||
for image, image_name in images
|
||||
],
|
||||
"fileText": "",
|
||||
"title": ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue