diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2023-08-25 18:22:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 18:22:38 +0200 |
commit | b2baf46e3cb2ad27d666217bb14c54d89fbb8c66 (patch) | |
tree | 60052aad3746053eb4aec5b7e44d75404f4d11fe /tool/readme_table.py | |
parent | ~ | Merge pull request #841 (diff) | |
parent | Merge branch 'main' into up (diff) | |
download | gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.gz gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.bz2 gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.lz gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.xz gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.zst gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.zip |
Diffstat (limited to 'tool/readme_table.py')
-rw-r--r-- | tool/readme_table.py | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/tool/readme_table.py b/tool/readme_table.py index 10735ba0..b578b9ca 100644 --- a/tool/readme_table.py +++ b/tool/readme_table.py @@ -7,7 +7,7 @@ sys.path.append(str(Path(__file__).parent.parent)) from g4f import models, Provider from g4f.Provider.base_provider import BaseProvider - +from testing.test_providers import test def main(): print_providers() @@ -21,25 +21,30 @@ def print_providers(): "| ------ | ------- | ------- | ----- | --------- | ------ | ---- |", ] providers = get_providers() - for _provider in providers: - netloc = urlparse(_provider.url).netloc - website = f"[{netloc}]({_provider.url})" - - provider_name = f"g4f.provider.{_provider.__name__}" - - has_gpt_35 = "✔️" if _provider.supports_gpt_35_turbo else "❌" - has_gpt_4 = "✔️" if _provider.supports_gpt_4 else "❌" - stream = "✔️" if _provider.supports_stream else "❌" - status = ( - "![Active](https://img.shields.io/badge/Active-brightgreen)" - if _provider.working - else "![Inactive](https://img.shields.io/badge/Inactive-red)" - ) - auth = "✔️" if _provider.needs_auth else "❌" - - lines.append( - f"| {website} | {provider_name} | {has_gpt_35} | {has_gpt_4} | {stream} | {status} | {auth} |" - ) + for is_working in (True, False): + for _provider in providers: + if is_working != _provider.working: + continue + netloc = urlparse(_provider.url).netloc + website = f"[{netloc}]({_provider.url})" + + provider_name = f"g4f.provider.{_provider.__name__}" + + has_gpt_35 = "✔️" if _provider.supports_gpt_35_turbo else "❌" + has_gpt_4 = "✔️" if _provider.supports_gpt_4 else "❌" + stream = "✔️" if _provider.supports_stream else "❌" + if _provider.working: + if test(_provider): + status = '![Active](https://img.shields.io/badge/Active-brightgreen)' + else: + status = '![Unknown](https://img.shields.io/badge/Unknown-grey)' + else: + status = '![Inactive](https://img.shields.io/badge/Inactive-red)' + auth = "✔️" if _provider.needs_auth else "❌" + + lines.append( + f"| {website} | {provider_name} | {has_gpt_35} | {has_gpt_4} | {stream} | {status} | {auth} |" + ) print("\n".join(lines)) @@ -79,6 +84,8 @@ def print_models(): _models = get_models() for model in _models: + if model.best_provider.__name__ not in provider_urls: + continue split_name = re.split(r":|/", model.name) name = split_name[-1] |