From 341e88b6c56a8ea42463dcd42839bba7a430b740 Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Thu, 10 Jul 2025 08:42:49 +0800 Subject: [PATCH] 'commit' --- dsRagAnything/Test/Ocr/T2_FanYi.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dsRagAnything/Test/Ocr/T2_FanYi.py b/dsRagAnything/Test/Ocr/T2_FanYi.py index 2123f88e..a1776f5c 100644 --- a/dsRagAnything/Test/Ocr/T2_FanYi.py +++ b/dsRagAnything/Test/Ocr/T2_FanYi.py @@ -7,16 +7,20 @@ try: api_key='sk-f6da0c787eff4b0389e4ad03a35a911f', base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", ) + # 读取md文件内容 + with open("2、识别出结果.md", "r", encoding="utf-8") as f: + text = f.read() completion = client.chat.completions.create( # 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models model="qwen-plus", messages=[ {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": "你是谁?"}, + {"role": "user", + "content": "我将提供一份markdown格式的试卷,帮我整理出每道题的题目序号,内容,答案,解析,并最终输出一共整理了多少道题。内容如下:" + text}, ], ) print(completion.choices[0].message.content) except Exception as e: print(f"错误信息:{e}") - print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code") \ No newline at end of file + print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")