feat: 适配新版本gemini

This commit is contained in:
shaw
2025-10-14 11:24:27 +08:00
parent 46ba514801
commit d6a9beff2f
4 changed files with 84 additions and 23 deletions

View File

@@ -9,11 +9,10 @@ const crypto = require('crypto')
// 生成会话哈希
function generateSessionHash(req) {
const sessionData = [
req.headers['user-agent'],
req.ip,
req.headers['authorization']?.substring(0, 20)
]
const authSource =
req.headers['authorization'] || req.headers['x-api-key'] || req.headers['x-goog-api-key']
const sessionData = [req.headers['user-agent'], req.ip, authSource?.substring(0, 20)]
.filter(Boolean)
.join(':')