mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
fix: 修复 API Key 创建和编辑时账户绑定冲突问题
- 创建 API Key 时确保 OAuth 和 Console 账户不会同时设置 - 编辑 API Key 时正确清空未使用的账户类型字段 - 使用共享池时清空所有账户绑定 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -878,9 +878,13 @@ const createApiKey = async () => {
|
|||||||
if (form.claudeAccountId.startsWith('console:')) {
|
if (form.claudeAccountId.startsWith('console:')) {
|
||||||
// Claude Console账户
|
// Claude Console账户
|
||||||
baseData.claudeConsoleAccountId = form.claudeAccountId.substring(8);
|
baseData.claudeConsoleAccountId = form.claudeAccountId.substring(8);
|
||||||
|
// 确保不会同时设置OAuth账号
|
||||||
|
delete baseData.claudeAccountId;
|
||||||
} else {
|
} else {
|
||||||
// Claude OAuth账户
|
// Claude OAuth账户或分组
|
||||||
baseData.claudeAccountId = form.claudeAccountId;
|
baseData.claudeAccountId = form.claudeAccountId;
|
||||||
|
// 确保不会同时设置Console账号
|
||||||
|
delete baseData.claudeConsoleAccountId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -627,15 +627,20 @@ const updateApiKey = async () => {
|
|||||||
if (form.claudeAccountId.startsWith('console:')) {
|
if (form.claudeAccountId.startsWith('console:')) {
|
||||||
// Claude Console账户
|
// Claude Console账户
|
||||||
data.claudeConsoleAccountId = form.claudeAccountId.substring(8);
|
data.claudeConsoleAccountId = form.claudeAccountId.substring(8);
|
||||||
|
data.claudeAccountId = null; // 清空OAuth账号
|
||||||
} else if (!form.claudeAccountId.startsWith('group:')) {
|
} else if (!form.claudeAccountId.startsWith('group:')) {
|
||||||
// Claude OAuth账户(非分组)
|
// Claude OAuth账户(非分组)
|
||||||
data.claudeAccountId = form.claudeAccountId;
|
data.claudeAccountId = form.claudeAccountId;
|
||||||
|
data.claudeConsoleAccountId = null; // 清空Console账号
|
||||||
} else {
|
} else {
|
||||||
// 分组
|
// 分组
|
||||||
data.claudeAccountId = form.claudeAccountId;
|
data.claudeAccountId = form.claudeAccountId;
|
||||||
|
data.claudeConsoleAccountId = null; // 清空Console账号
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 使用共享池,清空所有绑定
|
||||||
data.claudeAccountId = null;
|
data.claudeAccountId = null;
|
||||||
|
data.claudeConsoleAccountId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gemini账户绑定
|
// Gemini账户绑定
|
||||||
|
|||||||
Reference in New Issue
Block a user