refactor: 重构禅音工具路径与配置,新增私人剪贴板技能
这是一次大型重构和功能新增: 1. 将原 zen_box 工具重命名为 web_zen_box,调整所有相关路径与配置 2. 新增 web_order_box 原生Web应用的完整资源与部署脚本 3. 新增私人剪贴板后端技能与配套测试脚本 4. 修复订单盒子APP的API地址配置,避免路径重复拼接 5. 新增本地开发跨域白名单支持localhost 6. 清理旧版zen_box的冗余文件
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// 测试速率限制
|
||||
const http = require('http')
|
||||
const API = 'http://localhost:8976/api/v1/ingest/private_clipboard'
|
||||
|
||||
function post(path, body) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = JSON.stringify(body)
|
||||
const req = http.request(`${API}${path}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-API-Id': 'private_clipboard',
|
||||
'X-API-Key': 'pcb_nuS0qf-W63qcvAPsrG5ePA',
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'Content-Length': Buffer.byteLength(data)
|
||||
}
|
||||
}, (res) => {
|
||||
let b = ''
|
||||
res.on('data', d => b += d)
|
||||
res.on('end', () => resolve({ status: res.statusCode, body: b }))
|
||||
})
|
||||
req.on('error', reject)
|
||||
req.write(data)
|
||||
req.end()
|
||||
})
|
||||
}
|
||||
|
||||
async function run() {
|
||||
console.log('开始发送 65 次请求...')
|
||||
let limited = false
|
||||
for (let i = 1; i <= 65; i++) {
|
||||
const r = await post('/text', { text: `ratelimit-${i}` })
|
||||
if (r.status === 429) {
|
||||
console.log(`第 ${i} 次请求被限制 (429)`)
|
||||
console.log(`响应: ${r.body}`)
|
||||
limited = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!limited) console.log('❌ 65 次请求全部通过,速率限制未生效')
|
||||
else console.log('✅ 速率限制生效')
|
||||
}
|
||||
|
||||
run()
|
||||
Reference in New Issue
Block a user