learn progress

This commit is contained in:
CakeCN
2025-12-09 22:56:51 +08:00
parent 15cbeb93ee
commit 4d5a8bb23f
3 changed files with 90 additions and 10 deletions

View File

@@ -86,10 +86,11 @@ class AgentNamespace(Namespace):
chatmanager.function_manager.add_function(next_chapter, {'user_uuid': user_uuid})
if not chatmanager.restart:# 尝试加载用户学习进度
progress = load_learning_progress(user_id, course_id, chapter_name, lesson_name)
progress_result = load_learning_progress(user_id, course_id, chapter_name, lesson_name)
need_skip_chapters = 0
if progress:
if progress_result['exists']:
progress = progress_result['data']
# 恢复学习进度数据
if 'scores' in progress:
# 根据scores的数量确定需要跳过的章节数
@@ -108,8 +109,10 @@ class AgentNamespace(Namespace):
chatmanager.chapter_chain_now = progress['chapter_chain_now']
upload_learning_progress_to_cloud(progress)
else:
chatmanager.chat_historys = []
chatmanager.scores = []
# 使用默认值,确保有完整的结构
chatmanager.chat_historys = progress_result['data']['chat_historys']
chatmanager.scores = progress_result['data']['scores']
print(f"未找到学习记录,使用默认值: {progress_result['message']}")
fmd,fmdp,fsp = load_full_markdown_file(course_id, chapter_name, lesson_name)
user_uuid2ase_client[user_uuid] = HSAEngineClient(current_app.config["ASE_ENGINE_URL"], current_app.config["ASE_ENGINE_NAMESPACE"],id=user_id, chatmanager = chatmanager)