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

XFEstudio/gpt4free

Removed provider (g4f/Provider/ChatifyAI.py)

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

代码差异

4 个文件 +0 -83
Modified docs/providers-and-models.md +0 -1
@@ -28,7 +28,6 @@ This document provides an overview of various AI providers and models, including
28 28 |[chatgot.one](https://www.chatgot.one/)|`g4f.Provider.ChatGot`|`gemini-pro`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌|
29 29 |[chatgpt.com](https://chatgpt.com)|`g4f.Provider.ChatGpt`|`?`|`?`|`?`|?|![Unknown](https://img.shields.io/badge/Unknown-grey) |❌|
30 30 |[chatgpt.es](https://chatgpt.es)|`g4f.Provider.ChatGptEs`|`gpt-4o, gpt-4o-mini`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌|
31 |[chatify-ai.vercel.app](https://chatify-ai.vercel.app)|`g4f.Provider.ChatifyAI`|`llama-3.1-8b`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌|
32 31 |[playground.ai.cloudflare.com](https://playground.ai.cloudflare.com)|`g4f.Provider.Cloudflare`|`gemma-7b, llama-2-7b, llama-3-8b, llama-3.1-8b, llama-3.2-1b, phi-2, qwen-1.5-0-5b, qwen-1.5-8b, qwen-1.5-14b, qwen-1.5-7b`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌|
33 32 |[darkai.foundation/chat](https://darkai.foundation/chat)|`g4f.Provider.DarkAI`|`gpt-4o, gpt-3.5-turbo, llama-3-70b, llama-3-405b`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌|
34 33 |[duckduckgo.com](https://duckduckgo.com/duckchat/v1/chat)|`g4f.Provider.DDG`|`gpt-4o-mini, claude-3-haiku, llama-3.1-70b, mixtral-8x7b`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌|
Deleted g4f/Provider/ChatifyAI.py +0 -79
@@ -1,79 +0,0 @@
1 from __future__ import annotations
2
3 from aiohttp import ClientSession
4
5 from ..typing import AsyncResult, Messages
6 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
7 from .helper import format_prompt
8
9
10 class ChatifyAI(AsyncGeneratorProvider, ProviderModelMixin):
11 url = "https://chatify-ai.vercel.app"
12 api_endpoint = "https://chatify-ai.vercel.app/api/chat"
13 working = True
14 supports_stream = False
15 supports_system_message = True
16 supports_message_history = True
17
18 default_model = 'llama-3.1'
19 models = [default_model]
20 model_aliases = {
21 "llama-3.1-8b": "llama-3.1",
22 }
23
24 @classmethod
25 def get_model(cls, model: str) -> str:
26 if model in cls.models:
27 return model
28 elif model in cls.model_aliases:
29 return cls.model_aliases.get(model, cls.default_model)
30 else:
31 return cls.default_model
32
33 @classmethod
34 async def create_async_generator(
35 cls,
36 model: str,
37 messages: Messages,
38 proxy: str = None,
39 **kwargs
40 ) -> AsyncResult:
41 model = cls.get_model(model)
42
43 headers = {
44 "accept": "*/*",
45 "accept-language": "en-US,en;q=0.9",
46 "cache-control": "no-cache",
47 "content-type": "application/json",
48 "origin": cls.url,
49 "pragma": "no-cache",
50 "priority": "u=1, i",
51 "referer": f"{cls.url}/",
52 "sec-ch-ua": '"Chromium";v="129", "Not=A?Brand";v="8"',
53 "sec-ch-ua-mobile": "?0",
54 "sec-ch-ua-platform": '"Linux"',
55 "sec-fetch-dest": "empty",
56 "sec-fetch-mode": "cors",
57 "sec-fetch-site": "same-origin",
58 "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
59 }
60 async with ClientSession(headers=headers) as session:
61 data = {
62 "messages": [{"role": "user", "content": format_prompt(messages)}]
63 }
64 async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
65 response.raise_for_status()
66 response_text = await response.text()
67
68 filtered_response = cls.filter_response(response_text)
69 yield filtered_response
70
71 @staticmethod
72 def filter_response(response_text: str) -> str:
73 parts = response_text.split('"')
74
75 text_parts = parts[1::2]
76
77 clean_text = ''.join(text_parts)
78
79 return clean_text
Modified g4f/Provider/__init__.py +0 -1
@@ -18,7 +18,6 @@ from .Bing import Bing
18 18 from .Blackbox import Blackbox
19 19 from .ChatGpt import ChatGpt
20 20 from .ChatGptEs import ChatGptEs
21 from .ChatifyAI import ChatifyAI
22 21 from .Cloudflare import Cloudflare
23 22 from .DarkAI import DarkAI
24 23 from .DDG import DDG
Modified g4f/models.py +0 -2
@@ -14,7 +14,6 @@ from .Provider import (
14 14 ChatGpt,
15 15 Chatgpt4Online,
16 16 ChatGptEs,
17 ChatifyAI,
18 17 Cloudflare,
19 18 DarkAI,
20 19 DDG,
@@ -78,7 +77,6 @@ default = Model(
78 77 DeepInfraChat,
79 78 Airforce,
80 79 ChatGptEs,
81 ChatifyAI,
82 80 Cloudflare,
83 81 AIUncensored,
84 82 DarkAI,