XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Update (g4f/Provider/TeachAnything.py)

eaaa53d7
kqlio67 <kqlio67@users.noreply.github.com>
提交于

代码差异

1 个文件 +18 -4
Modified g4f/Provider/TeachAnything.py +18 -4
@@ -14,6 +14,17 @@ class TeachAnything(AsyncGeneratorProvider, ProviderModelMixin):
14 14 api_endpoint = "/api/generate"
15 15 working = True
16 16 default_model = "llama-3.1-70b"
17 models = [default_model]
18
19 @classmethod
20 def get_model(cls, model: str) -> str:
21 if model in cls.models:
22 return model
23 elif model in cls.model_aliases:
24 return cls.model_aliases[model]
25 else:
26 return cls.default_model
27
17 28
18 29 @classmethod
19 30 async def create_async_generator(
@@ -24,6 +35,7 @@ class TeachAnything(AsyncGeneratorProvider, ProviderModelMixin):
24 35 **kwargs: Any
25 36 ) -> AsyncResult:
26 37 headers = cls._get_headers()
38 model = cls.get_model(model)
27 39
28 40 async with ClientSession(headers=headers) as session:
29 41 prompt = format_prompt(messages)
@@ -61,16 +73,18 @@ class TeachAnything(AsyncGeneratorProvider, ProviderModelMixin):
61 73 return {
62 74 "accept": "*/*",
63 75 "accept-language": "en-US,en;q=0.9",
76 "cache-control": "no-cache",
64 77 "content-type": "application/json",
65 78 "dnt": "1",
66 79 "origin": "https://www.teach-anything.com",
80 "pragma": "no-cache",
67 81 "priority": "u=1, i",
68 82 "referer": "https://www.teach-anything.com/",
69 "sec-ch-ua": '"Not/A)Brand";v="8", "Chromium";v="126"',
70 "sec-ch-ua-mobile": "?0",
71 "sec-ch-ua-platform": '"Linux"',
83 "sec-ch-us": '"Not?A_Brand";v="99", "Chromium";v="130"',
84 "sec-ch-us-mobile": "?0",
85 "sec-ch-us-platform": '"Linux"',
72 86 "sec-fetch-dest": "empty",
73 87 "sec-fetch-mode": "cors",
74 88 "sec-fetch-site": "same-origin",
75 "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
89 "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
76 90 }