diff --git a/dsAiTeachingModel/api/controller/TeachingModelController.py b/dsAiTeachingModel/api/controller/TeachingModelController.py index ec7ec3fb..ac84ca29 100644 --- a/dsAiTeachingModel/api/controller/TeachingModelController.py +++ b/dsAiTeachingModel/api/controller/TeachingModelController.py @@ -77,4 +77,39 @@ async def get_question(request: Request): select_question_sql: str = f"SELECT * FROM t_ai_teaching_model_question WHERE is_deleted = 0 and bureau_id = '{bureau_id}' AND theme_id = {theme_id} AND question_type = {question_type} {person_sql}" print(select_question_sql) page = await get_page_data_by_sql(select_question_sql, page_number, page_size) - return {"success": True, "message": "查询成功!", "data": page} \ No newline at end of file + return {"success": True, "message": "查询成功!", "data": page} + + + +# 【TeachingModel-5】提问 +@router.post("/sendQuestion") +async def send_question(request: Request): + # 获取参数 + bureau_id = await get_request_str_param(request, "bureau_id", True, True) + person_id = await get_request_str_param(request, "person_id", True, True) + theme_id = await get_request_num_param(request, "theme_id", True, True, None) + question = await get_request_str_param(request, "question_type", True, True) + + theme_object = await find_by_id("t_ai_teaching_model_theme", "id", theme_id) + if theme_object is None: + return {"success": False, "message": "主题不存在!"} + + # 保存个人历史问题 + param = {} + param["stage_id"] = int(theme_object["stage_id"]) + param["subject_id"] = int(theme_object["subject_id"]) + param["theme_id"] = theme_id + param["question"] = question + param["question_type"] = 2 + param["question_person_id"] = person_id + param["person_id"] = person_id + param["bureau_id"] = bureau_id + question_id = await insert("t_ai_teaching_model_question", param) + + # 处理theme的调用次数 + + + + # 向rag提问 + +