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

XFEstudio/gpt4free

Add some arguments to chat completion api, update discord links

651df0cf
Heiner Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

9 个文件 +15 -14
Modified README.md +1 -1
@@ -32,7 +32,7 @@ docker pull hlohaus789/g4f
32 32 - **For comprehensive details on new features and updates, please refer to our** [Releases](https://github.com/xtekky/gpt4free/releases) **page**
33 33 - **Installation Guide for Windows (.exe):** 💻 [Installation Guide for Windows (.exe)](#installation-guide-for-windows-exe)
34 34 - **Join our Telegram Channel:** 📨 [telegram.me/g4f_channel](https://telegram.me/g4f_channel)
35 - **Join our Discord Group:** 💬🆕️ [discord.gg/6yrm7H4B](https://discord.gg/6yrm7H4B)
35 - **Join our Discord Group:** 💬🆕️ [discord.gg/vE7gCvss](https://discord.gg/vE7gCvss)
36 36
37 37
38 38 ## 🔻 Site Takedown
Modified g4f/Provider/Copilot.py +0 -1
@@ -26,7 +26,6 @@ from ..providers.asyncio import get_running_loop
26 26 from ..Provider.openai.har_file import NoValidHarFileError, get_headers, get_har_files
27 27 from ..requests import get_nodriver
28 28 from ..image import ImageResponse, to_bytes, is_accepted_format
29 from ..cookies import get_cookies_dir
30 29 from .. import debug
31 30
32 31 class Conversation(BaseConversation):
Modified g4f/api/__init__.py +3 -0
@@ -104,6 +104,9 @@ class ChatCompletionsConfig(BaseModel):
104 104 web_search: Optional[bool] = None
105 105 proxy: Optional[str] = None
106 106 conversation_id: Optional[str] = None
107 history_disabled: Optional[bool] = None
108 auto_continue: Optional[bool] = None
109 timeout: Optional[int] = None
107 110
108 111 class ImageGenerationConfig(BaseModel):
109 112 prompt: str
Modified g4f/client/__init__.py +2 -2
@@ -9,7 +9,7 @@ import base64
9 9 from typing import Union, AsyncIterator, Iterator, Coroutine, Optional
10 10
11 11 from ..image import ImageResponse, copy_images, images_dir
12 from ..typing import Messages, Image, ImageType
12 from ..typing import Messages, ImageType
13 13 from ..providers.types import ProviderType
14 14 from ..providers.response import ResponseType, FinishReason, BaseConversation, SynthesizeData
15 15 from ..errors import NoImageResponseError, ModelNotFoundError
@@ -332,7 +332,7 @@ class Images:
332 332
333 333 def create_variation(
334 334 self,
335 image: Union[str, bytes],
335 image: ImageType,
336 336 model: str = None,
337 337 provider: Optional[ProviderType] = None,
338 338 response_format: str = "url",
Modified g4f/client/service.py +3 -2
@@ -68,9 +68,10 @@ def get_model_and_provider(model : Union[Model, str],
68 68 model = provider.default_model if hasattr(provider, "default_model") else ""
69 69 else:
70 70 raise ModelNotFoundError(f'Model not found: {model}')
71 else:
71 elif isinstance(model, Model):
72 72 provider = model.best_provider
73
73 else:
74 raise ValueError(f"Unexpected type: {type(model)}")
74 75 if not provider:
75 76 raise ProviderNotFoundError(f'No provider found for model: {model}')
76 77
Modified g4f/gui/__init__.py +3 -3
@@ -9,6 +9,9 @@ except ImportError as e:
9 9 import_error = e
10 10
11 11 def get_gui_app():
12 if import_error is not None:
13 raise MissingRequirementsError(f'Install "gui" requirements | pip install -U g4f[gui]\n{import_error}')
14
12 15 site = Website(app)
13 16 for route in site.routes:
14 17 app.add_url_rule(
@@ -27,9 +30,6 @@ def get_gui_app():
27 30 return app
28 31
29 32 def run_gui(host: str = '0.0.0.0', port: int = 8080, debug: bool = False) -> None:
30 if import_error is not None:
31 raise MissingRequirementsError(f'Install "gui" requirements | pip install -U g4f[gui]\n{import_error}')
32
33 33 config = {
34 34 'host' : host,
35 35 'port' : port,
Modified g4f/gui/client/index.html +1 -1
@@ -72,7 +72,7 @@
72 72 </button>
73 73 <div class="info">
74 74 <i class="fa-brands fa-discord"></i>
75 <span class="convo-title">discord ~ <a href="https://discord.gg/6yrm7H4B" target="_blank">discord.gg/6yrm7H4B</a>
75 <span class="convo-title">discord ~ <a href="https://discord.gg/vE7gCvss" target="_blank">discord.gg/vE7gCvss</a>
76 76 </span>
77 77 </div>
78 78 <div class="info">
Modified g4f/gui/server/api.py +1 -3
@@ -108,11 +108,9 @@ class Api:
108 108 }
109 109
110 110 def _create_response_stream(self, kwargs: dict, conversation_id: str, provider: str, download_images: bool = True) -> Iterator:
111 debug.logs = []
112 print_callback = debug.log_handler
113 111 def log_handler(text: str):
114 112 debug.logs.append(text)
115 print_callback(text)
113 print(text)
116 114 debug.log_handler = log_handler
117 115 try:
118 116 result = ChatCompletion.create(**kwargs)
Modified g4f/gui/server/website.py +1 -1
@@ -40,4 +40,4 @@ class Website:
40 40 return render_template('index.html', chat_id=conversation_id)
41 41
42 42 def _index(self):
43 return render_template('index.html', chat_id=str(uuid.uuid4()))
43 return render_template('index.html', chat_id=str(uuid.uuid4()))