Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 部分设置选项无法保存修改 #379

Closed
4 tasks done
CL4R3T opened this issue Nov 21, 2024 · 5 comments
Closed
4 tasks done

[Bug]: 部分设置选项无法保存修改 #379

CL4R3T opened this issue Nov 21, 2024 · 5 comments
Labels
bug / 缺陷 Something isn't working

Comments

@CL4R3T
Copy link
Contributor

CL4R3T commented Nov 21, 2024

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我已经使用一个干净且无其它非必要的插件的环境测试过,问题依旧存在。
  • 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
  • 我已知晓并同意,若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭/锁定。
  • 我已知晓并同意,如果我不按照模板提供的指示进行填写,则我的 Issue 可能会被无条件删除。

March7thAssistant 版本 (或 Commit Id)

bd74325

重现步骤

  1. 下载此版本并运行
  2. 打开 "设置-体力", 点击 "副本名称" 的 "修改" 按钮, 随意修改其中的值并点击 "确认"
  3. 打开 "设置-推送", 点击 "消息推送格式" 的 "修改" 按钮, 随意修改其中的值并点击 "确认"

期望的结果是什么?

config.yaml 与程序界面中均立即显示修改后结果

实际的结果是什么?

config.yaml 与程序界面都没有任何变化, 说明这些修改没有被保存.

日志记录

貌似修改config不会在日志中记录. 这是我的 2024-11-21.log 的内容

2024-11-21 16:49:46,734 | WARNING | OCR 路径不存在: .\3rdparty\PaddleOCR-json_v.1.3.1\PaddleOCR-json.exe
2024-11-21 16:49:46,782 | INFO | 开始下载: https://github.kotori.top/https://github.com/hiroi-sora/PaddleOCR-json/releases/download/v1.3.1/PaddleOCR-json_v.1.3.1.7z
2024-11-21 16:50:12,280 | INFO | 下载完成: D:\March7thAssistant\temp\PaddleOCR-json_v.1.3.1.7z
2024-11-21 16:50:16,458 | INFO | 解压完成: D:\March7thAssistant\temp\PaddleOCR-json_v.1.3.1
2024-11-21 16:50:16,771 | INFO | 覆盖完成: .\3rdparty\PaddleOCR-json_v.1.3.1
2024-11-21 16:50:16,787 | INFO | 清理完成: D:\March7thAssistant\temp\PaddleOCR-json_v.1.3.1.7z
2024-11-21 16:50:22,236 | INFO | 清理完成: D:\March7thAssistant\temp\PaddleOCR-json_v.1.3.1
2024-11-21 17:00:59,725 | DEBUG | CPU 支持 AVX2 指令集,使用 PaddleOCR-json

补充说明(可选)

除了此 issue 中提到的两个设置无法保存修改之外, 其余所有设置均能正常保存修改.

@CL4R3T CL4R3T added the bug / 缺陷 Something isn't working label Nov 21, 2024
@CL4R3T
Copy link
Contributor Author

CL4R3T commented Nov 21, 2024

个人怀疑是 module/config/config.pydef set_value(self, key, value) 的问题:
目前调试发现:

    def set_value(self, key, value):
        """设置配置项的值并保存"""
        self._load_config()
        self.config[key] = value
        self.save_config()

当运行完 self._load_config() 后, value 会被覆盖为修改之前的值, 也就是load完之后的 self.config[key] 的值, 使得修改无法保存.
所有使用字典类型传入的 value 都会出现这种情况, 如果不是字典类型就不会产生bug.
我目前没想明白为什么.

@CL4R3T
Copy link
Contributor Author

CL4R3T commented Nov 21, 2024

我认为应该是 01c0502 这个commit导致的, 但是我没想明白为什么load之后会直接覆盖掉这个value

CL4R3T added a commit to CL4R3T/March7thAssistant that referenced this issue Nov 21, 2024
@CL4R3T CL4R3T mentioned this issue Nov 21, 2024
@CL4R3T
Copy link
Contributor Author

CL4R3T commented Nov 21, 2024

看看这个pr #380, 理论上应该修复了这个bug.
不过我觉得这样做只是暂时性的, 没想到更好的解决方案.

@CL4R3T
Copy link
Contributor Author

CL4R3T commented Nov 21, 2024

先close了, 如果pr没通过就再open吧

@CL4R3T CL4R3T closed this as completed Nov 21, 2024
moesnow added a commit that referenced this issue Nov 21, 2024
@moesnow
Copy link
Owner

moesnow commented Nov 21, 2024

感谢PR,我在 config.py 里修复了,感觉这样更彻底一点。

6f54b3f

CL4R3T added a commit to CL4R3T/March7thAssistant that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / 缺陷 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants