From 06a90b753e75f2a6404d0f72ce4c2eae67b6f4bd Mon Sep 17 00:00:00 2001 From: CakeCN Date: Sun, 14 Sep 2025 14:14:01 +0800 Subject: [PATCH] allow next_chapter exception --- Html/apps/function_tools/chapter.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Html/apps/function_tools/chapter.py b/Html/apps/function_tools/chapter.py index e28fa95..1511653 100644 --- a/Html/apps/function_tools/chapter.py +++ b/Html/apps/function_tools/chapter.py @@ -1,7 +1,11 @@ from flask import current_app +from ..models.function import FunctionResponse def next_chapter(user_uuid): - ex = current_app.extensions - user_uuid2chatmanager = ex["user_uuid2chatmanager"] - user_uuid2chatmanager[user_uuid].next_chapter() - return "成功进入下一章" \ No newline at end of file + try: + ex = current_app.extensions + user_uuid2chatmanager = ex["user_uuid2chatmanager"] + user_uuid2chatmanager[user_uuid].next_chapter() + return FunctionResponse("next_chapter", True, "成功进入下一章") + except Exception as e: + return FunctionResponse("next_chapter", False, f"进入下一章发生意外错误: {str(e)}") \ No newline at end of file