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

XFEstudio/gpt4free

Update model list in PollinationsAI and Jmuz Improve content filter in Jmuz

7ca67408
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +30 -14
Modified g4f/Provider/Jmuz.py +28 -12
@@ -5,7 +5,7 @@ from .needs_auth.OpenaiAPI import OpenaiAPI
5 5
6 6 class Jmuz(OpenaiAPI):
7 7 label = "Jmuz"
8 url = "https://discord.gg/qXfu24JmsB"
8 url = "https://discord.gg/Ew6JzjA2NR"
9 9 login_url = None
10 10 api_base = "https://jmuz.me/gpt/api/v2"
11 11 api_key = "prod"
@@ -18,12 +18,14 @@ class Jmuz(OpenaiAPI):
18 18 default_model = "gpt-4o"
19 19 model_aliases = {
20 20 "gemini": "gemini-exp",
21 "deepseek-chat": "deepseek-2.5",
22 "qwq-32b": "qwq-32b-preview"
21 "gemini-1.5-pro": "gemini-pro",
22 "gemini-1.5-flash": "gemini-thinking",
23 "deepseek-chat": "deepseek-v3",
24 "qwq-32b": "qwq-32b-preview",
23 25 }
24
26
25 27 @classmethod
26 def get_models(cls):
28 def get_models(cls, **kwargs):
27 29 if not cls.models:
28 30 cls.models = super().get_models(api_key=cls.api_key, api_base=cls.api_base)
29 31 return cls.models
@@ -47,6 +49,7 @@ class Jmuz(OpenaiAPI):
47 49 "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
48 50 }
49 51 started = False
52 buffer = ""
50 53 async for chunk in super().create_async_generator(
51 54 model=model,
52 55 messages=messages,
@@ -56,10 +59,23 @@ class Jmuz(OpenaiAPI):
56 59 headers=headers,
57 60 **kwargs
58 61 ):
59 if isinstance(chunk, str) and cls.url in chunk:
60 continue
61 if isinstance(chunk, str) and not started:
62 chunk = chunk.lstrip()
63 if chunk:
64 started = True
65 yield chunk
62 if isinstance(chunk, str):
63 buffer += chunk
64 if "Join for free".startswith(buffer) or buffer.startswith("Join for free"):
65 if buffer.endswith("\n"):
66 buffer = ""
67 continue
68 if "https://discord.gg/".startswith(buffer) or "https://discord.gg/" in buffer:
69 if "..." in buffer:
70 buffer = ""
71 continue
72 if "o1-preview".startswith(buffer) or buffer.startswith("o1-preview"):
73 if "\n" in buffer:
74 buffer = ""
75 continue
76 if not started:
77 buffer = buffer.lstrip()
78 if buffer:
79 started = True
80 yield buffer
81 buffer = ""
Modified g4f/Provider/PollinationsAI.py +2 -2
@@ -38,9 +38,9 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
38 38 default_model = "openai"
39 39 default_image_model = "flux"
40 40 default_vision_model = "gpt-4o"
41 extra_image_models = ["midjourney", "dall-e-3"]
41 extra_image_models = ["midjourney", "dall-e-3", "flux-pro", "flux-realism", "flux-cablyai", "flux-anime", "flux-3d"]
42 42 vision_models = [default_vision_model, "gpt-4o-mini"]
43 extra_text_models = [*vision_models, "claude", "karma", "command-r", "llamalight", "mistral-large", "sur", "sur-mistral"]
43 extra_text_models = [*vision_models, "claude", "karma", "command-r", "llamalight", "mistral-large", "sur", "sur-mistral", "any-dark"]
44 44 model_aliases = {
45 45 "qwen-2-72b": "qwen",
46 46 "qwen-2.5-coder-32b": "qwen-coder",