mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Support timeout in backend_api
This commit is contained in:
parent
90262b1f6a
commit
c27f0c995e
4 changed files with 31 additions and 25 deletions
|
|
@ -126,7 +126,8 @@ class Backend_Api(Api):
|
|||
media.append((url, None))
|
||||
if media:
|
||||
json_data['media'] = media
|
||||
|
||||
if app.timeout:
|
||||
json_data['timeout'] = app.timeout
|
||||
if app.demo and not json_data.get("provider"):
|
||||
model = json_data.get("model")
|
||||
if model != "default" and model in models.demo_models:
|
||||
|
|
@ -138,12 +139,12 @@ class Backend_Api(Api):
|
|||
debug.log("User:", request.headers.get("x_user", f"{user}:{ip}"))
|
||||
kwargs = self._prepare_conversation_kwargs(json_data)
|
||||
return self.app.response_class(
|
||||
self._create_response_stream(
|
||||
safe_iter_generator(self._create_response_stream(
|
||||
kwargs,
|
||||
json_data.get("provider"),
|
||||
json_data.get("download_media", True),
|
||||
tempfiles
|
||||
),
|
||||
)),
|
||||
mimetype='text/event-stream'
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue