fix chapter now

This commit is contained in:
CakeCN
2025-12-14 14:33:29 +08:00
parent c8942cedac
commit cb435ecade
2 changed files with 2 additions and 5 deletions

View File

@@ -35,7 +35,6 @@ class ChatManager:
_lock = threading.RLock()
def __init__(self, restart=False):
self.restart = restart
self.chapter_chain_now = -1
self.ase_client = None
self.app = None
self.socketio = None
@@ -70,7 +69,7 @@ class ChatManager:
self.chapter_chain = load_chapters(raw_markdown, raw_markdown_prompts, raw_score_prompts)
self.bb = None
self.chat_historys = []
self.chapter_chain_now = -1
self.chapter_chain_now = 0
self.scores = []

View File

@@ -77,8 +77,6 @@ class AgentNamespace(Namespace):
Returns:
int: 需要跳过的章节数
"""
need_skip_chapters = 0
# 总是从mongo加载学习进度
progress_result = load_learning_progress(user_id, course_id, chapter_name, lesson_name)
@@ -100,7 +98,7 @@ class AgentNamespace(Namespace):
upload_learning_progress_to_cloud(progress)
# 计算需要跳过的章节数:从初始的-1到当前的chapter_chain_now
need_skip_chapters = chatmanager.chapter_chain_now + 1
need_skip_chapters = chatmanager.chapter_chain_now
else:
# 使用默认值,确保有完整的结构
chatmanager.chat_historys = progress_result['data']['chat_historys']