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