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

View File

@@ -32,7 +32,7 @@ class ChatManager:
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.ase_client = ase_client
self.app = app
@@ -41,9 +41,13 @@ class ChatManager:
self.raw_markdown = raw_markdown
self.raw_markdown_prompts = raw_markdown_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.function_manager = FunctionManager()
self.bb = None
self.chat_historys = []
def disconnect(self, uuid):
try:
@@ -58,12 +62,16 @@ class ChatManager:
assert self.chapter_chain_now + 1 < len(self.chapter_chain), "chapter_chain_now out of range"
self.chapter_chain_now += 1
self.focus_chapter(self.chapter_chain_now)
def focus_chapter(self, chapter_index):
assert chapter_index < len(self.chapter_chain), "chapter_index out of range"
self.chapter_chain_now = chapter_index
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):
self.ase_client.send_text('backboard-in', self.bb.get_info_prompt())