AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
refactor(web): simplify AI integration settings
tianma-if60d56103af2b
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsxindex 426423b0..e41e7a80 100644--- a/apps/web/src/components/SettingsPane.tsx+++ b/apps/web/src/components/SettingsPane.tsx@@ -21,7 +21,6 @@ import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/caimport type { EditorContentAlignment, ShortcutSettings } from "@/lib/app-helpers";import { WORKSPACE_PAGE_TITLE_CLASSNAME } from "@/lib/workspace-ui";import { cn } from "@/lib/utils";-import { AdvancedPlayCard } from "./settings/AdvancedPlayCard";import { AccountInfoCard } from "./settings/AccountInfoCard";import { DataExportCard } from "./settings/DataExportCard";import { DesktopLocalDataCard } from "./settings/DesktopLocalDataCard";@@ -34,7 +33,6 @@ import { PasswordCard } from "./settings/PasswordCard";import { UserManagementCard } from "./settings/UserManagementCard";import { ObjectStorageCard } from "./settings/ObjectStorageCard";import { AiModelCard } from "./settings/AiModelCard";-import { AiPromptsCard } from "./settings/AiPromptsCard";import { AiTagSuggestionPromptCard } from "./settings/AiTagSuggestionPromptCard";import { ThemeToggle } from "./ThemeToggle";import type { AuthUser } from "@edgeever/shared";@@ -267,8 +265,6 @@ export const SettingsPane = ({<SettingsGroup><AiModelCard /><McpConfigCard />- <AiPromptsCard onOpenLibrary={onOpenAiPrompts} />- <AdvancedPlayCard /></SettingsGroup>);case "advanced":diff --git a/tests/e2e/ai-custom-prompts.spec.ts b/tests/e2e/ai-custom-prompts.spec.tsindex 686e45e4..e0ce0e6f 100644--- a/tests/e2e/ai-custom-prompts.spec.ts+++ b/tests/e2e/ai-custom-prompts.spec.ts@@ -65,14 +65,17 @@ const createPrompt = async (return (await response.json() as { prompt: Prompt }).prompt;};-const openSettingsAiTab = async (page: Page) => {- await ensureAuthenticatedPage(page);- await page.getByRole("button", { name: "个人中心", exact: true }).click();+const openPromptLibrary = async (page: Page) => {+ await page.setViewportSize({ width: 390, height: 844 });+ await login(page.request);+ await page.goto("/");+ const profileButton = page.getByRole("button", { name: "我的", exact: true });+ await expect(profileButton).toBeVisible({ timeout: 20_000 });+ await profileButton.click();await expect(page.getByRole("heading", { name: "我的", exact: true })).toBeVisible();- await page.getByRole("button", { name: "AI集成", exact: true }).click();- await expect(page.getByRole("heading", { name: "AI 指令", exact: true })).toBeVisible();- await page.getByRole("button", { name: "打开指令库", exact: true }).click();+ await page.getByRole("button", { name: "指令", exact: true }).click();await expect(page.getByRole("heading", { name: "指令库", exact: true })).toBeVisible();+ await page.setViewportSize({ width: 1280, height: 720 });};const openMemoAssistant = async (page: Page, memoId: string, notebookName: string) => {@@ -133,6 +136,17 @@ test.describe("AI custom prompts", () => {return memo;};+ test("keeps secondary content out of AI integration settings", async ({ page }) => {+ await ensureAuthenticatedPage(page);+ await page.getByRole("button", { name: "个人中心", exact: true }).click();+ await page.getByRole("button", { name: "AI集成", exact: true }).click();++ await expect(page.getByRole("heading", { name: "外部 AI 模型", exact: true })).toBeVisible();+ await expect(page.getByRole("heading", { name: "API Token 与 MCP 配置", exact: true })).toBeVisible();+ await expect(page.getByRole("heading", { name: "AI 指令", exact: true })).toHaveCount(0);+ await expect(page.getByRole("heading", { name: "进阶玩法", exact: true })).toHaveCount(0);+ });+test("opens the inline composer from /ai and the configurable shortcut", async ({ page }) => {const memo = await createMemo(page, `e2e-ai-inline-${Date.now()}`, "用于测试内联 AI 入口。");await ensureAuthenticatedPage(page);@@ -562,7 +576,7 @@ test.describe("AI custom prompts", () => {const promptName = `e2e-设置指令-${Date.now()}`;const instruction = "把笔记提炼成三条要点,使用 Markdown 列表。";- await openSettingsAiTab(page);+ await openPromptLibrary(page);await page.getByRole("button", { name: "新建指令", exact: true }).click();const editor = page.locator("form").filter({ has: page.getByRole("heading", { name: "新建指令", exact: true }) });await expect(editor).toBeVisible();@@ -674,7 +688,7 @@ test.describe("AI custom prompts", () => {});createdPromptIds.push(created.id);- await openSettingsAiTab(page);+ await openPromptLibrary(page);const row = page.getByRole("article").filter({ has: page.getByRole("heading", { name: originalName, exact: true }) });await expect(row.getByText(originalName, { exact: true })).toBeVisible();await row.getByRole("button", { name: "编辑指令", exact: true }).click();