返回提交历史
Modified
CONTRIBUTING.md
+1
-1
Modified
README.md
+89
-11
Modified
docker/Dockerfile-slim
+1
-4
Modified
docs/client.md
+5
-2
Modified
docs/legacy.md
+1
-1
Modified
etc/tool/contributers.py
+1
-1
Modified
etc/tool/copilot.py
+1
-1
Deleted
etc/tool/provider_init.py
+0
-33
Modified
g4f/Provider/You.py
+2
-2
Modified
g4f/Provider/needs_auth/OpenaiChat.py
+9
-5
Modified
g4f/cookies.py
+2
-18
Modified
g4f/gui/client/static/css/style.css
+41
-0
Modified
g4f/gui/client/static/img/site.webmanifest
+2
-2
Modified
g4f/gui/client/static/js/chat.v1.js
+60
-13
Modified
g4f/providers/retry_provider.py
+1
-0
Deleted
g4f/stubs.py
+0
-107
XFEstudio/gpt4free
Add more contributers, add link to Swagger UI (#2443)
* Add more contributers, add link to Swagger UI * Update Dockerfile-slim * Update retry_provider.py * Add html preview to gui, fix urls in website manifest * Missing chunks in OpenaiChat
3f93d34c
代码差异
16 个文件
+216
-201
@@ -2,7 +2,7 @@
2
2
3
3
### Please, follow these steps to contribute:
4
4
1. Reverse a website from this list: [sites-to-reverse](https://github.com/xtekky/gpt4free/issues/40)
5
2. Add it to [./testing](https://github.com/xtekky/gpt4free/tree/main/testing)
5
2. Add it to [./etc/unittest/](https://github.com/xtekky/gpt4free/tree/main/etc/unittest/)
6
6
3. Refactor it and add it to [./g4f](https://github.com/xtekky/gpt4free/tree/main/g4f)
7
7
8
8
### We will be grateful to see you as a contributor!
@@ -163,6 +163,7 @@ How do I load the project using git and installing the project requirements?
163
163
Read this tutorial and follow it step by step: [/docs/git](docs/git.md)
164
164
165
165
##### Install using Docker:
166
166
167
How do I build and run composer image from source?
167
168
Use docker-compose: [/docs/docker](docs/docker.md)
168
169
@@ -212,7 +213,9 @@ print(f"Generated image URL: {image_url}")
212
213
- **Legacy API with python modules:** [/docs/legacy](docs/legacy.md)
213
214
214
215
#### Web UI
216
215
217
**To start the web interface, type the following codes in python:**
218
216
219
```python
217
220
from g4f.gui import run_gui
218
221
@@ -223,10 +226,15 @@ or execute the following command:
223
226
python -m g4f.cli gui -port 8080 -debug
224
227
```
225
228
226
#### Interference API
227
You can use the Interference API to serve other OpenAI integrations with G4F.
228
**See docs:** [/docs/interference](docs/interference-api.md)
229
**Access with:** http://localhost:1337/v1
229
### Interference API
230
231
The **Interference API** enables seamless integration with OpenAI's services through G4F, allowing you to deploy efficient AI solutions.
232
233
- **Documentation**: [Interference API Docs](docs/interference-api.md)
234
- **Endpoint**: `http://localhost:1337/v1`
235
- **Swagger UI**: Explore the OpenAPI documentation via Swagger UI at `http://localhost:1337/docs`
236
237
This API is designed for straightforward implementation and enhanced compatibility with other OpenAI integrations.
230
238
231
239
### Configuration
232
240
@@ -252,7 +260,7 @@ set_cookies(".google.com", {
252
260
253
261
#### Using .har and Cookie Files
254
262
255
You can place `.har` and cookie files in the default `./har_and_cookies` directory. To export a cookie file, use the [EditThisCookie Extension](https://chromewebstore.google.com/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg) available on the Chrome Web Store.
263
You can place `.har` and cookie files `.json` in the default `./har_and_cookies` directory. To export a cookie file, use the [EditThisCookie Extension](https://chromewebstore.google.com/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg) available on the Chrome Web Store.
256
264
257
265
#### Creating .har Files to Capture Cookies
258
266
@@ -790,12 +798,14 @@ A list of all contributors is available [here](https://github.com/xtekky/gpt4fre
790
798
791
799
<a href="https://github.com/xtekky" target="_blank"><img src="https://avatars.githubusercontent.com/u/98614666?v=4&s=45" width="45" title="xtekky"></a>
792
800
<a href="https://github.com/hlohaus" target="_blank"><img src="https://avatars.githubusercontent.com/u/983577?v=4&s=45" width="45" title="hlohaus"></a>
801
<a href="https://github.com/kqlio67" target="_blank"><img src="https://avatars.githubusercontent.com/u/166700875?v=4&s=45" width="45" title="kqlio67"></a>
793
802
<a href="https://github.com/bagusindrayana" target="_blank"><img src="https://avatars.githubusercontent.com/u/36830534?v=4&s=45" width="45" title="bagusindrayana"></a>
794
803
<a href="https://github.com/sudouser777" target="_blank"><img src="https://avatars.githubusercontent.com/u/22415463?v=4&s=45" width="45" title="sudouser777"></a>
795
804
<a href="https://github.com/thatlukinhasguy1" target="_blank"><img src="https://avatars.githubusercontent.com/u/139662282?v=4&s=45" width="45" title="thatlukinhasguy1"></a>
796
805
<a href="https://github.com/Commenter123321" target="_blank"><img src="https://avatars.githubusercontent.com/u/36051603?v=4&s=45" width="45" title="Commenter123321"></a>
797
806
<a href="https://github.com/DanielShemesh" target="_blank"><img src="https://avatars.githubusercontent.com/u/20585236?v=4&s=45" width="45" title="DanielShemesh"></a>
798
807
<a href="https://github.com/Luneye" target="_blank"><img src="https://avatars.githubusercontent.com/u/73485421?v=4&s=45" width="45" title="Luneye"></a>
808
<a href="https://github.com/foxfire52" target="_blank"><img src="https://avatars.githubusercontent.com/u/185073927?v=4&s=45" width="45" title="foxfire52"></a>
799
809
<a href="https://github.com/ezerinz" target="_blank"><img src="https://avatars.githubusercontent.com/u/100193740?v=4&s=45" width="45" title="ezerinz"></a>
800
810
<a href="https://github.com/enganese" target="_blank"><img src="https://avatars.githubusercontent.com/u/69082498?v=4&s=45" width="45" title="enganese"></a>
801
811
<a href="https://github.com/Lin-jun-xiang" target="_blank"><img src="https://avatars.githubusercontent.com/u/63782903?v=4&s=45" width="45" title="Lin-jun-xiang"></a>
@@ -805,19 +815,87 @@ A list of all contributors is available [here](https://github.com/xtekky/gpt4fre
805
815
<a href="https://github.com/repollo" target="_blank"><img src="https://avatars.githubusercontent.com/u/2671466?v=4&s=45" width="45" title="repollo"></a>
806
816
<a href="https://github.com/hpsj" target="_blank"><img src="https://avatars.githubusercontent.com/u/54535414?v=4&s=45" width="45" title="hpsj"></a>
807
817
<a href="https://github.com/taiyi747" target="_blank"><img src="https://avatars.githubusercontent.com/u/63543716?v=4&s=45" width="45" title="taiyi747"></a>
808
<a href="https://github.com/9fo" target="_blank"><img src="https://avatars.githubusercontent.com/u/71867245?v=4&s=45" width="45" title="9fo"></a>
809
<a href="https://github.com/HexyeDEV" target="_blank"><img src="https://avatars.githubusercontent.com/u/65314629?v=4&s=45" width="45" title="HexyeDEV"></a>
810
<a href="https://github.com/WdR-Tech" target="_blank"><img src="https://avatars.githubusercontent.com/u/143020293?v=4&s=45" width="45" title="WdR-Tech"></a>
818
<a href="https://github.com/zukixa" target="_blank"><img src="https://avatars.githubusercontent.com/u/56563509?v=4&s=45" width="45" title="zukixa"></a>
811
819
<a href="https://github.com/ostix360" target="_blank"><img src="https://avatars.githubusercontent.com/u/55257054?v=4&s=45" width="45" title="ostix360"></a>
820
<a href="https://github.com/WdR-Tech" target="_blank"><img src="https://avatars.githubusercontent.com/u/143020293?v=4&s=45" width="45" title="WdR-Tech"></a>
821
<a href="https://github.com/HexyeDEV" target="_blank"><img src="https://avatars.githubusercontent.com/u/65314629?v=4&s=45" width="45" title="HexyeDEV"></a>
822
<a href="https://github.com/9fo" target="_blank"><img src="https://avatars.githubusercontent.com/u/71867245?v=4&s=45" width="45" title="9fo"></a>
812
823
<a href="https://github.com/devAdityaa" target="_blank"><img src="https://avatars.githubusercontent.com/u/77636021?v=4&s=45" width="45" title="devAdityaa"></a>
813
<a href="https://github.com/editor-syntax" target="_blank"><img src="https://avatars.githubusercontent.com/u/109844019?v=4&s=45" width="45" title="editor-syntax"></a>
824
<a href="https://github.com/24rr" target="_blank"><img src="https://avatars.githubusercontent.com/u/109844019?v=4&s=45" width="45" title="24rr"></a>
814
825
<a href="https://github.com/zeng-rr" target="_blank"><img src="https://avatars.githubusercontent.com/u/47846202?v=4&s=45" width="45" title="zeng-rr"></a>
826
<a href="https://github.com/rkihacker" target="_blank"><img src="https://avatars.githubusercontent.com/u/182319878?v=4&s=45" width="45" title="rkihacker"></a>
815
827
<a href="https://github.com/naa7" target="_blank"><img src="https://avatars.githubusercontent.com/u/44613678?v=4&s=45" width="45" title="naa7"></a>
816
<a href="https://github.com/ramonvc" target="_blank"><img src="https://avatars.githubusercontent.com/u/13617054?v=4&s=45" width="45" title="ramonvc"></a>
828
<a href="https://github.com/ramon-victor" target="_blank"><img src="https://avatars.githubusercontent.com/u/13617054?v=4&s=45" width="45" title="ramon-victor"></a>
817
829
<a href="https://github.com/eltociear" target="_blank"><img src="https://avatars.githubusercontent.com/u/22633385?v=4&s=45" width="45" title="eltociear"></a>
818
830
<a href="https://github.com/kggn" target="_blank"><img src="https://avatars.githubusercontent.com/u/95663228?v=4&s=45" width="45" title="kggn"></a>
819
831
<a href="https://github.com/xiangsx" target="_blank"><img src="https://avatars.githubusercontent.com/u/29322721?v=4&s=45" width="45" title="xiangsx"></a>
820
832
<a href="https://github.com/ggindinson" target="_blank"><img src="https://avatars.githubusercontent.com/u/97807772?v=4&s=45" width="45" title="ggindinson"></a>
833
<a href="https://github.com/ahobsonsayers" target="_blank"><img src="https://avatars.githubusercontent.com/u/32173585?v=4&s=45" width="45" title="ahobsonsayers"></a>
834
<a href="https://github.com/mache102" target="_blank"><img src="https://avatars.githubusercontent.com/u/91365155?v=4&s=45" width="45" title="mache102"></a>
835
<a href="https://github.com/kogakisaki" target="_blank"><img src="https://avatars.githubusercontent.com/u/95165750?v=4&s=45" width="45" title="kogakisaki"></a>
836
<a href="https://github.com/Andrew-Tsegaye" target="_blank"><img src="https://avatars.githubusercontent.com/u/91322467?v=4&s=45" width="45" title="Andrew-Tsegaye"></a>
837
<a href="https://github.com/omidima" target="_blank"><img src="https://avatars.githubusercontent.com/u/47784584?v=4&s=45" width="45" title="omidima"></a>
838
<a href="https://github.com/nonk123" target="_blank"><img src="https://avatars.githubusercontent.com/u/43842467?v=4&s=45" width="45" title="nonk123"></a>
839
<a href="https://github.com/MaxKUlish1" target="_blank"><img src="https://avatars.githubusercontent.com/u/93388714?v=4&s=45" width="45" title="MaxKUlish1"></a>
840
<a href="https://github.com/AymaneHrouch" target="_blank"><img src="https://avatars.githubusercontent.com/u/36491424?v=4&s=45" width="45" title="AymaneHrouch"></a>
841
<a href="https://github.com/Eikosa" target="_blank"><img src="https://avatars.githubusercontent.com/u/20538090?v=4&s=45" width="45" title="Eikosa"></a>
842
<a href="https://github.com/localagi" target="_blank"><img src="https://avatars.githubusercontent.com/u/132956819?v=4&s=45" width="45" title="localagi"></a>
843
<a href="https://github.com/thebigbone" target="_blank"><img src="https://avatars.githubusercontent.com/u/95130644?v=4&s=45" width="45" title="thebigbone"></a>
844
<a href="https://github.com/kailust" target="_blank"><img src="https://avatars.githubusercontent.com/u/82623773?v=4&s=45" width="45" title="kailust"></a>
845
<a href="https://github.com/ading2210" target="_blank"><img src="https://avatars.githubusercontent.com/u/71154407?v=4&s=45" width="45" title="ading2210"></a>
846
<a href="https://github.com/Zero6992" target="_blank"><img src="https://avatars.githubusercontent.com/u/89479282?v=4&s=45" width="45" title="Zero6992"></a>
847
<a href="https://github.com/mishl-dev" target="_blank"><img src="https://avatars.githubusercontent.com/u/91066601?v=4&s=45" width="45" title="mishl-dev"></a>
848
<a href="https://github.com/ElonGaties" target="_blank"><img src="https://avatars.githubusercontent.com/u/59313695?v=4&s=45" width="45" title="ElonGaties"></a>
849
<a href="https://github.com/TotoB12" target="_blank"><img src="https://avatars.githubusercontent.com/u/91705868?v=4&s=45" width="45" title="TotoB12"></a>
850
<a href="https://github.com/malivinayak" target="_blank"><img src="https://avatars.githubusercontent.com/u/66154908?v=4&s=45" width="45" title="malivinayak"></a>
851
<a href="https://github.com/Zedai00" target="_blank"><img src="https://avatars.githubusercontent.com/u/33319711?v=4&s=45" width="45" title="Zedai00"></a>
852
<a href="https://github.com/catmeowjiao" target="_blank"><img src="https://avatars.githubusercontent.com/u/138079152?v=4&s=45" width="45" title="catmeowjiao"></a>
853
<a href="https://github.com/cifer-sudo" target="_blank"><img src="https://avatars.githubusercontent.com/u/60644739?v=4&s=45" width="45" title="cifer-sudo"></a>
854
<a href="https://github.com/eminemkun" target="_blank"><img src="https://avatars.githubusercontent.com/u/49590289?v=4&s=45" width="45" title="eminemkun"></a>
855
<a href="https://github.com/kafmws" target="_blank"><img src="https://avatars.githubusercontent.com/u/33590879?v=4&s=45" width="45" title="kafmws"></a>
856
<a href="https://github.com/najam-tariq" target="_blank"><img src="https://avatars.githubusercontent.com/u/103676132?v=4&s=45" width="45" title="najam-tariq"></a>
857
<a href="https://github.com/ochen1" target="_blank"><img src="https://avatars.githubusercontent.com/u/59662605?v=4&s=45" width="45" title="ochen1"></a>
858
<a href="https://github.com/r1di" target="_blank"><img src="https://avatars.githubusercontent.com/u/33724815?v=4&s=45" width="45" title="r1di"></a>
859
<a href="https://github.com/sagadav" target="_blank"><img src="https://avatars.githubusercontent.com/u/42406802?v=4&s=45" width="45" title="sagadav"></a>
860
<a href="https://github.com/snyk-bot" target="_blank"><img src="https://avatars.githubusercontent.com/u/19733683?v=4&s=45" width="45" title="snyk-bot"></a>
861
<a href="https://github.com/vatva691" target="_blank"><img src="https://avatars.githubusercontent.com/u/30290559?v=4&s=45" width="45" title="vatva691"></a>
862
<a href="https://github.com/Qustelm" target="_blank"><img src="https://avatars.githubusercontent.com/u/83110161?v=4&s=45" width="45" title="Qustelm"></a>
863
<a href="https://github.com/HyiKi" target="_blank"><img src="https://avatars.githubusercontent.com/u/55942998?v=4&s=45" width="45" title="HyiKi"></a>
864
<a href="https://github.com/0dminnimda" target="_blank"><img src="https://avatars.githubusercontent.com/u/52697657?v=4&s=45" width="45" title="0dminnimda"></a>
865
<a href="https://github.com/Akash98Sky" target="_blank"><img src="https://avatars.githubusercontent.com/u/37451227?v=4&s=45" width="45" title="Akash98Sky"></a>
866
<a href="https://github.com/adeyinkaezra123" target="_blank"><img src="https://avatars.githubusercontent.com/u/65364356?v=4&s=45" width="45" title="adeyinkaezra123"></a>
867
<a href="https://github.com/Giancarlo-Ma" target="_blank"><img src="https://avatars.githubusercontent.com/u/65126107?v=4&s=45" width="45" title="Giancarlo-Ma"></a>
868
<a href="https://github.com/gran4" target="_blank"><img src="https://avatars.githubusercontent.com/u/80655391?v=4&s=45" width="45" title="gran4"></a>
869
<a href="https://github.com/guspan-tanadi" target="_blank"><img src="https://avatars.githubusercontent.com/u/36249910?v=4&s=45" width="45" title="guspan-tanadi"></a>
870
<a href="https://github.com/oubrax" target="_blank"><img src="https://avatars.githubusercontent.com/u/72103863?v=4&s=45" width="45" title="oubrax"></a>
871
<a href="https://github.com/hansipie" target="_blank"><img src="https://avatars.githubusercontent.com/u/5460714?v=4&s=45" width="45" title="hansipie"></a>
872
<a href="https://github.com/GetTuh" target="_blank"><img src="https://avatars.githubusercontent.com/u/27581581?v=4&s=45" width="45" title="GetTuh"></a>
873
<a href="https://github.com/kushal34712" target="_blank"><img src="https://avatars.githubusercontent.com/u/98145879?v=4&s=45" width="45" title="kushal34712"></a>
874
<a href="https://github.com/Fubge" target="_blank"><img src="https://avatars.githubusercontent.com/u/115476150?v=4&s=45" width="45" title="Fubge"></a>
875
<a href="https://github.com/Niapoll" target="_blank"><img src="https://avatars.githubusercontent.com/u/64135936?v=4&s=45" width="45" title="Niapoll"></a>
876
<a href="https://github.com/OmiiiDev" target="_blank"><img src="https://avatars.githubusercontent.com/u/103533638?v=4&s=45" width="45" title="OmiiiDev"></a>
877
<a href="https://github.com/RasyiidWho" target="_blank"><img src="https://avatars.githubusercontent.com/u/19422415?v=4&s=45" width="45" title="RasyiidWho"></a>
878
<a href="https://github.com/RavenOwO" target="_blank"><img src="https://avatars.githubusercontent.com/u/118295106?v=4&s=45" width="45" title="RavenOwO"></a>
879
<a href="https://github.com/anonymousx97" target="_blank"><img src="https://avatars.githubusercontent.com/u/88324835?v=4&s=45" width="45" title="anonymousx97"></a>
880
<a href="https://github.com/krjordan" target="_blank"><img src="https://avatars.githubusercontent.com/u/10234150?v=4&s=45" width="45" title="krjordan"></a>
881
<a href="https://github.com/SilverMarcs" target="_blank"><img src="https://avatars.githubusercontent.com/u/77480421?v=4&s=45" width="45" title="SilverMarcs"></a>
882
<a href="https://github.com/Yusufibin" target="_blank"><img src="https://avatars.githubusercontent.com/u/71589435?v=4&s=45" width="45" title="Yusufibin"></a>
883
<a href="https://github.com/yuri-val" target="_blank"><img src="https://avatars.githubusercontent.com/u/15129796?v=4&s=45" width="45" title="yuri-val"></a>
884
<a href="https://github.com/yousefnegmeldin" target="_blank"><img src="https://avatars.githubusercontent.com/u/96620955?v=4&s=45" width="45" title="yousefnegmeldin"></a>
885
<a href="https://github.com/perklet" target="_blank"><img src="https://avatars.githubusercontent.com/u/1035487?v=4&s=45" width="45" title="perklet"></a>
886
<a href="https://github.com/varshney-yash" target="_blank"><img src="https://avatars.githubusercontent.com/u/107148830?v=4&s=45" width="45" title="varshney-yash"></a>
887
<a href="https://github.com/Yoxmo" target="_blank"><img src="https://avatars.githubusercontent.com/u/94254616?v=4&s=45" width="45" title="Yoxmo"></a>
888
<a href="https://github.com/yjg30737" target="_blank"><img src="https://avatars.githubusercontent.com/u/55078043?v=4&s=45" width="45" title="yjg30737"></a>
889
<a href="https://github.com/williamstein" target="_blank"><img src="https://avatars.githubusercontent.com/u/1276278?v=4&s=45" width="45" title="williamstein"></a>
890
<a href="https://github.com/ZachKLYeh" target="_blank"><img src="https://avatars.githubusercontent.com/u/105150034?v=4&s=45" width="45" title="ZachKLYeh"></a>
891
<a href="https://github.com/alvarosoaress" target="_blank"><img src="https://avatars.githubusercontent.com/u/13721147?v=4&s=45" width="45" title="alvarosoaress"></a>
892
<a href="https://github.com/bruvv" target="_blank"><img src="https://avatars.githubusercontent.com/u/3063928?v=4&s=45" width="45" title="bruvv"></a>
893
<a href="https://github.com/carlinhoshk" target="_blank"><img src="https://avatars.githubusercontent.com/u/40872405?v=4&s=45" width="45" title="carlinhoshk"></a>
894
<a href="https://github.com/cckuailong" target="_blank"><img src="https://avatars.githubusercontent.com/u/10824150?v=4&s=45" width="45" title="cckuailong"></a>
895
<a href="https://github.com/chinmay7016" target="_blank"><img src="https://avatars.githubusercontent.com/u/75988613?v=4&s=45" width="45" title="chinmay7016"></a>
896
<a href="https://github.com/diaodeng" target="_blank"><img src="https://avatars.githubusercontent.com/u/108243171?v=4&s=45" width="45" title="diaodeng"></a>
897
<a href="https://github.com/monosans" target="_blank"><img src="https://avatars.githubusercontent.com/u/76561516?v=4&s=45" width="45" title="monosans"></a>
898
<a href="https://github.com/Ayushpanditmoto" target="_blank"><img src="https://avatars.githubusercontent.com/u/31253617?v=4&s=45" width="45" title="Ayushpanditmoto"></a>
821
899
<span></span>
822
900
<img src="https://avatars.githubusercontent.com/u/71154407?s=45&v=4" width="45" title="ading2210">
823
901
<img src="https://avatars.githubusercontent.com/u/12299238?s=45&v=4" width="45" title="xqdoo00o">
@@ -827,7 +905,7 @@ A list of all contributors is available [here](https://github.com/xtekky/gpt4fre
827
905
828
906
- The [`Vercel.py`](https://github.com/xtekky/gpt4free/blob/main/g4f/Provider/Vercel.py) file contains code from [vercel-llm-api](https://github.com/ading2210/vercel-llm-api) by [@ading2210](https://github.com/ading2210)
829
907
- The [`har_file.py`](https://github.com/xtekky/gpt4free/blob/main/g4f/Provider/openai/har_file.py) has input from [xqdoo00o/ChatGPT-to-API](https://github.com/xqdoo00o/ChatGPT-to-API)
830
- The [`PerplexityLabs.py`](https://github.com/xtekky/gpt4free/blob/main/g4f/Provider/openai/har_file.py) has input from [nathanrchn/perplexityai](https://github.com/nathanrchn/perplexityai)
908
- The [`PerplexityLabs.py`](https://github.com/xtekky/gpt4free/blob/main/g4f/Provider/PerplexityLabs.py) has input from [nathanrchn/perplexityai](https://github.com/nathanrchn/perplexityai)
831
909
- The [`Gemini.py`](https://github.com/xtekky/gpt4free/blob/main/g4f/Provider/needs_auth/Gemini.py) has input from [dsdanielpark/Gemini-API](https://github.com/dsdanielpark/Gemini-API)
832
910
- The [`MetaAI.py`](https://github.com/xtekky/gpt4free/blob/main/g4f/Provider/MetaAI.py) file contains code from [meta-ai-api](https://github.com/Strvm/meta-ai-api) by [@Strvm](https://github.com/Strvm)
833
911
- The [`proofofwork.py`](https://github.com/xtekky/gpt4free/blob/main/g4f/Provider/openai/proofofwork.py) has input from [missuo/FreeGPT35](https://github.com/missuo/FreeGPT35)
@@ -14,8 +14,6 @@ RUN apt-get update && apt-get upgrade -y \
14
14
# Add user and user group
15
15
&& groupadd -g $G4F_USER_ID $G4F_USER \
16
16
&& useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
17
&& mkdir -p /var/log/supervisor \
18
&& chown "${G4F_USER_ID}:${G4F_USER_ID}" /var/log/supervisor \
19
17
&& echo "${G4F_USER}:${G4F_USER}" | chpasswd \
20
18
&& python -m pip install --upgrade pip \
21
19
&& apt-get clean \
@@ -32,8 +30,7 @@ RUN mkdir -p $G4F_DIR
32
30
COPY requirements-slim.txt $G4F_DIR
33
31
34
32
# Upgrade pip for the latest features and install the project's Python dependencies.
35
RUN pip install --no-cache-dir -r requirements-slim.txt \
36
&& pip install --no-cache-dir duckduckgo-search>=5.0
33
RUN pip install --no-cache-dir -r requirements-slim.txt
37
34
38
35
# Copy the entire package into the container.
39
36
ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
@@ -185,12 +185,15 @@ print(base64_text)
185
185
**Create variations of an existing image:**
186
186
```python
187
187
from g4f.client import Client
188
from g4f.Provider import OpenaiChat
188
189
189
client = Client()
190
client = Client(
191
image_provider=OpenaiChat
192
)
190
193
191
194
response = client.images.create_variation(
192
195
image=open("cat.jpg", "rb"),
193
model="bing"
196
model="dall-e-3",
194
197
# Add any other necessary parameters
195
198
)
196
199
@@ -7,7 +7,7 @@ import g4f
7
7
8
8
g4f.debug.logging = True # Enable debug logging
9
9
g4f.debug.version_check = False # Disable automatic version checking
10
print(g4f.Provider.Gemini.params) # Print supported args for Bing
10
print(g4f.Provider.Gemini.params) # Print supported args for Gemini
11
11
12
12
# Using automatic a provider for the given model
13
13
## Streamed completion
@@ -1,6 +1,6 @@
1
1
import requests
2
2
3
url = "https://api.github.com/repos/xtekky/gpt4free/contributors"
3
url = "https://api.github.com/repos/xtekky/gpt4free/contributors?per_page=100"
4
4
5
5
for user in requests.get(url).json():
6
6
print(f'<a href="https://github.com/{user["login"]}" target="_blank"><img src="{user["avatar_url"]}&s=45" width="45" title="{user["login"]}"></a>')
@@ -144,7 +144,7 @@ def analyze_code(pull: PullRequest, diff: str)-> list[dict]:
144
144
else:
145
145
changed_lines.append(f"{offset_line}:{line}")
146
146
offset_line += 1
147
147
148
148
return comments
149
149
150
150
def create_analyze_prompt(changed_lines: list[str], pull: PullRequest, file_path: str):
@@ -1,33 +0,0 @@
1
from pathlib import Path
2
3
4
def main():
5
content = create_content()
6
with open("g4f/provider/__init__.py", "w", encoding="utf-8") as f:
7
f.write(content)
8
9
10
def create_content():
11
path = Path()
12
paths = path.glob("g4f/provider/*.py")
13
paths = [p for p in paths if p.name not in ["__init__.py", "base_provider.py"]]
14
classnames = [p.stem for p in paths]
15
16
import_lines = [f"from .{name} import {name}" for name in classnames]
17
import_content = "\n".join(import_lines)
18
19
classnames.insert(0, "BaseProvider")
20
all_content = [f' "{name}"' for name in classnames]
21
all_content = ",\n".join(all_content)
22
all_content = f"__all__ = [\n{all_content},\n]"
23
24
return f"""from .base_provider import BaseProvider
25
{import_content}
26
27
28
{all_content}
29
"""
30
31
32
if __name__ == "__main__":
33
main()
@@ -139,9 +139,9 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
139
139
else:
140
140
yield ImageResponse(match.group(2), match.group(1))
141
141
else:
142
yield data["t"]
142
yield data["t"]
143
143
else:
144
yield data["t"]
144
yield data["t"]
145
145
146
146
@classmethod
147
147
async def upload_file(cls, client: StreamSession, cookies: Cookies, file: bytes, filename: str = None) -> dict:
@@ -128,10 +128,13 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
128
128
data=data_bytes,
129
129
headers={
130
130
"Content-Type": image_data["mime_type"],
131
"x-ms-blob-type": "BlockBlob"
131
"x-ms-blob-type": "BlockBlob",
132
"x-ms-version": "2020-04-08",
133
"Origin": "https://chatgpt.com",
134
"Referer": "https://chatgpt.com/",
132
135
}
133
136
) as response:
134
await raise_for_status(response, "Send file failed")
137
await raise_for_status(response)
135
138
# Post the file ID to the service and get the download URL
136
139
async with session.post(
137
140
f"{cls.url}/backend-api/files/{image_data['file_id']}/uploaded",
@@ -162,7 +165,7 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
162
165
"id": str(uuid.uuid4()),
163
166
"create_time": int(time.time()),
164
167
"id": str(uuid.uuid4()),
165
"metadata": {"serialization_metadata": {"custom_symbol_offsets": []}, "system_hints": system_hints},
168
"metadata": {"serialization_metadata": {"custom_symbol_offsets": []}, "system_hints": system_hints},
166
169
} for message in messages]
167
170
168
171
# Check if there is an image response
@@ -407,7 +410,8 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
407
410
if isinstance(line, dict) and "v" in line:
408
411
v = line.get("v")
409
412
if isinstance(v, str) and fields.is_recipient:
410
yield v
413
if "p" not in line or line.get("p") == "/message/content/parts/0":
414
yield v
411
415
elif isinstance(v, list) and fields.is_recipient:
412
416
for m in v:
413
417
if m.get("p") == "/message/content/parts/0":
@@ -420,7 +424,7 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
420
424
fields.conversation_id = v.get("conversation_id")
421
425
debug.log(f"OpenaiChat: New conversation: {fields.conversation_id}")
422
426
m = v.get("message", {})
423
fields.is_recipient = m.get("recipient") == "all"
427
fields.is_recipient = m.get("recipient", "all") == "all"
424
428
if fields.is_recipient:
425
429
c = m.get("content", {})
426
430
if c.get("content_type") == "multimodal_text":
@@ -101,7 +101,7 @@ def load_cookies_from_browsers(domain_name: str, raise_requirements_error: bool
101
101
raise MissingRequirementsError('Install "browser_cookie3" package')
102
102
return {}
103
103
cookies = {}
104
for cookie_fn in [_g4f, chrome, chromium, opera, opera_gx, brave, edge, vivaldi, firefox]:
104
for cookie_fn in browsers:
105
105
try:
106
106
cookie_jar = cookie_fn(domain_name=domain_name)
107
107
if len(cookie_jar) and debug.logging:
@@ -188,20 +188,4 @@ def read_cookie_files(dirPath: str = None):
188
188
for domain, new_values in new_cookies.items():
189
189
if debug.logging:
190
190
print(f"Cookies added: {len(new_values)} from {domain}")
191
CookiesConfig.cookies[domain] = new_values
192
193
def _g4f(domain_name: str) -> list:
194
"""
195
Load cookies from the 'g4f' browser (if exists).
196
197
Args:
198
domain_name (str): The domain for which to load cookies.
199
200
Returns:
201
list: List of cookies.
202
"""
203
if not has_platformdirs:
204
return []
205
user_data_dir = user_config_dir("g4f")
206
cookie_file = os.path.join(user_data_dir, "Default", "Cookies")
207
return [] if not os.path.exists(cookie_file) else chrome(cookie_file, domain_name)
191
CookiesConfig.cookies[domain] = new_values
@@ -1064,6 +1064,47 @@ a:-webkit-any-link {
1064
1064
width: 1px;
1065
1065
}
1066
1066
1067
.hljs-iframe-button, .hljs-iframe-close {
1068
position: absolute;
1069
bottom: 1rem;
1070
right: 1rem;
1071
padding: 7px;
1072
border-radius: .25rem;
1073
border: 1px solid #ffffff22;
1074
background-color: #2d2b57;
1075
color: #fff;
1076
cursor: pointer;
1077
width: 32px;
1078
height: 32px;
1079
}
1080
1081
.hljs-iframe-button:hover, .hljs-iframe-close:hover {
1082
border-color: #ffffff44;
1083
color: #ffffff77;
1084
}
1085
1086
.hljs-iframe-container {
1087
position: fixed;
1088
position: absolute;
1089
left: 0;
1090
width: 100%;
1091
height: 100%;
1092
z-index: 1000001;
1093
background-color: #fff;
1094
padding: 0;
1095
margin: 0;
1096
overflow: hidden;
1097
}
1098
1099
.hljs-iframe {
1100
width: 100%;
1101
height: 100%;
1102
padding: 0;
1103
margin: 0;
1104
border: none;
1105
overflow: auto;
1106
}
1107
1067
1108
.white {
1068
1109
--blur-bg: transparent;
1069
1110
--accent: #007bff;