mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-04-18 17:07:28 +00:00
fix: 移除 1M 上下文的账户类型限制,信任 admin 的 allow1mContext 授权
部分 Claude 订阅类型(Pro/Team/Enterprise)原生支持 1M 上下文, 之前的实现仅允许 Bedrock 账户类型通过,过于保守。 现在当 admin 为 API Key 启用 allow1mContext 后,任何账户类型 (claude-official、claude-console、bedrock)均可使用 1M 上下文。
This commit is contained in:
@@ -389,14 +389,11 @@ async function handleMessagesRequest(req, res) {
|
||||
throw error
|
||||
}
|
||||
|
||||
// 1M 上下文窗口:检查调度到的账户类型是否支持
|
||||
if (is1mContextRequest && accountType !== 'bedrock') {
|
||||
return res.status(403).json({
|
||||
error: {
|
||||
type: 'forbidden',
|
||||
message: `1M 上下文窗口仅支持 Bedrock 账户类型,当前调度到 ${accountType},请绑定 Bedrock 账户`
|
||||
}
|
||||
})
|
||||
// 1M 上下文窗口:记录日志(admin 已通过 allow1mContext 授权,信任其决定)
|
||||
if (is1mContextRequest) {
|
||||
logger.api(
|
||||
`📐 1M context request allowed for key: ${req.apiKey.name}, accountType: ${accountType}`
|
||||
)
|
||||
}
|
||||
|
||||
// 🔗 在成功调度后建立会话绑定(仅 claude-official 类型)
|
||||
|
||||
Reference in New Issue
Block a user