Bläddra i källkod

feat: add skill library navigation entry

Mochocyang 3 månader sedan
förälder
incheckning
596ad3eaa9

+ 12 - 0
src/components/layout/content-area.tsx

@@ -38,6 +38,11 @@ const SoulView = lazy(async () => {
   return { default: mod.SoulView }
   return { default: mod.SoulView }
 })
 })
 
 
+const SkillLibraryView = lazy(async () => {
+  const mod = await import("@/components/skill-library/skill-library-view")
+  return { default: mod.SkillLibraryView }
+})
+
 const ReviewCenterView = lazy(async () => {
 const ReviewCenterView = lazy(async () => {
   const mod = await import("@/components/review/review-center-view")
   const mod = await import("@/components/review/review-center-view")
   return { default: mod.ReviewCenterView }
   return { default: mod.ReviewCenterView }
@@ -95,6 +100,13 @@ export function ContentArea() {
           </Suspense>
           </Suspense>
         )
         )
         break
         break
+      case "skillLibrary":
+        content = (
+          <Suspense fallback={<LoadingView />}>
+            <SkillLibraryView />
+          </Suspense>
+        )
+        break
       case "lint":
       case "lint":
         content = (
         content = (
           <Suspense fallback={<LoadingView />}>
           <Suspense fallback={<LoadingView />}>

+ 2 - 1
src/components/layout/icon-sidebar.tsx

@@ -1,6 +1,6 @@
 import { useState, useRef, useEffect, useMemo } from "react"
 import { useState, useRef, useEffect, useMemo } from "react"
 import {
 import {
-  FileText, FolderOpen, Search, Network, Brain, Settings, ArrowLeftRight, Sun, Moon, Eye, SunMoon, Check, Trash2, Sparkles, LayoutDashboard, BookOpen, Drama,
+  FileText, FolderOpen, Search, Network, Brain, Settings, ArrowLeftRight, Sun, Moon, Eye, SunMoon, Check, Trash2, Sparkles, LayoutDashboard, BookOpen, Drama, WandSparkles,
 } from "lucide-react"
 } from "lucide-react"
 import { createPortal } from "react-dom"
 import { createPortal } from "react-dom"
 import {
 import {
@@ -46,6 +46,7 @@ const CONFIGURABLE_NAV_ITEMS: ConfigurableNavItem[] = [
   { id: "graph", view: "graph", icon: Network, labelKey: "novel.nav.graph" },
   { id: "graph", view: "graph", icon: Network, labelKey: "novel.nav.graph" },
   { id: "lint", view: "lint", icon: Brain, labelKey: "novel.nav.lint" },
   { id: "lint", view: "lint", icon: Brain, labelKey: "novel.nav.lint" },
   { id: "soul", view: "soul", icon: Sparkles, labelKey: "novel.nav.soul" },
   { id: "soul", view: "soul", icon: Sparkles, labelKey: "novel.nav.soul" },
+  { id: "skillLibrary", view: "skillLibrary", icon: WandSparkles, labelKey: "novel.nav.skillLibrary" },
   { id: "bookAnalysis", view: "bookAnalysis", icon: BookOpen, labelKey: "novel.nav.dismantling" },
   { id: "bookAnalysis", view: "bookAnalysis", icon: BookOpen, labelKey: "novel.nav.dismantling" },
   { id: "reviewCenter", view: "reviewCenter", icon: LayoutDashboard, labelKey: "novel.nav.reviewCenter" },
   { id: "reviewCenter", view: "reviewCenter", icon: LayoutDashboard, labelKey: "novel.nav.reviewCenter" },
   { id: "storySimulation", view: "storySimulation", icon: Drama, labelKey: "novel.nav.storySimulation" },
   { id: "storySimulation", view: "storySimulation", icon: Drama, labelKey: "novel.nav.storySimulation" },

+ 1 - 0
src/components/settings/interface-sidebar-nav.spec.ts

@@ -17,6 +17,7 @@ describe("settings sidebar nav preferences", () => {
 
 
   it("renders a Chinese sidebar feature visibility section in interface settings", () => {
   it("renders a Chinese sidebar feature visibility section in interface settings", () => {
     expect(interfaceSectionSource).toContain("SIDEBAR_NAV_LABEL_KEYS")
     expect(interfaceSectionSource).toContain("SIDEBAR_NAV_LABEL_KEYS")
+    expect(interfaceSectionSource).toContain("skillLibrary")
     expect(interfaceSectionSource).toContain('setDraft("sidebarNavConfig"')
     expect(interfaceSectionSource).toContain('setDraft("sidebarNavConfig"')
     expect(interfaceSectionSource).toContain('type="checkbox"')
     expect(interfaceSectionSource).toContain('type="checkbox"')
     expect(zh.settings.sections.interface.sidebarNavTitle).toBe("左侧功能栏")
     expect(zh.settings.sections.interface.sidebarNavTitle).toBe("左侧功能栏")

+ 1 - 0
src/components/settings/sections/interface-section.tsx

@@ -29,6 +29,7 @@ const SIDEBAR_NAV_LABEL_KEYS: Record<SidebarNavItemId, string> = {
   graph: "novel.nav.graph",
   graph: "novel.nav.graph",
   lint: "novel.nav.lint",
   lint: "novel.nav.lint",
   soul: "novel.nav.soul",
   soul: "novel.nav.soul",
+  skillLibrary: "novel.nav.skillLibrary",
   bookAnalysis: "novel.nav.dismantling",
   bookAnalysis: "novel.nav.dismantling",
   reviewCenter: "novel.nav.reviewCenter",
   reviewCenter: "novel.nav.reviewCenter",
   storySimulation: "novel.nav.storySimulation",
   storySimulation: "novel.nav.storySimulation",

+ 10 - 0
src/components/skill-library/skill-library-view.tsx

@@ -0,0 +1,10 @@
+export function SkillLibraryView() {
+  return (
+    <div className="flex h-full flex-col overflow-hidden">
+      <div className="border-b px-5 py-4">
+        <h1 className="text-lg font-semibold">技能库</h1>
+        <p className="mt-1 text-sm text-muted-foreground">管理当前项目可用的去AI味技能。</p>
+      </div>
+    </div>
+  )
+}

+ 2 - 0
src/i18n/en.json

@@ -221,6 +221,7 @@
     "chat": "Chat",
     "chat": "Chat",
     "lint": "Check",
     "lint": "Check",
     "soul": "Soul",
     "soul": "Soul",
+    "skillLibrary": "Skill Library",
     "reviewCenter": "Review Center",
     "reviewCenter": "Review Center",
     "dismantling": "Dismantling",
     "dismantling": "Dismantling",
     "settings": "Settings",
     "settings": "Settings",
@@ -1116,6 +1117,7 @@
       "chat": "写作对话",
       "chat": "写作对话",
       "lint": "Memory Center",
       "lint": "Memory Center",
       "soul": "Soul",
       "soul": "Soul",
+      "skillLibrary": "Skill Library",
       "reviewCenter": "Review Center",
       "reviewCenter": "Review Center",
       "storySimulation": "Story Simulation",
       "storySimulation": "Story Simulation",
       "dismantling": "Dismantling",
       "dismantling": "Dismantling",

+ 2 - 0
src/i18n/zh.json

@@ -113,6 +113,7 @@
     "graph": "关系图",
     "graph": "关系图",
     "lint": "检查",
     "lint": "检查",
     "soul": "灵魂",
     "soul": "灵魂",
+    "skillLibrary": "技能库",
     "reviewCenter": "审查中心",
     "reviewCenter": "审查中心",
     "dismantling": "拆文库",
     "dismantling": "拆文库",
     "settings": "设置",
     "settings": "设置",
@@ -997,6 +998,7 @@
       "graph": "小说图谱",
       "graph": "小说图谱",
       "lint": "记忆中心",
       "lint": "记忆中心",
       "soul": "灵魂",
       "soul": "灵魂",
+      "skillLibrary": "技能库",
       "reviewCenter": "审查中心",
       "reviewCenter": "审查中心",
       "storySimulation": "剧情推演室",
       "storySimulation": "剧情推演室",
       "dismantling": "拆文库",
       "dismantling": "拆文库",

+ 7 - 0
src/lib/sidebar-nav-preferences.spec.ts

@@ -14,6 +14,7 @@ describe("sidebar nav preferences", () => {
       "graph",
       "graph",
       "lint",
       "lint",
       "soul",
       "soul",
+      "skillLibrary",
       "bookAnalysis",
       "bookAnalysis",
       "reviewCenter",
       "reviewCenter",
       "storySimulation",
       "storySimulation",
@@ -36,6 +37,7 @@ describe("sidebar nav preferences", () => {
       "graph",
       "graph",
       "lint",
       "lint",
       "soul",
       "soul",
+      "skillLibrary",
       "bookAnalysis",
       "bookAnalysis",
       "reviewCenter",
       "reviewCenter",
       "storySimulation",
       "storySimulation",
@@ -56,4 +58,9 @@ describe("sidebar nav preferences", () => {
 
 
     expect(order.slice(0, 3)).toEqual(["trash", "wiki", "sources"])
     expect(order.slice(0, 3)).toEqual(["trash", "wiki", "sources"])
   })
   })
+
+  it("includes skill library in the configurable sidebar order", () => {
+    expect(DEFAULT_SIDEBAR_NAV_ORDER).toContain("skillLibrary")
+    expect(normalizeSidebarNavConfig({ order: ["wiki"] }).order).toContain("skillLibrary")
+  })
 })
 })

+ 1 - 0
src/lib/sidebar-nav-preferences.ts

@@ -4,6 +4,7 @@ export const DEFAULT_SIDEBAR_NAV_ORDER = [
   "graph",
   "graph",
   "lint",
   "lint",
   "soul",
   "soul",
+  "skillLibrary",
   "bookAnalysis",
   "bookAnalysis",
   "reviewCenter",
   "reviewCenter",
   "storySimulation",
   "storySimulation",

+ 1 - 1
src/stores/wiki-store.ts

@@ -496,7 +496,7 @@ interface WikiState {
   chatExpanded: boolean
   chatExpanded: boolean
   chatDockPosition: ChatDockPosition
   chatDockPosition: ChatDockPosition
   searchPanelOpen: boolean
   searchPanelOpen: boolean
-  activeView: "wiki" | "sources" | "search" | "graph" | "lint" | "soul" | "dismantling" | "bookAnalysis" | "settings" | "trash" | "reviewCenter" | "storySimulation"
+  activeView: "wiki" | "sources" | "search" | "graph" | "lint" | "soul" | "skillLibrary" | "dismantling" | "bookAnalysis" | "settings" | "trash" | "reviewCenter" | "storySimulation"
   activeSettingsCategory: SettingsCategoryId | null
   activeSettingsCategory: SettingsCategoryId | null
   selectedSoulId: string | null
   selectedSoulId: string | null
   selectedSoulTab: "project" | "character"
   selectedSoulTab: "project" | "character"