'commit'
This commit is contained in:
@@ -70,18 +70,17 @@ async def generate_dao_xue_an(request: Request):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
yield "data: 正在转换为Word文档...\n\n"
|
yield "data: 正在转换为Word文档...\n\n"
|
||||||
# 执行Pandoc命令
|
# 恢复Pandoc转换执行代码
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["pandoc", temp_md_path, "-o", docx_path],
|
["pandoc", temp_md_path, "-o", docx_path],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
check=True
|
check=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# 清理临时文件
|
# 清理临时文件
|
||||||
os.unlink(temp_md_path)
|
os.unlink(temp_md_path)
|
||||||
|
# 添加转换完成状态提示
|
||||||
logger.info(f"导学案已转换为Word文档: {docx_path}")
|
yield "data: Word文档转换完成,准备下载...\n\n"
|
||||||
# 修改下载链接为静态文件路径
|
# 修改下载链接为静态文件路径
|
||||||
yield f"data: [下载链接] /static/teacherHelpergenerated_files/{docx_filename}\n\n"
|
yield f"data: [下载链接] /static/teacherHelpergenerated_files/{docx_filename}\n\n"
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
Binary file not shown.
@@ -40,11 +40,15 @@ class LLMClient:
|
|||||||
if chunk and chunk.choices and len(chunk.choices) > 0:
|
if chunk and chunk.choices and len(chunk.choices) > 0:
|
||||||
delta = chunk.choices[0].delta
|
delta = chunk.choices[0].delta
|
||||||
if delta and delta.content and delta.content.strip():
|
if delta and delta.content and delta.content.strip():
|
||||||
|
# 添加控制台打印输出
|
||||||
|
print(f"[LLM Stream] 接收到内容片段: {delta.content.strip()}")
|
||||||
yield delta.content
|
yield delta.content
|
||||||
else:
|
else:
|
||||||
if completion and completion.choices and len(completion.choices) > 0:
|
if completion and completion.choices and len(completion.choices) > 0:
|
||||||
message = completion.choices[0].message
|
message = completion.choices[0].message
|
||||||
if message and message.content and message.content.strip():
|
if message and message.content and message.content.strip():
|
||||||
|
# 添加控制台打印输出
|
||||||
|
print(f"[LLM Response] 接收到完整内容: {message.content.strip()[:100]}...") # 仅打印前100字符
|
||||||
yield message.content
|
yield message.content
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user