feat: 添加YAML智能解析支持

This commit is contained in:
imeepos 2025-07-21 18:35:35 +08:00
parent a8ed7ed007
commit 8dfdf36a47
3 changed files with 22 additions and 0 deletions

20
Cargo.lock generated
View File

@ -2317,6 +2317,7 @@ dependencies = [
"rusqlite",
"serde",
"serde_json",
"serde_yaml",
"tauri",
"tauri-build",
"tauri-plugin-dialog",
@ -3820,6 +3821,19 @@ dependencies = [
"syn 2.0.104",
]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap 2.10.0",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "serialize-to-javascript"
version = "0.1.1"
@ -4957,6 +4971,12 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
name = "url"
version = "2.5.4"

View File

@ -46,6 +46,7 @@ const JsonParserTool: React.FC = () => {
<li> JSON数据</li>
<li> Tree-sitter解析器</li>
<li> </li>
<li> JSON字符串字段中的YAML内容</li>
<li> </li>
<li> </li>
</ul>

View File

@ -170,6 +170,7 @@ export class TolerantJsonService {
static getStrategyDescriptions(): Record<string, string> {
return {
'StandardJson': '标准JSON解析 - 使用原生JSON.parse()',
'YamlStringParsing': 'YAML智能解析 - 自动识别并解析字符串中的YAML内容',
'ManualFix': '手动修复 - 自动修复常见格式错误',
'RegexExtract': '正则提取 - 使用正则表达式提取JSON片段',
'PartialParse': '部分解析 - 尝试解析部分有效的JSON内容'