feat(g4f/Provider/Bixin123.py): implement dynamic fingerprint generation

This commit is contained in:
kqlio67 2024-09-11 21:59:11 +03:00
parent cd5b916789
commit 2e3d60a5f1

View File

@ -2,6 +2,7 @@ from __future__ import annotations
from aiohttp import ClientSession
import json
import random
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
from ..typing import AsyncResult, Messages
from .helper import format_prompt
@ -30,6 +31,10 @@ class Bixin123(AsyncGeneratorProvider, ProviderModelMixin):
else:
return cls.default_model
@classmethod
def generate_fingerprint(cls) -> str:
return str(random.randint(100000000, 999999999))
@classmethod
async def create_async_generator(
cls,
@ -45,7 +50,7 @@ class Bixin123(AsyncGeneratorProvider, ProviderModelMixin):
"accept-language": "en-US,en;q=0.9",
"cache-control": "no-cache",
"content-type": "application/json",
"fingerprint": "988148794",
"fingerprint": cls.generate_fingerprint(),
"origin": cls.url,
"pragma": "no-cache",
"priority": "u=1, i",