'commit'
This commit is contained in:
@@ -81,7 +81,7 @@ async def save(request: Request):
|
|||||||
bureau_id = await get_request_str_param(request, "bureau_id", True, True)
|
bureau_id = await get_request_str_param(request, "bureau_id", True, True)
|
||||||
|
|
||||||
# 校验参数
|
# 校验参数
|
||||||
check_theme_sql = f"SELECT theme_name FROM t_ai_teaching_model_theme WHERE is_deleted = 0 and stage_id = {stage_id} and subject_id = {subject_id} and bureau_id = '{bureau_id}' and theme_name = '{theme_name}'"
|
check_theme_sql = "SELECT theme_name FROM t_ai_teaching_model_theme WHERE is_deleted = 0 and bureau_id = '" + bureau_id + "' and theme_name = '" + theme_name + "'"
|
||||||
if id != 0:
|
if id != 0:
|
||||||
check_theme_sql += " and id <> " + str(id)
|
check_theme_sql += " and id <> " + str(id)
|
||||||
print(check_theme_sql)
|
print(check_theme_sql)
|
||||||
@@ -138,11 +138,6 @@ async def get(request: Request):
|
|||||||
async def delete(request: Request):
|
async def delete(request: Request):
|
||||||
# 获取参数
|
# 获取参数
|
||||||
id = await get_request_num_param(request, "id", True, True, None)
|
id = await get_request_num_param(request, "id", True, True, None)
|
||||||
# 查询该主题下是否存在有效文档
|
|
||||||
check_document_sql: str = f"SELECT id FROM t_ai_teaching_model_document WHERE is_deleted = 0 and theme_id = {id}"
|
|
||||||
check_document_result = await find_by_sql(check_document_sql,())
|
|
||||||
if check_document_result is not None:
|
|
||||||
return {"success": False, "message": "该主题下存在有效文档,不能删除!"}
|
|
||||||
result = await delete_by_id("t_ai_teaching_model_theme", "id", id)
|
result = await delete_by_id("t_ai_teaching_model_theme", "id", id)
|
||||||
if not result:
|
if not result:
|
||||||
return {"success": False, "message": "删除失败!"}
|
return {"success": False, "message": "删除失败!"}
|
||||||
|
@@ -34,9 +34,7 @@ async def train_document_task():
|
|||||||
print(datetime.datetime.now(), "存在未训练的文档" + str(len(no_train_document_result))+"个")
|
print(datetime.datetime.now(), "存在未训练的文档" + str(len(no_train_document_result))+"个")
|
||||||
# 这里可以根据train_flag的值来判断是训练还是删除
|
# 这里可以根据train_flag的值来判断是训练还是删除
|
||||||
document = no_train_document_result[0]
|
document = no_train_document_result[0]
|
||||||
select_theme_sql: str = f"select * from t_ai_teaching_model_theme where id = {document['theme_id']}"
|
theme = await find_by_id("t_ai_teaching_model_theme", "id", document["theme_id"])
|
||||||
select_theme_result = await find_by_sql(select_theme_sql, ())
|
|
||||||
theme = select_theme_result[0] if select_theme_result else None
|
|
||||||
document_name = document["document_name"] + "." + document["document_suffix"]
|
document_name = document["document_name"] + "." + document["document_suffix"]
|
||||||
working_dir = "Topic/" + theme["short_name"]
|
working_dir = "Topic/" + theme["short_name"]
|
||||||
document_path = document["document_path"]
|
document_path = document["document_path"]
|
||||||
|
Reference in New Issue
Block a user