fix chapter now
This commit is contained in:
@@ -35,7 +35,6 @@ class ChatManager:
|
|||||||
_lock = threading.RLock()
|
_lock = threading.RLock()
|
||||||
def __init__(self, restart=False):
|
def __init__(self, restart=False):
|
||||||
self.restart = restart
|
self.restart = restart
|
||||||
self.chapter_chain_now = -1
|
|
||||||
self.ase_client = None
|
self.ase_client = None
|
||||||
self.app = None
|
self.app = None
|
||||||
self.socketio = None
|
self.socketio = None
|
||||||
@@ -70,7 +69,7 @@ class ChatManager:
|
|||||||
self.chapter_chain = load_chapters(raw_markdown, raw_markdown_prompts, raw_score_prompts)
|
self.chapter_chain = load_chapters(raw_markdown, raw_markdown_prompts, raw_score_prompts)
|
||||||
self.bb = None
|
self.bb = None
|
||||||
self.chat_historys = []
|
self.chat_historys = []
|
||||||
self.chapter_chain_now = -1
|
self.chapter_chain_now = 0
|
||||||
self.scores = []
|
self.scores = []
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,6 @@ class AgentNamespace(Namespace):
|
|||||||
Returns:
|
Returns:
|
||||||
int: 需要跳过的章节数
|
int: 需要跳过的章节数
|
||||||
"""
|
"""
|
||||||
need_skip_chapters = 0
|
|
||||||
|
|
||||||
# 总是从mongo加载学习进度
|
# 总是从mongo加载学习进度
|
||||||
progress_result = load_learning_progress(user_id, course_id, chapter_name, lesson_name)
|
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)
|
upload_learning_progress_to_cloud(progress)
|
||||||
|
|
||||||
# 计算需要跳过的章节数:从初始的-1到当前的chapter_chain_now
|
# 计算需要跳过的章节数:从初始的-1到当前的chapter_chain_now
|
||||||
need_skip_chapters = chatmanager.chapter_chain_now + 1
|
need_skip_chapters = chatmanager.chapter_chain_now
|
||||||
else:
|
else:
|
||||||
# 使用默认值,确保有完整的结构
|
# 使用默认值,确保有完整的结构
|
||||||
chatmanager.chat_historys = progress_result['data']['chat_historys']
|
chatmanager.chat_historys = progress_result['data']['chat_historys']
|
||||||
|
|||||||
Reference in New Issue
Block a user