mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Add count chars to gui, Add retry support to fix rate limit in Bing
This commit is contained in:
parent
2a3880ac2f
commit
5bcf21f9bd
8 changed files with 123 additions and 113 deletions
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
import secrets
|
||||
import string
|
||||
|
||||
from ..typing import Messages
|
||||
|
|
@ -40,11 +39,14 @@ def get_random_string(length: int = 10) -> str:
|
|||
for _ in range(length)
|
||||
)
|
||||
|
||||
def get_random_hex() -> str:
|
||||
def get_random_hex(length: int = 32) -> str:
|
||||
"""
|
||||
Generate a random hexadecimal string of a fixed length.
|
||||
Generate a random hexadecimal string with n length.
|
||||
|
||||
Returns:
|
||||
str: A random hexadecimal string of 32 characters (16 bytes).
|
||||
str: A random hexadecimal string of n characters.
|
||||
"""
|
||||
return secrets.token_hex(16).zfill(32)
|
||||
return ''.join(
|
||||
random.choice("abcdef" + string.digits)
|
||||
for _ in range(length)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue