Update app.py
Browse files
app.py
CHANGED
@@ -111,7 +111,7 @@ def ask(query, max_attempt_times=3):
|
|
111 |
return answer
|
112 |
|
113 |
|
114 |
-
def askingChatGPT(qs, qas, min_interval_seconds=
|
115 |
|
116 |
for i, q in enumerate(qs):
|
117 |
ask_start_time = time.time()
|
@@ -125,7 +125,7 @@ def askingChatGPT(qs, qas, min_interval_seconds=10, max_interval_seconds=30):
|
|
125 |
return a
|
126 |
except concurrent.futures.TimeoutError:
|
127 |
print('ask call timed out after', timeout, 'seconds, retrying...')
|
128 |
-
|
129 |
a = ask_(q, max_interval_seconds)
|
130 |
|
131 |
qas.append({"q":q, "a":a})
|
|
|
111 |
return answer
|
112 |
|
113 |
|
114 |
+
def askingChatGPT(qs, qas, min_interval_seconds=3, max_interval_seconds=30):
|
115 |
|
116 |
for i, q in enumerate(qs):
|
117 |
ask_start_time = time.time()
|
|
|
125 |
return a
|
126 |
except concurrent.futures.TimeoutError:
|
127 |
print('ask call timed out after', timeout, 'seconds, retrying...')
|
128 |
+
return ask_(q, timeout*2) # 当超时时,重新调用函数
|
129 |
a = ask_(q, max_interval_seconds)
|
130 |
|
131 |
qas.append({"q":q, "a":a})
|