FRIDAY
FRIDAY copied to clipboard
[BUG]: No JSON data found in the string. 疑为正则表达式错误
Describe the bug 执行
python course_learning.py --software_name Excel --package_name openpyxl --demo_file_path working_dir/Invoices.xlsx
后出现:
No JSON data found in the string.
并终止。我怀疑这是意外终止。run_GAIA.py也受到了影响!
Screenshots and Logs
Additional context Add any other context about the problem here.
- OS: Fedora 42 Workstation
- OS-Copilot Version 最新
- Python Version 3.10.18 .env文件中使用OpenAI,相关信息如下:
MODEL_NAME="gpt-4o-mini"
MODEL_TYPE="OpenAI" # if use the gpt series (OpenAI), lamma series (LLAMA)
OPENAI_BASE_URL="https://api.yourapi.cn/v1"
因为我没有国外信用卡,所以用了个能用微信和支付宝支付的API网站。
但请注意模型名称不是绝对的。因为run_GAIA.py用的是gpt4-turbo也出现了这种情况!
经检查,怀疑是正则表达式有错,位于oscopilot/modules/base_module.py第66行。截图中的JSON没有语法错误,复制如下:
{
"load_excel_file": {
"description": "Load the Excel file located at '/home/huang/OS-Copilot/working_dir/Invoices.xlsx' to access its contents.",
"dependencies": [],
"type": "Python"
},
"read_invoice_data": {
"description": "Read all the contents of 'Sheet1' from the loaded Excel file and return the contents as a list of rows, where each row contains the data from the respective row in the sheet.",
"dependencies": ["load_excel_file"],
"type": "Python"
}
}
程序在无法通过正则表达式提取JSON时使用了sys.exit终止了。
8月6日补充:
请注意,在最后一个右大括号后面有若干个空格!!
目前的trick是:用oscopilot/agents/base_agent.py第65行的语句替换掉oscopilot/modules/base_module.py第66行。没细究。希望是正确的。