diff options
Diffstat (limited to 'g4f/Provider/PollinationsAI.py')
-rw-r--r-- | g4f/Provider/PollinationsAI.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/g4f/Provider/PollinationsAI.py b/g4f/Provider/PollinationsAI.py index 57597bf1..a30f896d 100644 --- a/g4f/Provider/PollinationsAI.py +++ b/g4f/Provider/PollinationsAI.py @@ -3,7 +3,6 @@ from __future__ import annotations from urllib.parse import quote import random import requests -from sys import maxsize from aiohttp import ClientSession from ..typing import AsyncResult, Messages @@ -40,6 +39,7 @@ class PollinationsAI(OpenaiAPI): cls, model: str, messages: Messages, + prompt: str = None, api_base: str = "https://text.pollinations.ai/openai", api_key: str = None, proxy: str = None, @@ -49,9 +49,10 @@ class PollinationsAI(OpenaiAPI): if model: model = cls.get_model(model) if model in cls.image_models: - prompt = messages[-1]["content"] + if prompt is None: + prompt = messages[-1]["content"] if seed is None: - seed = random.randint(0, maxsize) + seed = random.randint(0, 100000) image = f"https://image.pollinations.ai/prompt/{quote(prompt)}?width=1024&height=1024&seed={int(seed)}&nofeed=true&nologo=true&model={quote(model)}" yield ImageResponse(image, prompt) return |