delete stop
Browse files- owl/webapp_zh.py +0 -29
owl/webapp_zh.py
CHANGED
@@ -246,35 +246,6 @@ def validate_input(question: str) -> bool:
|
|
246 |
return False
|
247 |
return True
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
"""停止当前运行的线程,而不是终止整个进程"""
|
252 |
-
global CURRENT_PROCESS, STOP_REQUESTED
|
253 |
-
|
254 |
-
if CURRENT_PROCESS is None:
|
255 |
-
logging.info("没有正在运行的线程")
|
256 |
-
return "没有正在运行的线程", "<span class='status-indicator status-success'></span> 已就绪"
|
257 |
-
|
258 |
-
try:
|
259 |
-
STOP_REQUESTED.set() # 设置停止标志
|
260 |
-
logging.info("已设置停止标志,正在等待线程响应...")
|
261 |
-
|
262 |
-
# 如果是线程,只需要设置标志让它自行停止
|
263 |
-
if isinstance(CURRENT_PROCESS, threading.Thread) and CURRENT_PROCESS.is_alive():
|
264 |
-
logging.info("等待线程处理停止请求...")
|
265 |
-
# 不强制终止线程,只设置标志位让线程自行退出
|
266 |
-
# 线程应该会定期检查STOP_REQUESTED标志
|
267 |
-
return "已请求停止生成", "<span class='status-indicator status-warning'></span> 正在停止..."
|
268 |
-
else:
|
269 |
-
# 如果不是线程或线程已经不活跃,则重置状态
|
270 |
-
CURRENT_PROCESS = None
|
271 |
-
logging.info("线程已不活跃")
|
272 |
-
return "线程已停止", "<span class='status-indicator status-success'></span> 已就绪"
|
273 |
-
|
274 |
-
except Exception as e:
|
275 |
-
logging.error(f"停止线程时出错: {str(e)}")
|
276 |
-
return f"停止线程时出错: {str(e)}", f"<span class='status-indicator status-error'></span> 错误: {str(e)}"
|
277 |
-
|
278 |
def run_owl(question: str, example_module: str) -> Tuple[str, List[List[str]], str, str]:
|
279 |
"""运行OWL系统并返回结果
|
280 |
|
|
|
246 |
return False
|
247 |
return True
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
def run_owl(question: str, example_module: str) -> Tuple[str, List[List[str]], str, str]:
|
250 |
"""运行OWL系统并返回结果
|
251 |
|