Skip to content

Commit

Permalink
feat: bypass g4f's version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Oct 26, 2023
1 parent 946be66 commit f1356ba
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion free_one_api/impls/adapter/gpt4free.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,30 @@
import logging
import random

import pkg_resources

using_g4f_version = pkg_resources.get_distribution("g4f").version

class FakeResponse:

def json(self):
return {
"info": {
"version": using_g4f_version
}
}

def repl(*args, **kwargs):
return FakeResponse()

import requests

old_get = requests.get
requests.get = repl

import g4f

g4f.version_check = False
requests.get = old_get

from free_one_api.entities import request, response

Expand Down

0 comments on commit f1356ba

Please sign in to comment.