diff --git a/frontend-web/src/core/config/index.ts b/frontend-web/src/core/config/index.ts index 9727e6f6..d6a8ade6 100644 --- a/frontend-web/src/core/config/index.ts +++ b/frontend-web/src/core/config/index.ts @@ -69,7 +69,7 @@ export function getLangGraphBaseURL(isMock?: boolean) { } } -/** 笔记本外部系统(Studio)API 基础地址,通过 VITE_NOTEBOOK_API_BASE_URL 配置。 */ +/** 笔记本外部系统后端 API 地址,通过 VITE_AIPI_BACKENP_URL 配置。 */ export function getNotebookApiBaseURL(): string { if (env.NEXT_PUBLIC_NOTEBOOK_API_BASE_URL) { return env.NEXT_PUBLIC_NOTEBOOK_API_BASE_URL.replace(/\/+$/, ""); diff --git a/frontend-web/src/core/studio/api.ts b/frontend-web/src/core/studio/api.ts index 29dff88e..c8f6329c 100644 --- a/frontend-web/src/core/studio/api.ts +++ b/frontend-web/src/core/studio/api.ts @@ -7,7 +7,7 @@ function base(): string { export async function fetchStudioToken(email: string): Promise { const apiBase = base(); - if (!apiBase) throw new Error("VITE_NOTEBOOK_API_BASE_URL 未配置"); + if (!apiBase) throw new Error("VITE_AIPI_FRONTEND_URL 未配置"); const res = await fetch( `${apiBase}/api/getTokenByEmail?email=${encodeURIComponent(email)}`, @@ -22,7 +22,7 @@ export async function fetchStudioToken(email: string): Promise { export async function fetchStudioNotebooks(token: string): Promise { const apiBase = base(); - if (!apiBase) throw new Error("VITE_NOTEBOOK_API_BASE_URL 未配置"); + if (!apiBase) throw new Error("VITE_AIPI_FRONTEND_URL 未配置"); const res = await fetch(`${apiBase}/api/v1/searchspaces`, { headers: { Authorization: `Bearer ${token}` }, @@ -36,7 +36,7 @@ export async function createSearchSpace( token: string, ): Promise { const apiBase = base(); - if (!apiBase) throw new Error("VITE_NOTEBOOK_API_BASE_URL 未配置"); + if (!apiBase) throw new Error("VITE_AIPI_FRONTEND_URL 未配置"); const res = await fetch(`${apiBase}/api/v1/searchspaces`, { method: "POST", @@ -69,7 +69,7 @@ export async function fetchDocumentByChunk( token: string, ): Promise { const apiBase = base(); - if (!apiBase) throw new Error("VITE_NOTEBOOK_API_BASE_URL 未配置"); + if (!apiBase) throw new Error("VITE_AIPI_FRONTEND_URL 未配置"); const res = await fetch(`${apiBase}/api/v1/documents/by-chunk/${chunkId}`, { headers: { Authorization: `Bearer ${token}` }, @@ -84,7 +84,7 @@ export async function uploadSourceFiles( token: string, ): Promise { const apiBase = base(); - if (!apiBase) throw new Error("VITE_NOTEBOOK_API_BASE_URL 未配置"); + if (!apiBase) throw new Error("VITE_AIPI_FRONTEND_URL 未配置"); const formData = new FormData(); formData.append("search_space_id", String(notebookId)); @@ -105,7 +105,7 @@ export async function fetchNotebookSources( token: string, ): Promise { const apiBase = base(); - if (!apiBase) throw new Error("VITE_NOTEBOOK_API_BASE_URL 未配置"); + if (!apiBase) throw new Error("VITE_AIPI_FRONTEND_URL 未配置"); const res = await fetch( `${apiBase}/api/v1/source/search-space/${notebookId}?limit=100`, diff --git a/frontend-web/src/core/studio/hooks.ts b/frontend-web/src/core/studio/hooks.ts index f4df8385..679096af 100644 --- a/frontend-web/src/core/studio/hooks.ts +++ b/frontend-web/src/core/studio/hooks.ts @@ -12,6 +12,7 @@ export function useStudioNotebooks(): { notebooks: StudioNotebook[]; isLoading: boolean; isError: boolean; + token: string | undefined; } { const email = getStoredAuth()?.email ?? ""; @@ -35,6 +36,7 @@ export function useStudioNotebooks(): { notebooks: (notebooksQuery.data ?? []).filter((nb) => nb.is_owner), isLoading: tokenQuery.isLoading || notebooksQuery.isLoading, isError: tokenQuery.isError || notebooksQuery.isError, + token: tokenQuery.data, }; } diff --git a/frontend-web/src/env.ts b/frontend-web/src/env.ts index dbf2ef33..4628be8c 100644 --- a/frontend-web/src/env.ts +++ b/frontend-web/src/env.ts @@ -6,7 +6,8 @@ function readEnv( | "VITE_LANGGRAPH_BASE_URL" | "VITE_CANVAS_LANGGRAPH_BASE_URL" | "VITE_NOTE_API_BASE_URL" - | "VITE_NOTEBOOK_API_BASE_URL" + | "VITE_AIPI_BACKENP_URL" + | "VITE_AIPI_FRONTEND_URL" | "VITE_STATIC_WEBSITE_ONLY" | "VITE_GITHUB_OAUTH_TOKEN" | "VITE_STUDIO_ENABLED", @@ -22,7 +23,7 @@ export const env = { // routed (e.g. a separate canvas-agent server). Falls back to the main URL. NEXT_PUBLIC_CANVAS_LANGGRAPH_BASE_URL: readEnv("VITE_CANVAS_LANGGRAPH_BASE_URL"), NEXT_PUBLIC_NOTE_API_BASE_URL: readEnv("VITE_NOTE_API_BASE_URL"), - NEXT_PUBLIC_NOTEBOOK_API_BASE_URL: readEnv("VITE_NOTEBOOK_API_BASE_URL"), + NEXT_PUBLIC_NOTEBOOK_API_BASE_URL: readEnv("VITE_AIPI_BACKENP_URL"), NEXT_PUBLIC_STATIC_WEBSITE_ONLY: readEnv("VITE_STATIC_WEBSITE_ONLY"), GITHUB_OAUTH_TOKEN: readEnv("VITE_GITHUB_OAUTH_TOKEN"), STUDIO_ENABLED: readEnv("VITE_STUDIO_ENABLED"), diff --git a/frontend-web/src/pages/StudioNotebookDetailPage.tsx b/frontend-web/src/pages/StudioNotebookDetailPage.tsx index 67a4fd2c..b711390a 100644 --- a/frontend-web/src/pages/StudioNotebookDetailPage.tsx +++ b/frontend-web/src/pages/StudioNotebookDetailPage.tsx @@ -5,7 +5,7 @@ import { useParams } from "react-router-dom"; import { AlignLeft, ArrowLeft, - CloudUpload, + BookOpen, Files, Globe, Loader2, @@ -188,19 +188,12 @@ function SourcesDialog({ {uploading ? : } 上传文件 - {[ - { icon: CloudUpload, label: "从云端硬盘添加" }, - { icon: Globe, label: "添加网站" }, - { icon: AlignLeft, label: "复制的文字" }, - ].map(({ icon: Icon, label }) => ( - - ))} + {uploadError && (

{uploadError}

)} @@ -232,7 +225,7 @@ function SourcesDialog({ // ── 主页面 ────────────────────────────────────────────── export default function StudioNotebookDetailPage() { const { notebookId } = useParams<{ notebookId: string }>(); - const { notebooks, isLoading } = useStudioNotebooks(); + const { notebooks, isLoading, token: studioToken } = useStudioNotebooks(); // token 用于跳转 callback const { models } = useModels(); const queryClient = useQueryClient(); const [sourcesOpen, setSourcesOpen] = useState(false); @@ -357,19 +350,40 @@ export default function StudioNotebookDetailPage() { {notebook.name} - +
+ + + 我的笔记 + + +
)} {/* 列表视图:笔记本标题 + 历史线程列表 */} {!isChatView && (
+ {/* 右上角跳转按钮 */} + + + 我的笔记 +
{notebook.avatar_url ? (