Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(constants): update PET_SECTION_ORDER to correct value of 210

hairyf8b9b6ffdfa93
diff --git a/packages/dsh-tauri-pet/src/client/constants/index.ts b/packages/dsh-tauri-pet/src/client/constants/index.ts
index 0cab0f8f..52e65a51 100644
--- a/packages/dsh-tauri-pet/src/client/constants/index.ts
+++ b/packages/dsh-tauri-pet/src/client/constants/index.ts
@@ -2,7 +2,7 @@ import { PLUGIN_ID } from '../../shared/constants'
/** settings.section 槽位里的桌宠分区标识与排序权重。 */
export const PET_SECTION_ID = 'dsh-tauri-pet-settings'
-export const PET_SECTION_ORDER = 230
+export const PET_SECTION_ORDER = 210
/** effect 标签。 */
export const PET_LOCALE_EFFECT = `${PLUGIN_ID}: locale`
diff --git a/packages/dsh-tauri-ui/src/client/service/sections.test.ts b/packages/dsh-tauri-ui/src/client/service/sections.test.ts
new file mode 100644
index 00000000..d3957836
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/service/sections.test.ts
@@ -0,0 +1,93 @@
+import type { SlotRegistry } from 'dsh-tauri/client'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { sections } from '../store/modules/sections'
+import { loadOnboardingSteps, loadSections } from './sections'
+
+/** 只保真本投影用到的 lodash 语义:单 iteratee 的稳定升序。 */
+const mocks = vi.hoisted(() => ({
+ isEqual: (left: unknown, right: unknown): boolean => JSON.stringify(left) === JSON.stringify(right),
+ orderBy: (
+ collection: readonly Record<string, unknown>[],
+ iteratee: string | ((item: Record<string, unknown>) => number),
+ ): Record<string, unknown>[] => {
+ const keyOf = (item: Record<string, unknown>): number =>
+ Number(typeof iteratee === 'function' ? iteratee(item) : item[iteratee])
+ return [...collection].sort((left, right) => keyOf(left) - keyOf(right))
+ },
+}))
+
+vi.mock('dsh-tauri/client', () => ({
+ defineStore: (definition: { state: () => Record<string, unknown>, actions?: Record<string, unknown> }) =>
+ Object.assign(definition.state(), definition.actions ?? {}),
+ isEqual: mocks.isEqual,
+ orderBy: mocks.orderBy,
+}))
+
+interface SlotEntry {
+ options: { id?: string, order?: number, label?: unknown }
+}
+
+function registry(sectionEntries: SlotEntry[], onboardingEntries: SlotEntry[] = []): SlotRegistry {
+ return {
+ entries: (slotKey: string) => (slotKey === 'settings.section' ? sectionEntries : onboardingEntries),
+ } as unknown as SlotRegistry
+}
+
+afterEach(() => {
+ sections.setRows([])
+ sections.setOnboarding([])
+})
+
+describe('loadSections', () => {
+ it('projects the sidebar sections by the order each holder reports', async () => {
+ const rows = await loadSections(registry([
+ { options: { id: 'dsh-tauri-archive', order: 220 } },
+ { options: { id: 'account', order: -10 } },
+ { options: { id: 'general', order: 0 } },
+ { options: { id: 'models', order: 10 } },
+ { options: { id: 'dsh-bridge', order: 10 } },
+ { options: { id: 'plugins', order: 15 } },
+ ]))
+
+ expect(rows.map(row => row.id)).toEqual([
+ 'account',
+ 'general',
+ 'models',
+ 'dsh-bridge',
+ 'plugins',
+ 'dsh-tauri-archive',
+ ])
+ expect(sections.rows).toEqual(rows)
+ })
+
+ it('drops entries without a section id', async () => {
+ const rows = await loadSections(registry([
+ { options: { order: 1 } },
+ { options: { id: '', order: 2 } },
+ { options: { id: 'general', order: 0 } },
+ ]))
+
+ expect(rows.map(row => row.id)).toEqual(['general'])
+ })
+
+ it('resolves lazy section labels', async () => {
+ const rows = await loadSections(registry([
+ { options: { id: 'account', order: -10, label: () => '账号与余额' } },
+ { options: { id: 'general', order: 0, label: '通用设置' } },
+ ]))
+
+ expect(rows.map(row => row.label)).toEqual(['账号与余额', '通用设置'])
+ })
+})
+
+describe('loadOnboardingSteps', () => {
+ it('projects the onboarding steps by their own order', async () => {
+ const rows = await loadOnboardingSteps(registry([], [
+ { options: { id: 'deepseek-official', order: 0, label: '登录' } },
+ { options: { id: 'account', order: -5, label: '账号' } },
+ ]))
+
+ expect(rows.map(row => row.id)).toEqual(['account', 'deepseek-official'])
+ expect(sections.onboarding).toEqual(rows)
+ })
+})
diff --git a/packages/dsh-tauri-ui/src/client/ui/settings-sidebar.tsx b/packages/dsh-tauri-ui/src/client/ui/settings-sidebar.tsx
index df6f46dc..35b5c70f 100644
--- a/packages/dsh-tauri-ui/src/client/ui/settings-sidebar.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/settings-sidebar.tsx
@@ -108,6 +108,8 @@ export function SettingsSidebar(_props: SettingsSidebarProps): ReactElement | nu
<div
className="fixed inset-0 z-[1000] flex bg-[var(--dsw-specific-sidebar-fill)] text-primary [--dsh-chat-content-width:748px] [--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width)_+_32px)] [--dsh-composer-side-clearance:16px]"
data-slot-sidebar="dsh-tauri-ui"
+ role="dialog"
+ aria-label={locale.text('settings')}
>
<div
className="flex-none box-border flex flex-col gap-[14px] w-[var(--dsh-settings-rail-width)] px-[12px] py-[6px] bg-[var(--dsw-specific-sidebar-fill)] overflow-hidden"