HyeonseoNam / auto-classifier

Auto classification plugin for Obsidian using ChatGPT.
MIT License
81 stars 9 forks source link

Modify regex to match json that includes newlines. #21

Closed gravityfargo closed 4 months ago

gravityfargo commented 4 months ago

This fixes issue #20

What seems to happen is that some queries return a single line, which causes no issues.

plugin:auto-classifier:587 {"reliability": 0.8, "output": "journal"}

Other times, it returns the same content but in a JSON format to include newline characters.

plugin:auto-classifier:587 {
"reliability": 0.9,
"output": "linux"
}

The raw response comes in the form of a (multi-line) string and not proper JSON. The existing regex does not allow for the newline characters, which is what I changed.

HyeonseoNam commented 4 months ago

Hello @gravityfargo, I am deeply thankful for your PR, which notably is the first for this plugin.

The modification you've made to the regex not only addresses issue #20 but also seems to resolve several unknown errors.

Your PR has been approved. Thank you for your contribution!

Best, Hyeonseo.