JuanMa360 commited on
Commit
2b17f3a
1 Parent(s): 6033bc1

bugfix: streaming & examples

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -32,9 +32,13 @@ def slow_api_response(message, history, property_id="c0ced2220b87fc23762facf6171
32
  response_length = len(api_response)
33
  sleep_time = total_time / response_length if response_length > 0 else total_time
34
 
35
- for i in range(response_length):
36
- time.sleep(sleep_time)
37
- yield api_response[:i + 1]
 
 
 
 
38
 
39
  except requests.RequestException as e:
40
  yield f"Error: {str(e)}"
 
32
  response_length = len(api_response)
33
  sleep_time = total_time / response_length if response_length > 0 else total_time
34
 
35
+ if response_length > 3000:
36
+ yield api_response
37
+
38
+ else:
39
+ for i in range(response_length):
40
+ time.sleep(sleep_time)
41
+ yield api_response[:i + 1]
42
 
43
  except requests.RequestException as e:
44
  yield f"Error: {str(e)}"