mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-11 11:49:50 +08:00
fix(models): keep manual creation available on catalog failure
This commit is contained in:
@@ -63,6 +63,16 @@
|
|||||||
<RefreshCw class="h-3.5 w-3.5" />
|
<RefreshCw class="h-3.5 w-3.5" />
|
||||||
重试
|
重试
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
class="h-8"
|
||||||
|
data-testid="models-catalog-manual-entry"
|
||||||
|
@click="enterManualEntryMode"
|
||||||
|
>
|
||||||
|
直接手动填写
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<!-- 提供商 Logo 横向选择 -->
|
<!-- 提供商 Logo 横向选择 -->
|
||||||
|
|||||||
+23
@@ -279,6 +279,29 @@ describe('GlobalModelFormDialog preset replacement', () => {
|
|||||||
expect(document.body.textContent).toContain('Fresh Model')
|
expect(document.body.textContent).toContain('Fresh Model')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('keeps manual model creation available when the external catalog is unavailable', async () => {
|
||||||
|
modelsDevMocks.getModelsDevList.mockRejectedValueOnce({
|
||||||
|
response: {
|
||||||
|
status: 503,
|
||||||
|
data: { detail: 'External models catalog unavailable' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
mountDialog()
|
||||||
|
await settle()
|
||||||
|
|
||||||
|
const manualEntryButton = document.body.querySelector<HTMLButtonElement>(
|
||||||
|
'[data-testid="models-catalog-manual-entry"]',
|
||||||
|
)
|
||||||
|
if (!manualEntryButton) throw new Error('Missing catalog manual-entry button')
|
||||||
|
manualEntryButton.click()
|
||||||
|
await settle()
|
||||||
|
|
||||||
|
expect(document.body.querySelector('[data-testid="models-catalog-load-error"]')).toBeNull()
|
||||||
|
expect(document.body.textContent).toContain('手动填写模式')
|
||||||
|
expect(document.body.querySelector('#model-name')).not.toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
it('drops the previous draft and submits only the newly selected model preset', async () => {
|
it('drops the previous draft and submits only the newly selected model preset', async () => {
|
||||||
mountDialog()
|
mountDialog()
|
||||||
await settle()
|
await settle()
|
||||||
|
|||||||
Reference in New Issue
Block a user