summaryrefslogtreecommitdiffstats
path: root/g4f/client/stubs.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-18 07:37:37 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-18 07:37:37 +0200
commitb1dafc0ef79bdd94f69c783877217d8a5524d460 (patch)
tree7851c85bafa452d0fa9cce74aa7b383aa704f101 /g4f/client/stubs.py
parentMerge pull request #1969 from hlohaus/leech (diff)
downloadgpt4free-b1dafc0ef79bdd94f69c783877217d8a5524d460.tar
gpt4free-b1dafc0ef79bdd94f69c783877217d8a5524d460.tar.gz
gpt4free-b1dafc0ef79bdd94f69c783877217d8a5524d460.tar.bz2
gpt4free-b1dafc0ef79bdd94f69c783877217d8a5524d460.tar.lz
gpt4free-b1dafc0ef79bdd94f69c783877217d8a5524d460.tar.xz
gpt4free-b1dafc0ef79bdd94f69c783877217d8a5524d460.tar.zst
gpt4free-b1dafc0ef79bdd94f69c783877217d8a5524d460.zip
Diffstat (limited to 'g4f/client/stubs.py')
-rw-r--r--g4f/client/stubs.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/g4f/client/stubs.py b/g4f/client/stubs.py
index ceb51b83..8cf2bcba 100644
--- a/g4f/client/stubs.py
+++ b/g4f/client/stubs.py
@@ -96,13 +96,24 @@ class ChatCompletionDeltaChoice(Model):
}
class Image(Model):
- url: str
+ def __init__(self, url: str = None, b64_json: str = None, revised_prompt: str = None) -> None:
+ if url is not None:
+ self.url = url
+ if b64_json is not None:
+ self.b64_json = b64_json
+ if revised_prompt is not None:
+ self.revised_prompt = revised_prompt
- def __init__(self, url: str) -> None:
- self.url = url
+ def to_json(self):
+ return self.__dict__
class ImagesResponse(Model):
- data: list[Image]
-
- def __init__(self, data: list) -> None:
+ def __init__(self, data: list[Image], created: int = 0) -> None:
self.data = data
+ self.created = created
+
+ def to_json(self):
+ return {
+ **self.__dict__,
+ "data": [image.to_json() for image in self.data]
+ } \ No newline at end of file