fix: allow dry_run mode without API key for prompt preview
This commit is contained in:
@@ -205,9 +205,6 @@ def generate_ai_report(
|
|||||||
if not prompt_template:
|
if not prompt_template:
|
||||||
prompt_template = config.get("prompt_template", "")
|
prompt_template = config.get("prompt_template", "")
|
||||||
|
|
||||||
if not api_key:
|
|
||||||
return None, None, "未配置API Key,请在设置页面配置", None
|
|
||||||
|
|
||||||
# 从问题文件内容中提取关键信息
|
# 从问题文件内容中提取关键信息
|
||||||
def extract_problem_info(content_str):
|
def extract_problem_info(content_str):
|
||||||
if not content_str or not isinstance(content_str, str):
|
if not content_str or not isinstance(content_str, str):
|
||||||
@@ -310,6 +307,10 @@ def generate_ai_report(
|
|||||||
"student_goals_length": len(student_goals_text),
|
"student_goals_length": len(student_goals_text),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# API调用需要 Key
|
||||||
|
if not api_key:
|
||||||
|
return None, None, "未配置API Key,请在设置页面配置", None
|
||||||
|
|
||||||
# 调用API
|
# 调用API
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": f"Bearer {api_key}",
|
"Authorization": f"Bearer {api_key}",
|
||||||
|
|||||||
Reference in New Issue
Block a user