fix(web): close model switch review gaps

This commit is contained in:
Dudu-0223 committed 2026-08-27 12:00:02 +08:00
1 parent 7c626fb5d2
commit 1ea72339fd
3 files changed
+3 -23

No files matched your search

@@ -137,24 +137,15 @@ export class ModelsSettingsStore {
private generation = 0
/**
* @param api - the page's wire faces (credentials Remote, llm reads, settings writes).
* @param api - the page's credentials Remote and LLM wire faces.
* @param describeFace - the shared mirror's describe face (namespace views and writability).
*/
constructor(
private readonly api: ModelsWire,
private readonly api: Pick<ModelsWire, 'credentials' | 'llm'>,
private readonly schema: SettingsSchemaOperations,
private readonly describeFace: SettingsDescribeFace,
) {}
/**
* Fold one successful settings write into the shared mirror before rejoining
* this page's rows.
* @param view - namespace view returned by the settings wire method.
*/
acceptNamespace(view: SettingsNamespaceView): void {
this.describeFace.acceptView(view)
}
/**
* Refresh the whole page snapshot: the provider directory and the mirror's
* settings answer in parallel, then one batched credential describe over
@@ -1,5 +1,5 @@
/** Page-store join: directory × namespaces × credentials, with last-good rows on failure. */
import { describe, expect, it, vi } from 'vitest'
import { describe, expect, it } from 'vitest'
import type { RpcResponse } from '@deepseek-ai/dsh-api-remotes/client'
import { SettingsDescribeMirror } from '@deepseek-ai/dsh-client-ui-settings/src/client/settings-mirror.ts'
import { settingsSchema } from './settings-schema.client.ts'
@@ -84,14 +84,6 @@ function api(overrides: {
}
describe('ModelsSettingsStore', () => {
it('forwards accepted writes into the shared settings mirror', () => {
const { face } = api()
const acceptView = vi.fn()
const store = new ModelsSettingsStore(face, settingsSchema, { acceptView } as never)
store.acceptNamespace(NAMESPACES[0]!)
expect(acceptView).toHaveBeenCalledWith(NAMESPACES[0])
})
it('joins rows with configured, removable, and credential state', async () => {
const { face, mirror, seenRefs } = api()
const store = new ModelsSettingsStore(face, settingsSchema, mirror)
@@ -48,9 +48,6 @@ export type {
export type { AgentLoopCardFace, AgentLoopCardState } from './agent-loop-card-controller.ts'
export type { BashCardFace, BashCardState } from './bash-card-controller.ts'
export type { WebSearchCardFace, WebSearchCardState } from './web-search-card-controller.ts'
export type {
SubagentModelSelectionCardFace, SubagentModelSelectionCardState,
} from './subagent-model-selection-card-controller.ts'
/** Dictionary namespace owned by this plugin. */
const NS = 'settings.plugins'