Spaces:
Sleeping
Sleeping
XufengDuan
commited on
Commit
•
86c17df
1
Parent(s):
0e76736
update scripts
Browse files
src/backend/model_operations.py
CHANGED
@@ -213,10 +213,16 @@ class SummaryGenerator:
|
|
213 |
time.sleep(wait_time)
|
214 |
else:
|
215 |
print(f"Error at index {i}: {e}")
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
if exit_outer_loop:
|
222 |
break
|
@@ -391,6 +397,7 @@ class SummaryGenerator:
|
|
391 |
{"role": "user", "content": user_prompt}],
|
392 |
# temperature=0.0,
|
393 |
max_tokens=50,
|
|
|
394 |
)
|
395 |
result = response['choices'][0]['message']['content']
|
396 |
# print()
|
|
|
213 |
time.sleep(wait_time)
|
214 |
else:
|
215 |
print(f"Error at index {i}: {e}")
|
216 |
+
wait_time = 3600
|
217 |
+
time.sleep(wait_time)
|
218 |
+
try:
|
219 |
+
_response = self.generate_summary(system_prompt, _user_prompt)
|
220 |
+
break
|
221 |
+
except Exception as e:
|
222 |
+
exceptions.append(e)
|
223 |
+
print(f"Error at index {i}: {e}")
|
224 |
+
exit_outer_loop = True # 设置标志变量为True,准备退出最外层循环
|
225 |
+
break # 跳出当前的 while 循环
|
226 |
|
227 |
if exit_outer_loop:
|
228 |
break
|
|
|
397 |
{"role": "user", "content": user_prompt}],
|
398 |
# temperature=0.0,
|
399 |
max_tokens=50,
|
400 |
+
api_key = os.getenv('OpenAI_key')
|
401 |
)
|
402 |
result = response['choices'][0]['message']['content']
|
403 |
# print()
|