fix(web): remove tool-call settings placeholder

This commit is contained in:
Yichen Jiang
2026-07-31 12:48:39 +08:00
parent ee74b5b07a
commit f45b6f76a5
15 changed files with 30 additions and 169 deletions
@@ -6,7 +6,7 @@ import { SlotsService } from '@deepseek-ai/dsh-client-runtime/client'
import { LocaleService } from '@deepseek-ai/dsh-client-locale/client'
import { apply, inject } from '@deepseek-ai/dsh-client-ui-settings-general/client'
import { CloseLabel, HeaderContent, TriggerContent } from '../src/client/chrome.tsx'
import { GeneralSection, ToolCallSkeleton } from '../src/client/GeneralSection.tsx'
import { GeneralSection } from '../src/client/GeneralSection.tsx'
/** The four seats this plugin fills (slot name → expected component). */
const SEATS = [
@@ -61,17 +61,11 @@ describe('ui-settings-general apply', () => {
// The nav label is a locale-following thunk; owners resolve at read time.
expect(resolveSlotLabel(entry.options.label)).toBe('通用设置')
expect(before.slots.spec('settings.general.item')).toEqual({ kind: 'list', scope: 'root' })
const toolEntry = before.slots.entries('settings.general.item')[0]!
expect(toolEntry).toMatchObject({
component: ToolCallSkeleton,
options: { id: 'tool-call', order: -10 },
})
expect(before.slots.entries('settings.general.item')).toEqual([])
// Copy rides the standard locale seat: every seat declares the namespace.
for (const [name] of SEATS) {
expect(before.slots.entries(name)[0]!.locale).toBe('settings')
}
expect(toolEntry.locale).toBe('settings')
const after = await bench()
await after.ctx.plugin({ inject: [...inject], apply }).await()
for (const [name] of SEATS) expect(after.slots.entries(name)).toHaveLength(0)
@@ -83,7 +77,7 @@ describe('ui-settings-general apply', () => {
expect(after.slots.entries(name)).toHaveLength(1)
}
await vi.waitFor(() => {
expect(after.slots.entries('settings.general.item')[0]!.component).toBe(ToolCallSkeleton)
expect(after.slots.spec('settings.general.item')).toEqual({ kind: 'list', scope: 'root' })
})
})
@@ -133,7 +127,7 @@ describe('ui-settings-general apply', () => {
for (const [name, component] of SEATS) {
expect(b.slots.entries(name)[0]!.component).toBe(component)
}
expect(b.slots.entries('settings.general.item')[0]!.component).toBe(ToolCallSkeleton)
expect(b.slots.entries('settings.general.item')).toEqual([])
expect(b.slots.spec('settings.general.item')).toEqual({ kind: 'list', scope: 'root' })
// The recovered registrations still ride the locale path.
b.locale.setLocale('en')
@@ -1,18 +1,17 @@
// @vitest-environment jsdom
import { afterEach, describe, expect, it, vi } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import type {
GeneralSectionComponentProps, ToolCallSkeletonProps,
} from '../src/client/GeneralSection.tsx'
import { GeneralSection, ToolCallSkeleton } from '../src/client/GeneralSection.tsx'
import type { GeneralSectionComponentProps } from '../src/client/GeneralSection.tsx'
import { GeneralSection } from '../src/client/GeneralSection.tsx'
import { CloseLabel, HeaderContent, TriggerContent } from '../src/client/chrome.tsx'
import type { TriggerContentProps } from '../src/client/chrome.tsx'
import { en } from '../src/client/locales.ts'
afterEach(cleanup)
// The seat's key domain is settings common; the stub answers from the
// package dictionary and falls back to the key like the real chain.
const t: ToolCallSkeletonProps['t'] = key => (en as Record<string, string>)[key] ?? key
const t: TriggerContentProps['t'] = key => (en as Record<string, string>)[key] ?? key
// Global standard kit stubs: none of these components consume the hooks.
const unusedHook = (() => { throw new Error('unused by settings-general components') }) as never
@@ -55,16 +54,3 @@ describe('GeneralSection', () => {
expect(screen.getByTestId('slot-settings.general.item')).toBeTruthy()
})
})
describe('ToolCallSkeleton', () => {
it('renders the mode cubes with schema pinned selected', () => {
render(<ToolCallSkeleton {...kit} t={t} />)
expect(screen.getByText('Tool Call')).toBeTruthy()
const schema = screen.getByText('Schema mode')
const code = screen.getByText('Code mode')
expect(schema.parentElement!.className).toContain('selected')
expect(code.parentElement!.className).not.toContain('selected')
expect(screen.getByText('Traditional function calling — invoke tools one at a time')).toBeTruthy()
expect(screen.getByText('Chain multiple tools with code — multi-step orchestration')).toBeTruthy()
})
})