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

59 行
1.9 KiB
PowerShell

# 调试 JSON 读取
$raw = Get-Content 'D:\Softwares\phpstudy_pro\WWW\fenleixinxi\tmp_img\prompt_map.json' -Raw -Encoding UTF8
Write-Host "Raw length: $($raw.Length)"
Write-Host "First 100 chars: $($raw.Substring(0, [Math]::Min(100, $raw.Length)))"
try {
$json = $raw | ConvertFrom-Json
Write-Host "Parsed count: $($json.Count)"
} catch {
Write-Host "ConvertFrom-Json failed: $_"
}
# 手动解析
$items = @()
$current = $null
$inPrompt = $false
$sb = New-Object System.Text.StringBuilder
$lines = Get-Content 'D:\Softwares\phpstudy_pro\WWW\fenleixinxi\tmp_img\prompt_map.json' -Encoding UTF8
Write-Host "Line count: $($lines.Count)"
foreach ($line in $lines) {
# 简单的 regex 匹配
if ($line -match '"id"\s*:\s*"(\d+)"') {
if ($current) { $items += $current }
$current = [PSCustomObject]@{ id = $Matches[1]; name = ''; kind = ''; path = ''; prompt = '' }
}
if ($current -and $line -match '"name"\s*:\s*"([^"]*)"') {
$current.name = $Matches[1]
}
if ($current -and $line -match '"kind"\s*:\s*"([^"]*)"') {
$current.kind = $Matches[1]
}
if ($current -and $line -match '"path"\s*:\s*"([^"]*)"') {
$current.path = $Matches[1] -replace '\\/', '/'
}
if ($current -and $line -match '"prompt"\s*:\s*"(.*)') {
$current.prompt = $Matches[1] -replace '"\s*,?\s*$', ''
}
}
if ($current) { $items += $current }
Write-Host "Regex-parsed count: $($items.Count)"
# 转换 path
$mcpItems = foreach ($item in $items) {
$mcpPath = $item.path -replace '\\', '/'
$mcpPath = $mcpPath -replace '\.jpg$', ''
[PSCustomObject]@{
id = $item.id
name = $item.name
mcp_path = $mcpPath
prompt = $item.prompt
}
}
$mcpItems | ConvertTo-Json -Depth 3 | Set-Content 'D:\Softwares\phpstudy_pro\WWW\fenleixinxi\tmp_img\mcp_items.json'
Write-Host "Saved $($mcpItems.Count) items to mcp_items.json"