From ae9b954c57b6096149438acee90c3c6bbb7224b6 Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Sun, 16 Aug 2026 10:32:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=AB=99=E7=82=B9=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8E=E5=8A=9F=E8=83=BD=E7=B4=A2=E5=BC=95=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pages/index.vue | 1053 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 694 insertions(+), 359 deletions(-) diff --git a/app/pages/index.vue b/app/pages/index.vue index f028beb..1a9257e 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -6,7 +6,8 @@ definePageMeta({ }); const { loggedIn, user } = useAuthSession(); -const { siteName } = useGlobalConfig(); + +// ── Agents(用于「开始对话」与 Agent 特性块)── interface AgentItem { id: number; @@ -14,140 +15,302 @@ interface AgentItem { name: string; description: string | null; isDefault: number | null; - isCallable: number | null; - sortOrder: number | null; } const { data: agentsData } = await useFetch<{ code: number; data: { list: AgentItem[] } }>("/api/agents"); const agents = computed(() => agentsData.value?.data?.list ?? []); const defaultAgent = computed(() => agents.value.find((a) => a.isDefault === 1) ?? agents.value[0] ?? null); - -function enterChat(slug: string) { - navigateTo(`/chat/${slug}`); +const defaultChatPath = computed(() => (defaultAgent.value ? `/chat/${defaultAgent.value.slug}` : "/chat/default")); + +// ── 站点目录 ── + +interface SiteEntry { + key: string; + num: string; + title: string; + desc: string; + to: string; + icon: string; + tags: string[]; + featured?: boolean; +} + +interface SiteGroup { + key: string; + label: string; + labelEn: string; + entries: SiteEntry[]; +} + +const groups = computed(() => [ + { + key: "talk", + label: "对话", + labelEn: "Talk", + entries: [ + { + key: "agent", + num: "01", + title: "AI Agent", + desc: "多轮对话、工具调用、推理过程,上下文持续记忆。登录后保存会话,随时继续。", + to: defaultChatPath.value, + icon: "lucide:bot", + tags: ["公开"], + featured: true, + }, + { + key: "character", + num: "02", + title: "角色", + desc: "与有独立人设的角色对话,每个角色都有自己的世界观与语气。", + to: "/characters", + icon: "lucide:users", + tags: ["公开"], + }, + ], + }, + { + key: "create", + label: "创作", + labelEn: "Create", + entries: [ + { + key: "idea", + num: "03", + title: "创意", + desc: "随手记录灵感,以瀑布流浏览、分类与整理。", + to: "/ideas", + icon: "lucide:lightbulb", + tags: ["需登录"], + }, + { + key: "project", + num: "04", + title: "项目", + desc: "沉淀项目与作品,把成果展示出来。", + to: "/projects", + icon: "lucide:folder-kanban", + tags: ["公开"], + }, + { + key: "article", + num: "05", + title: "文章", + desc: "长文阅读与写作,关联卡片素材,自由编排。", + to: "/articles", + icon: "lucide:file-text", + tags: ["公开"], + }, + ], + }, + { + key: "collect", + label: "积累", + labelEn: "Collect", + entries: [ + { + key: "document", + num: "06", + title: "文档", + desc: "Agent 的知识库,可被检索、引用,喂给对话。", + to: "/agent-documents", + icon: "lucide:book-open", + tags: ["需登录"], + }, + { + key: "favorite", + num: "07", + title: "收藏", + desc: "收藏喜欢的灵感与内容,随时回看。", + to: "/collect", + icon: "lucide:star", + tags: ["需登录"], + }, + ], + }, + { + key: "system", + label: "系统", + labelEn: "System", + entries: [ + { + key: "settings", + num: "08", + title: "设置", + desc: "配置模型、偏好与账号信息。", + to: "/settings/llm-config", + icon: "lucide:settings-2", + tags: ["需登录"], + }, + { + key: "admin", + num: "09", + title: "管理", + desc: "仪表盘、Agent、用户、角色与定时任务,统一管理。", + to: "/admin/dashboard", + icon: "lucide:shield", + tags: ["管理员"], + }, + ], + }, +]); + +function tagIcon(tag: string) { + if (tag === "公开") return "lucide:globe"; + if (tag === "需登录") return "lucide:lock"; + return "lucide:shield"; +} + +function enterChat(path: string) { + navigateTo(path); +} + +function scrollToIndex() { + document.getElementById("site-index")?.scrollIntoView({ behavior: "smooth", block: "start" }); } - -const features = [ - { icon: "lucide:message-square", title: "多轮对话", desc: "支持上下文记忆的连续对话,随时追问与深入探讨" }, - { icon: "lucide:wrench", title: "工具调用", desc: "Agent 可调用外部工具,检索文档、执行任务" }, - { icon: "lucide:history", title: "会话管理", desc: "登录后自动保存对话历史,随时回顾与继续" }, -];