# 中文食材名 -> 英文映射 $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)" } }