try hello message

This commit is contained in:
Cai
2025-09-23 15:10:57 +08:00
parent 271672c904
commit 6aac420062
9 changed files with 1805 additions and 129418 deletions

131041
Html/.log

File diff suppressed because it is too large Load Diff

View File

@@ -32,7 +32,7 @@ class ChatManager:
pass pass
def init(self,user_uuid,ase_client,raw_markdown,raw_markdown_prompts,raw_score_prompts,max_iter = 5, app=None, socketio=None): def init(self,user_uuid,ase_client,raw_markdown,raw_markdown_prompts,raw_score_prompts,material_id,chapter_name, lesson_name, max_iter = 5, app=None, socketio=None):
self.chapter_chain_now = -1 self.chapter_chain_now = -1
self.ase_client = ase_client self.ase_client = ase_client
self.app = app self.app = app
@@ -41,9 +41,13 @@ class ChatManager:
self.raw_markdown = raw_markdown self.raw_markdown = raw_markdown
self.raw_markdown_prompts = raw_markdown_prompts self.raw_markdown_prompts = raw_markdown_prompts
self.raw_score_prompts = raw_score_prompts self.raw_score_prompts = raw_score_prompts
self.material_id = material_id
self.chapter_name = chapter_name
self.lesson_name = lesson_name
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.function_manager = FunctionManager() self.function_manager = FunctionManager()
self.bb = None self.bb = None
self.chat_historys = []
def disconnect(self, uuid): def disconnect(self, uuid):
try: try:
@@ -58,12 +62,16 @@ class ChatManager:
assert self.chapter_chain_now + 1 < len(self.chapter_chain), "chapter_chain_now out of range" assert self.chapter_chain_now + 1 < len(self.chapter_chain), "chapter_chain_now out of range"
self.chapter_chain_now += 1 self.chapter_chain_now += 1
self.focus_chapter(self.chapter_chain_now) self.focus_chapter(self.chapter_chain_now)
def focus_chapter(self, chapter_index): def focus_chapter(self, chapter_index):
assert chapter_index < len(self.chapter_chain), "chapter_index out of range" assert chapter_index < len(self.chapter_chain), "chapter_index out of range"
self.chapter_chain_now = chapter_index self.chapter_chain_now = chapter_index
self.chapter_chain[chapter_index].Focus() self.chapter_chain[chapter_index].Focus()
self.ase_client.loadmarkdown(self.chapter_chain[chapter_index].chapter, self.chapter_chain[chapter_index].chapter_prompt, self.chapter_chain[chapter_index].score_prompt)
def load_next_chapter(self):
self.ase_client.loadmarkdown(self.chapter_chain[self.chapter_chain_now].chapter, self.chapter_chain[self.chapter_chain_now].chapter_prompt, self.chapter_chain[self.chapter_chain_now].score_prompt)
def upload_bb(self): def upload_bb(self):
self.ase_client.send_text('backboard-in', self.bb.get_info_prompt()) self.ase_client.send_text('backboard-in', self.bb.get_info_prompt())

View File

@@ -20,6 +20,7 @@ def realtime_response(config: dict, realtime_action: dict) -> None:
bb = backboard_manager.get_backboard(user_uuid) bb = backboard_manager.get_backboard(user_uuid)
if bb is None: return
assert isinstance(bb, Backboard) assert isinstance(bb, Backboard)
# 统一记历史 # 统一记历史

View File

@@ -18,14 +18,15 @@ class User:
self.head_icon = head_icon # URL of the user's head icon self.head_icon = head_icon # URL of the user's head icon
self._id = _id self._id = _id
self.kwargs = kwargs self.kwargs = kwargs
self.mongo = current_app.extensions["mongo"]
def save_chapter_memory(self, course_id, lesson_name, subchapter_title, mem_list, score, is_rebuttal): def save_chapter_memory(self, course_id, lesson_name, subchapter_title, mem_list, score, is_rebuttal):
''' '''
Save the memory of a chapter Save the memory of a chapter
into the mongo db into the mongo db
''' '''
try: try:
mongo = current_app.extensions["mongo"] cp = self.mongo.db.course_process.find_one({"user_uuid": self.user_uuid, "material_id": course_id})
cp = mongo.db.course_process.find_one({"user_uuid": self.user_uuid, "material_id": course_id})
if not cp: if not cp:
return return
cp['course_last_study_date'] = datetime.now().strftime('%Y-%m-%d') cp['course_last_study_date'] = datetime.now().strftime('%Y-%m-%d')
@@ -57,13 +58,12 @@ class User:
break break
if not have_lesson: if not have_lesson:
cp['lesson_processs'].append(([], chapter_name, lesson_name)) cp['lesson_processs'].append(([], chapter_name, lesson_name))
mongo.db.course_process.update_one({"user_uuid": self.user_uuid, "material_id": course_id}, {"$set": cp}) self.mongo.db.course_process.update_one({"user_uuid": self.user_uuid, "material_id": course_id}, {"$set": cp})
except Exception as e: except Exception as e:
print("=-=-=-=-=-=") print("=-=-=-=-=-=")
print(e) print(e)
def get_all_course_progress(self): def get_all_course_progress(self):
mongo = current_app.extensions["mongo"] course_processes = self.mongo.db.course_process.find({"user_uuid": self.user_uuid})
course_processes = mongo.db.course_process.find({"user_uuid": self.user_uuid})
for cp in course_processes: for cp in course_processes:
print(f"Course: {cp['material_id']}") print(f"Course: {cp['material_id']}")
for lessons,chapter_name,lesson_name in cp["lesson_processs"]: for lessons,chapter_name,lesson_name in cp["lesson_processs"]:
@@ -76,17 +76,56 @@ class User:
print(f" Rebuttal Score: {step['rebuttal_score']}") print(f" Rebuttal Score: {step['rebuttal_score']}")
def get_course_progress(self, course_id): def get_course_progress(self, course_id):
mongo = current_app.extensions["mongo"] cp = self.mongo.db.course_process.find_one({"user_uuid": self.user_uuid, "material_id": course_id})
cp = mongo.db.course_process.find_one({"user_uuid": self.user_uuid, "material_id": course_id})
return cp return cp
def set_course_progress(self, chat_historys, step_scores, material_id, chapter_name, lesson_name):
'''
chat_historys: ['', '', ...] 用户对话历史(包括函数调用,也就是右侧栏用户看到的内容)
step_scores: [10, 20, ...] 各个步骤的得分
'''
try:
cl = self.mongo.db.course_process
document = cl.find_one({
'user_uuid': self.user_uuid,
'material_id': material_id
})
if not document:
cl.insert_one({
'user_uuid': self.user_uuid,
'material_id': material_id,
'lesson_processs': [],
'course_put_in_date': datetime.now().strftime('%Y-%m-%d'),
'course_last_study_date': datetime.now().strftime('%Y-%m-%d'),
'course_total_study_time': 0
})
document = cl.find_one({
'user_uuid': self.user_uuid,
'material_id': material_id
})
lesson_processes = document.get('lesson_processs', [])
finded = False
for process in lesson_processes:
if process[1]==chapter_name and process[2]==lesson_name:
process[0] = chat_historys
if len(process)<=3:
process.append(step_scores)
else: process[3] = step_scores
finded = True
if not finded:
lesson_processes.append((chat_historys, chapter_name, lesson_name, step_scores))
cl.update_one({'user_uuid': self.user_uuid, 'material_id': material_id}, {'$set': {'lesson_processs': lesson_processes}})
except Exception as e:
print("=-=-=-=-=-=")
print(e)
def select_new_course(self, course_id, course:Material): def select_new_course(self, course_id, course:Material):
try: try:
if course_id in self.select_course: if course_id in self.select_course:
return True return True
self.select_course.append(course_id) self.select_course.append(course_id)
mongo = current_app.extensions["mongo"] self.mongo.db.course_process.insert_one({
mongo.db.course_process.insert_one({
'user_uuid': self.user_uuid, 'user_uuid': self.user_uuid,
'material_id': course_id, 'material_id': course_id,
'lesson_processs':[], 'lesson_processs':[],
@@ -95,9 +134,9 @@ class User:
'course_total_study_time':0}) 'course_total_study_time':0})
for chapter in course.chapters: for chapter in course.chapters:
for lesson in chapter.lessons: for lesson in chapter.lessons:
mongo.db.course_process.update_one({"user_uuid": self.user_uuid, "material_id": course_id}, {"$push": {"lesson_processs": ([], chapter.chapter_name, lesson.lesson_name)}}) self.mongo.db.course_process.update_one({"user_uuid": self.user_uuid, "material_id": course_id}, {"$push": {"lesson_processs": ([], chapter.chapter_name, lesson.lesson_name)}})
self.select_course.append(course_id) self.select_course.append(course_id)
mongo.db.users.update_one({"user_uuid": self.user_uuid}, {"$push": {"select_course": course_id}}) self.mongo.db.users.update_one({"user_uuid": self.user_uuid}, {"$push": {"select_course": course_id}})
except Exception as e: except Exception as e:
print("=-=-=-=-=-=") print("=-=-=-=-=-=")
print(e) print(e)
@@ -131,31 +170,27 @@ class UserList:
def add_user(self, username, password, teacher=False): def add_user(self, username, password, teacher=False):
"""添加新的用户登录信息""" """添加新的用户登录信息"""
# 检查是否已经有该用户 # 检查是否已经有该用户
mongo = current_app.extensions["mongo"] if current_app.extensions["mongo"].db.users.find_one({"username": username}) is None:
if mongo.db.users.find_one({"username": username}) is None: current_app.extensions["mongo"].db.users.insert_one({"user_uuid": Binary.from_uuid(uuid.uuid4()), "username": username, "teacher": teacher, "password": password, "select_course": [], "head_icon": ""})
mongo.db.users.insert_one({"user_uuid": Binary.from_uuid(uuid.uuid4()), "username": username, "teacher": teacher, "password": password, "select_course": [], "head_icon": ""})
else: else:
print(f"User with ID {username} already exists.") print(f"User with ID {username} already exists.")
def get_user_by_name(self, username): def get_user_by_name(self, username):
"""根据用户ID获取用户信息""" """根据用户ID获取用户信息"""
mongo = current_app.extensions["mongo"]
if username not in self.Users: if username not in self.Users:
self.Users[username] = User(**mongo.db.users.find_one({"username": username})) self.Users[username] = User(**current_app.extensions["mongo"].db.users.find_one({"username": username}))
return self.Users[username] return self.Users[username]
else: else:
return self.Users[username] return self.Users[username]
def has_user(self, username): def has_user(self, username):
"""检查用户是否存在""" """检查用户是否存在"""
mongo = current_app.extensions["mongo"] return current_app.extensions["mongo"].db.users.find_one({"username": username}) is not None
return mongo.db.users.find_one({"username": username}) is not None
def get_user_is_teacher(self, username): def get_user_is_teacher(self, username):
"""获取指定 user_id 的用户是否为教师""" """获取指定 user_id 的用户是否为教师"""
mongo = current_app.extensions["mongo"] if current_app.extensions["mongo"].db.users.find_one({"username": username}) is not None:
if mongo.db.users.find_one({"username": username}) is not None: result = current_app.extensions["mongo"].db.users.find_one({"username": username})
result = mongo.db.users.find_one({"username": username})
return result['teacher'] return result['teacher']
return None return None
@@ -169,11 +204,13 @@ class UserList:
def update_password(self, username, new_password): def update_password(self, username, new_password):
"""更新用户的密码""" """更新用户的密码"""
mongo = current_app.extensions["mongo"]
assert mongo.db.users.find_one({"username": username}) is not None, f"User with ID {username} does not exist." assert mongo.db.users.find_one({"username": username}) is not None, f"User with ID {username} does not exist."
mongo.db.users.update_one({"username": username}, {"$set": {"password": new_password, "teacher": mongo.db.users.find_one({"username": username})['teacher']}}) mongo.db.users.update_one({"username": username}, {"$set": {"password": new_password, "teacher": mongo.db.users.find_one({"username": username})['teacher']}})
def delete_user(self, username): def delete_user(self, username):
"""删除用户""" """删除用户"""
mongo = current_app.extensions["mongo"]
assert mongo.db.users.find_one({"username": username}) is not None, f"User with ID {username} does not exist." assert mongo.db.users.find_one({"username": username}) is not None, f"User with ID {username} does not exist."
mongo.db.users.delete_one({"username": username}) mongo.db.users.delete_one({"username": username})

View File

@@ -8,6 +8,7 @@ from ..function_tools import next_chapter
from ..services.backboard_service import realtime_response from ..services.backboard_service import realtime_response
from ..services.markdown_service import load_full_markdown_file from ..services.markdown_service import load_full_markdown_file
from ..extension_ase.ase_client import HSAEngineClient from ..extension_ase.ase_client import HSAEngineClient
from ..services.user_service import get_or_load_current_user
@@ -53,8 +54,12 @@ class AgentNamespace(Namespace):
user_id = uuid2username[user_uuid] user_id = uuid2username[user_uuid]
session['user_uuid'] = user_uuid session['user_uuid'] = user_uuid
print(f'User connected with session user_uuid: {user_uuid}') print(f'User connected with session user_uuid: {user_uuid}')
user_uuid2chatmanager = ex["user_uuid2chatmanager"] user_uuid2chatmanager = ex["user_uuid2chatmanager"]
user_uuid2ase_client = ex["user_uuid2ase_client"] user_uuid2ase_client = ex["user_uuid2ase_client"]
# if (user_uuid2ase_client[user_uuid] is not None and user_uuid2ase_client[user_uuid].connected):
# user_uuid2ase_client[user_uuid].disconnect()
chatmanager = user_uuid2chatmanager[user_uuid]
user_uuid2ase_client[user_uuid] = HSAEngineClient(current_app.config["ASE_ENGINE_URL"], current_app.config["ASE_ENGINE_NAMESPACE"],id=user_id) user_uuid2ase_client[user_uuid] = HSAEngineClient(current_app.config["ASE_ENGINE_URL"], current_app.config["ASE_ENGINE_NAMESPACE"],id=user_id)
user_uuid2ase_client[user_uuid].connect() user_uuid2ase_client[user_uuid].connect()
user_uuid2ase_client[user_uuid].register_route_with_entry( user_uuid2ase_client[user_uuid].register_route_with_entry(
@@ -75,14 +80,22 @@ class AgentNamespace(Namespace):
entry=self, entry=self,
init_data={'room': user_uuid} init_data={'room': user_uuid}
) )
user_uuid2ase_client[user_uuid].register_route_with_entry(
route='chapter_score',
callback=self.receive_ase_chapter_score,
entry=(get_or_load_current_user(),chatmanager),
init_data={'room': user_uuid}
)
fmd,fmdp,fsp = load_full_markdown_file(course_id, chapter_name, lesson_name) fmd,fmdp,fsp = load_full_markdown_file(course_id, chapter_name, lesson_name)
chatmanager = user_uuid2chatmanager[user_uuid]
chatmanager.init(user_uuid, user_uuid2ase_client[user_uuid], fmd, fmdp, fsp, max_iter=5, app=current_app, socketio=self) chatmanager.init(user_uuid, user_uuid2ase_client[user_uuid], fmd, fmdp, fsp, course_id, chapter_name, lesson_name, max_iter=5, app=current_app, socketio=self)
user_uuid2ase_client.chatmanager = chatmanager
# 注册函数,以确保一些初始参数 # 注册函数,以确保一些初始参数
chatmanager.function_manager.add_function(judge, {'course_id': course_id, 'root_path': f'/home/{user_id}/{course_id}/{chapter_name}/{lesson_name}'}) chatmanager.function_manager.add_function(judge, {'course_id': course_id, 'root_path': f'/home/{user_id}/{course_id}/{chapter_name}/{lesson_name}'})
chatmanager.function_manager.add_function(next_chapter, {'user_uuid': user_uuid}) chatmanager.function_manager.add_function(next_chapter, {'user_uuid': user_uuid})
chatmanager.chat_historys = []
chatmanager.scores = []
join_room(user_uuid, namespace='/agent') # 将该用户加入以user_id为名的room join_room(user_uuid, namespace='/agent') # 将该用户加入以user_id为名的room
backboard_manager.add_backboard(user_uuid, user_id, course_id, lesson_name, root_path=f'/home/{user_id}/{course_id}/{chapter_name}/{lesson_name}') backboard_manager.add_backboard(user_uuid, user_id, course_id, lesson_name, root_path=f'/home/{user_id}/{course_id}/{chapter_name}/{lesson_name}')
chatmanager.bb = backboard_manager.get_backboard(user_uuid) chatmanager.bb = backboard_manager.get_backboard(user_uuid)
@@ -102,13 +115,8 @@ class AgentNamespace(Namespace):
data = json.loads(data) data = json.loads(data)
if data['type'] == 'text': if data['type'] == 'text':
res = user_uuid2ase_client[uuid].send_text('dialog', data['data']) res = user_uuid2ase_client[uuid].send_text('dialog', data['data'])
chatmanager.chat_historys.append({'role': 'user', 'content': data['data']})
print(f"Send text to route 'dialog' success: {res}") print(f"Send text to route 'dialog' success: {res}")
# print('=*='*20)
# print(res.content)
# reply = f"{res.content['speak']}"
# with current_app.app_context():
# emit('message',reply, room=uuid, namespace='/agent')
# emit('request_function',res.content['function'], room=uuid, namespace='/agent')
if data['type'] == 'function': # 在这里 前端会发送允许执行的function与参数 if data['type'] == 'function': # 在这里 前端会发送允许执行的function与参数
print("function_call", data['data']) print("function_call", data['data'])
@@ -117,11 +125,13 @@ class AgentNamespace(Namespace):
d['data'] = res.to_dict() d['data'] = res.to_dict()
print("function_call_res", d['data']) print("function_call_res", d['data'])
emit(d['route'], d, room=uuid, namespace='/agent') emit(d['route'], d, room=uuid, namespace='/agent')
chatmanager.chat_historys.append({'role': 'user', 'content': data['data']})
user_uuid2ase_client[uuid].send_text(d['route'], data['data']) user_uuid2ase_client[uuid].send_text(d['route'], data['data'])
def receive_ase_dialog(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data): def receive_ase_dialog(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data):
print("receive_ase_dialog", data) print("receive_ase_dialog", data)
client_entry.chatmanager.chat_historys.append({'role': 'assistant', 'content': data['data']})
namespace_entry.emit('message', data['data'], room=init_data['room'], namespace='/agent') namespace_entry.emit('message', data['data'], room=init_data['room'], namespace='/agent')
def receive_ase_judge(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data): def receive_ase_judge(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data):
@@ -132,6 +142,16 @@ class AgentNamespace(Namespace):
print("receive_ase_next_chapter", data) print("receive_ase_next_chapter", data)
namespace_entry.emit('request_function',data, room=init_data['room'], namespace='/agent') # data 是一个列表 /dict也支持 namespace_entry.emit('request_function',data, room=init_data['room'], namespace='/agent') # data 是一个列表 /dict也支持
def receive_ase_chapter_score(client_entry: HSAEngineClient, user_and_manager, data, init_data):
print("load_next_chapter")
user, chatmanager = user_and_manager
if len(chatmanager.scores) >= chatmanager.chapter_chain_now:
chatmanager.scores[chatmanager.chapter_chain_now - 1] = data.get('data', None)
else: chatmanager.scores.append(data.get('data', None))
user.set_course_progress(chatmanager.chat_historys, chatmanager.scores, chatmanager.material_id, chatmanager.chapter_name, chatmanager.lesson_name)
chatmanager.load_next_chapter()
def on_initiative(self,data): # 主动call def on_initiative(self,data): # 主动call
print("User active function call") print("User active function call")
ex = current_app.extensions ex = current_app.extensions

View File

@@ -22,7 +22,6 @@ function show_user_data(user_data, course_brief_data_list){
} }
} }
function openCourseProgress(courseId) { function openCourseProgress(courseId) {
console.log(courseId)
const course = courseData[courseId]; const course = courseData[courseId];
if (!course) return; if (!course) return;
fetch(`/dashboard/get_course_progress`, { fetch(`/dashboard/get_course_progress`, {
@@ -33,7 +32,7 @@ function openCourseProgress(courseId) {
body: JSON.stringify({course_id: courseId}) body: JSON.stringify({course_id: courseId})
}).then(response => response.json()) }).then(response => response.json())
.then(data => { .then(data => {
console.log(data) // console.log(data)
/* /*
course_last_study_date: "2025-09-06" course_last_study_date: "2025-09-06"
course_put_in_date: "2025-09-06" course_put_in_date: "2025-09-06"
@@ -75,31 +74,36 @@ function openCourseProgress(courseId) {
const subChapterItem = document.createElement('li');//课时层级 const subChapterItem = document.createElement('li');//课时层级
subChapterItem.classList.add('sub-chapter-item'); subChapterItem.classList.add('sub-chapter-item');
subChapterItem.textContent = subChapter.lesson_name; subChapterItem.textContent = subChapter.lesson_name;
console.log('-------------------')
console.log(course)
// 查找学生进度 // 查找学生进度
lesson_score_text_content = ""
for(let i = 0; i < course.lesson_processs.length; i++) { for(let i = 0; i < course.lesson_processs.length; i++) {
if (course.lesson_processs[i][2] == subChapter.lesson_name && course.lesson_processs[i][1] == chapter.chapter_name) {//确定lesson_id对应正确 if (course.lesson_processs[i][2] == subChapter.lesson_name && course.lesson_processs[i][1] == chapter.chapter_name) {//确定lesson_id对应正确
/////////////////////////////////////////// ///////////////////////////////////////////
//这里之后要做lesson的各个step的进度和得分 //这里之后要做lesson的各个step的进度和得分
//////////////////////////////////////////// ////////////////////////////////////////////
if (course.lesson_processs[i].length<=3){break;}
console.log('-------------------') for (let j =0; j< course.lesson_processs[i][3].length;j++){
console.log(course.lesson_processs[i][0]) if (isObject(course.lesson_processs[i][3][j]))course.lesson_processs[i][3][j]=course.lesson_processs[i][3][j]['data']
lesson_chapters_progress = course.lesson_processs[i][0];//寻找对应的每一个章节的进度 lesson_score_text_content+=course.lesson_processs[i][3][j]+';'
for (let j=0; j<lesson_chapters_progress.length;j++){
chapter_progress = lesson_chapters_progress[j]
if(chapter_progress.title == subChapter){
subChapterItem.textContent += ("(已"+(chapter_progress.is_rebuttal?"申辩" : "完成")+" 得分"+ (chapter_progress.is_rebuttal?chapter_progress.rebuttal_score : chapter_progress.score) +"");
}
}
if (course.lesson_processs[i][0].length === 1) {
subChapterItem.classList.add('completed');
} }
// console.log('-------------------')
// subChapterItem.textContent +=
// console.log(course.lesson_processs[i][0])
// lesson_chapters_progress = course.lesson_processs[i][0];//寻找对应的每一个章节的进度
// for (let j=0; j<lesson_chapters_progress.length;j++){
// chapter_progress = lesson_chapters_progress[j]
// if(chapter_progress.title == subChapter){
// subChapterItem.textContent += ("(已"+(chapter_progress.is_rebuttal?"申辩" : "完成")+" 得分"+ (chapter_progress.is_rebuttal?chapter_progress.rebuttal_score : chapter_progress.score) +"");
// }
// }
// if (course.lesson_processs[i][0].length === 1) {
// subChapterItem.classList.add('completed');
// }
break; break;
} }
} }
if (lesson_score_text_content!=""){lesson_score_text_content = ' ('+lesson_score_text_content+')'}
subChapterItem.textContent+=lesson_score_text_content
// 添加点击事件跳转到学习页面 // 添加点击事件跳转到学习页面
subChapterItem.addEventListener('click', () => { subChapterItem.addEventListener('click', () => {
const courseId = encodeURIComponent(course._id); // 对课程名称进行编码 const courseId = encodeURIComponent(course._id); // 对课程名称进行编码
@@ -136,3 +140,7 @@ function closeCourseProgress() {
// 关闭滑出卡片 // 关闭滑出卡片
document.getElementById('courseProgress').classList.remove('open'); document.getElementById('courseProgress').classList.remove('open');
} }
function isObject(value) {
return Object.prototype.toString.call(value) === '[object Object]';
}

View File

@@ -71,7 +71,11 @@ class Chapter():
def Focus(self): def Focus(self):
self.focus = 1 self.focus = 1
def load_chapters(markdown, markdown_prompt, score_prompt): def load_chapters(markdown, markdown_prompt, score_prompt):
'''
将教案蓝图化解为多个章节Chapter对象
'''
markdown_list = markdown.split("\n") markdown_list = markdown.split("\n")
markdown_prompt_list = markdown_prompt.split("\n") markdown_prompt_list = markdown_prompt.split("\n")
score_prompt_list = score_prompt.split("\n") score_prompt_list = score_prompt.split("\n")

View File

@@ -61,7 +61,7 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name):
chatmanager = ChatManager() chatmanager = ChatManager()
current_app.extensions["user_uuid2chatmanager"][user_uuid] = chatmanager current_app.extensions["user_uuid2chatmanager"][user_uuid] = chatmanager
code_server_port = 10000 + int(uuid.uuid4().int % 10000) code_server_port = 10000 + int(uuid.uuid4().int % 10000)
chatmanager.start_code_server(user_uuid, user_id, path_dir, code_server_port) # chatmanager.start_code_server(user_uuid, user_id, path_dir, code_server_port)

View File

@@ -73,7 +73,7 @@ class BackBoardManager:
self.backboards[user_uuid] = Backboard(user_uuid,username, course_id, lesson_id, root_path) self.backboards[user_uuid] = Backboard(user_uuid,username, course_id, lesson_id, root_path)
def get_backboard(self, user_uuid) -> Backboard: def get_backboard(self, user_uuid) -> Backboard:
return self.backboards[user_uuid] return self.backboards.get(user_uuid, None)