文件
fenleixinxi/tmp_img/fix_prompts.ps1
MiAn 133d425ec0 feat: 新增阿里云OSS适配器及分类图标优化
- 新增阿里云OSS SDK核心类库文件
- 新增OSS插件配置文件及钩子监听
- 新增分类图标SVG资源并优化为轻量化格式
- 替换定位接口为天地图逆地理编码接口
- 新增OSS图片缩略处理工具方法
2026-11-20 11:11:03 +08:00

85 行
2.7 KiB
PowerShell

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

# 中文食材名 -> 英文映射
$zh2en = @{
'西葫芦' = 'zucchini'
'螺丝椒' = 'Sichuan chili peppers'
'小米椒' = "bird's eye chili peppers"
'白萝卜' = 'white radishes'
'青萝卜' = 'green radishes'
'毛豆' = 'green soybeans'
'黄豆芽' = 'yellow bean sprouts'
'绿豆芽' = 'mung bean sprouts'
'豆腐' = 'tofu'
'豆皮' = 'tofu skin'
'腐竹' = 'dried tofu sticks'
'豆腐干' = 'dried tofu'
'豆腐脑' = 'soft tofu'
'豆芽菜' = 'bean sprouts'
'扁豆' = 'lentils'
'豇豆' = 'yardlong beans'
'蚕豆' = 'fava beans'
'豌豆' = 'peas'
'芸豆' = 'kidney beans'
'刀豆' = 'sword beans'
'韭菜' = 'chives'
'蒜苗' = 'garlic sprouts'
'大葱' = 'green onions'
'洋葱' = 'onions'
'紫洋葱' = 'red onions'
'甜蒜' = 'sweet garlic'
'黄蘑' = 'yellow mushrooms'
'榛蘑' = 'hazel mushrooms'
'松蘑' = 'pine mushrooms'
'竹荪' = 'bamboo fungus'
'姬松茸' = 'almond mushrooms'
'杏鲍菇' = 'king oyster mushrooms'
'茶树菇' = 'tea tree mushrooms'
'双孢菇' = 'button mushrooms'
'猴头菇' = 'lion mane mushrooms'
'羊肚菌' = 'morel mushrooms'
'牛肝菌' = 'porcini mushrooms'
'黑胡椒' = 'black pepper'
'白胡椒' = 'white pepper'
'八角' = 'star anise'
'花椒' = 'Sichuan peppercorns'
'桂皮' = 'cinnamon'
'丁香' = 'cloves'
'肉豆蔻' = 'nutmeg'
'香茅' = 'lemongrass'
'罗勒' = 'basil'
'薄荷' = 'mint'
'紫苏' = 'perilla leaves'
'柠檬草' = 'citronella'
'小米椒' = 'bird chili peppers'
}
$items = Get-Content 'D:\Softwares\phpstudy_pro\WWW\fenleixinxi\tmp_img\mcp_items.json' -Raw | ConvertFrom-Json
$updated = @()
foreach ($item in $items) {
$newPrompt = $item.prompt
$changed = $false
foreach ($zh in $zh2en.Keys) {
if ($newPrompt -match [regex]::Escape($zh)) {
$en = $zh2en[$zh]
# 替换单数/复数形式:fresh X -> fresh Y / X farm -> Y farm / X plants -> Y plants
$newPrompt = $newPrompt -replace [regex]::Escape($zh), $en
$changed = $true
}
}
if ($changed) {
Write-Host "UPDATED $($item.id) $($item.name): replaced zh words"
}
$item.prompt = $newPrompt
$updated += $item
}
$updated | ConvertTo-Json -Depth 3 | Set-Content 'D:\Softwares\phpstudy_pro\WWW\fenleixinxi\tmp_img\mcp_items.json'
Write-Host "Done. Saved $($updated.Count) updated items."
# 找出还剩哪些有中文没被替换
Write-Host ""
Write-Host "=== Remaining Chinese characters in prompts ==="
foreach ($item in $updated) {
if ($item.prompt -match '[一-龥]') {
Write-Host "ID $($item.id) name=$($item.name) PROMPT: $($item.prompt)"
}
}