mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-10 03:09:50 +08:00
fix(gateway): support claude_code cross-format Claude messages
This commit is contained in:
@@ -1530,7 +1530,7 @@ async function deleteApiKey() {
|
||||
|
||||
async function toggleApiKey(apiKey: ApiKey) {
|
||||
try {
|
||||
const updated = await meApi.toggleApiKey(apiKey.id)
|
||||
const updated = await meApi.toggleApiKey(apiKey.id, !apiKey.is_active)
|
||||
const index = apiKeys.value.findIndex(k => k.id === apiKey.id)
|
||||
if (index !== -1) {
|
||||
apiKeys.value[index].is_active = updated.is_active
|
||||
|
||||
@@ -224,4 +224,19 @@ describe('MyApiKeys CC Switch import', () => {
|
||||
expect(meApiMock.getFullApiKey).not.toHaveBeenCalled()
|
||||
expect(document.body.textContent).toContain('导入到 CC Switch')
|
||||
})
|
||||
|
||||
it('sends the desired inactive state when disabling an active key', async () => {
|
||||
meApiMock.getApiKeys.mockResolvedValue([apiKey()])
|
||||
meApiMock.toggleApiKey.mockResolvedValue({
|
||||
id: 'user-key-1',
|
||||
is_active: false,
|
||||
})
|
||||
|
||||
await mountMyApiKeys()
|
||||
document.querySelector<HTMLButtonElement>('[title="禁用"]')?.click()
|
||||
await flushPromises()
|
||||
|
||||
expect(meApiMock.toggleApiKey).toHaveBeenCalledWith('user-key-1', false)
|
||||
expect(toastMock.success).toHaveBeenCalledWith('密钥已禁用')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user