diff --git a/frontend-web/.env.development b/frontend-web/.env.development index e8c1e371..8fd526eb 100644 --- a/frontend-web/.env.development +++ b/frontend-web/.env.development @@ -24,15 +24,16 @@ VITE_AIPI_B2ACTOR_XWT_PATH=/fromB/toXWT?isFrame=1 VITE_AIPI_KNOWLEDGE_IFRAME_API_URL=https://ch1.b.uat.4.cn/knowes/api/iframeKnowledgeUrl VITE_AIPI_KNOWLEDGE_IFRAME_SKIN=red VITE_AIPI_MOPECHAT_URL=https://ch1.b.uat.4.cn/likun_b1_mope -VITE_AIPI_BACKENP_URL=http://47.88.25.99:8000 +VITE_AIPI_BACKENP_URL=http://localhost:8003 # 工作室/笔记本后端接口(侧边栏“工作室”列表、笔记本详情等都走这里,不是 VITE_NOTE_API_BASE_URL) # 工作室/笔记本前端地址(用于 auth/callback 等跳转) # VITE_AIPI_FRONTEND_URL=https://knowledgetoolserver.b.uat.4.cn -VITE_NOTEBOOK_API_BASE_URL=http://47.88.25.99:8000 -# 工作室侧边栏显示开关;仅控制入口显示,展开内容仍依赖 notebook 接口成功返回数据 -VITE_STUDIO_ENABLED=true -VITE_AIPI_FRONTEND_URL=http://47.88.25.99:3000 +VITE_AIPI_FRONTEND_URL=http://localhost:3000 VITE_AIPI_CONSUMER_URL=https://ch1.b.uat.4.cn/consumer +# A 系统跳转地址(人物/组织/事件等列表项打开链接) +VITE_AIPI_PRESENT_URL=https://present.a.uat.4.cn/present/domain +# B 系统知识库 iframe 根地址 +VITE_AIPI_KNOWES_URL=https://ch1.b.uat.4.cn/knowes # MaxKey 鉴权(getTokenByOnlineTicket) VITE_AUTH_BASE_URL=https://auth.y.sit.4.cn diff --git a/frontend-web/.env.development.local.example b/frontend-web/.env.development.local.example index 9a45a1fe..26e30d61 100644 --- a/frontend-web/.env.development.local.example +++ b/frontend-web/.env.development.local.example @@ -20,10 +20,12 @@ VITE_AIPI_BACKENP_URL=https://knowledgetoolserver.b.uat.4.cn # 工作室/笔记本前端地址(用于 auth/callback 等跳转) VITE_AIPI_FRONTEND_URL=https://knowledgetoolserver.b.uat.4.cn VITE_AIPI_CONSUMER_URL=https://ch1.b.uat.4.cn/consumer +# A 系统跳转地址(人物/组织/事件等列表项打开链接) +VITE_AIPI_PRESENT_URL=http://present.a.uat.4.cn/present/domain +# B 系统知识库 iframe 根地址 +VITE_AIPI_KNOWES_URL=http://ch1.b.uat.4.cn/knowes VITE_AUTH_BASE_URL=https://auth.y.sit.4.cn VITE_AIPI_PGLINKTO_URL=https://pg.b.uat.4.cn VITE_AIPI_XKLINKTO_URL=https://kz.b.uat.4.cn # VITE_NOTE_API_BASE_URL=http://127.0.0.1:8000 -# 工作室侧边栏显示开关;仅控制入口显示,展开内容仍依赖 notebook 接口成功返回数据 -VITE_STUDIO_ENABLED=true diff --git a/frontend-web/.env.example b/frontend-web/.env.example index f0dda406..2b6fe040 100644 --- a/frontend-web/.env.example +++ b/frontend-web/.env.example @@ -23,7 +23,6 @@ # VITE_NOTE_API_BASE_URL=http://47.88.25.99:8000 # VITE_AIPI_BACKENP_URL=https://knowledgetoolserver.b.uat.4.cn # VITE_AIPI_FRONTEND_URL=https://knowledgetoolserver.b.uat.4.cn -# VITE_STUDIO_ENABLED=true # 仅控制“工作室”入口显示,列表内容仍依赖 notebook 接口数据 # --- 生产打包(见 .env.production)--- # 部署前修改 .env.production 中的地址,再执行 pnpm build diff --git a/frontend-web/.env.network b/frontend-web/.env.network index bf2a9011..d66e3070 100644 --- a/frontend-web/.env.network +++ b/frontend-web/.env.network @@ -29,10 +29,12 @@ VITE_AIPI_BACKENP_URL=http://47.88.25.99:8000 # 工作室/笔记本前端地址(用于 auth/callback 等跳转) # VITE_AIPI_FRONTEND_URL=https://knowledgetoolserver.b.uat.4.cn VITE_NOTEBOOK_API_BASE_URL=http://47.88.25.99:8000 -# 工作室侧边栏显示开关;仅控制入口显示,展开内容仍依赖 notebook 接口成功返回数据 -VITE_STUDIO_ENABLED=true VITE_AIPI_FRONTEND_URL=http://47.88.25.99:3000 VITE_AIPI_CONSUMER_URL=https://ch1.b.uat.4.cn/consumer +# A 系统跳转地址(人物/组织/事件等列表项打开链接) +VITE_AIPI_PRESENT_URL=http://present.a.uat.4.cn/present/domain +# B 系统知识库 iframe 根地址 +VITE_AIPI_KNOWES_URL=http://ch1.b.uat.4.cn/knowes # MaxKey 鉴权(getTokenByOnlineTicket) VITE_AUTH_BASE_URL=https://auth.y.sit.4.cn diff --git a/frontend-web/.env.production b/frontend-web/.env.production index 06083dec..eef2aafe 100644 --- a/frontend-web/.env.production +++ b/frontend-web/.env.production @@ -24,17 +24,16 @@ VITE_AIPI_BACKENP_URL=https://knowledgetoolserver.b.uat.4.cn # 我的笔记前端 VITE_AIPI_FRONTEND_URL= xxx VITE_AIPI_CONSUMER_URL=https://ch1.b.uat.4.cn/consumer +# A 系统跳转地址(人物/组织/事件等列表项打开链接) +VITE_AIPI_PRESENT_URL=https://present.a.uat.4.cn/present/domain +# B 系统知识库 iframe 根地址 +VITE_AIPI_KNOWES_URL=https://ch1.b.uat.4.cn/knowes # MaxKey 鉴权(getTokenByOnlineTicket) VITE_AUTH_BASE_URL=https://auth.y.uat.4.cn VITE_AIPI_PGLINKTO_URL=https://pg.b.uat.4.cn VITE_AIPI_XKLINKTO_URL=https://kz.b.uat.4.cn # 工作室/笔记本前端地址(用于 auth/callback 等跳转) VITE_AIPI_FRONTEND_URL=https://knowledgetoolweb.b.uat.4.cn -# 工作室侧边栏显示开关;仅控制入口显示,展开内容仍依赖 notebook 接口成功返回数据 -VITE_STUDIO_ENABLED=true # 可选:Canvas 独立 LangGraph 地址 # VITE_CANVAS_LANGGRAPH_BASE_URL= - -# 我的笔记是否显示,侧边栏 -VITE_STUDIO_ENABLED=false diff --git a/frontend-web/.env.production.local.example b/frontend-web/.env.production.local.example index f56448e0..30436901 100644 --- a/frontend-web/.env.production.local.example +++ b/frontend-web/.env.production.local.example @@ -5,4 +5,3 @@ # VITE_NOTE_API_BASE_URL=https://your-intranet-host/note-api # VITE_AIPI_BACKENP_URL=https://your-notebook-backend-host # VITE_AIPI_FRONTEND_URL=https://your-notebook-frontend-host -# VITE_STUDIO_ENABLED=true diff --git a/frontend-web/.env.sit b/frontend-web/.env.sit index dbaa36d4..17607744 100644 --- a/frontend-web/.env.sit +++ b/frontend-web/.env.sit @@ -22,14 +22,16 @@ VITE_AIPI_MOPECHAT_URL=https://ch1.b.sit.4.cn/likun_b1_mope # 工作室/笔记本后端接口(侧边栏“工作室”列表、笔记本详情等都走这里,不是 VITE_NOTE_API_BASE_URL) VITE_AIPI_BACKENP_URL=https://knowledgetoolserver.b.sit.4.cn VITE_AIPI_CONSUMER_URL=https://ch1.b.sit.4.cn/consumer +# A 系统跳转地址(人物/组织/事件等列表项打开链接) +VITE_AIPI_PRESENT_URL=http://present.a.sit.4.cn/present/domain +# B 系统知识库 iframe 根地址 +VITE_AIPI_KNOWES_URL=https://ch1.b.sit.4.cn/knowes # MaxKey 鉴权(getTokenByOnlineTicket) VITE_AUTH_BASE_URL=https://auth.y.sit.4.cn VITE_AIPI_PGLINKTO_URL=https://pg.b.sit.4.cn VITE_AIPI_XKLINKTO_URL=https://kz.b.sit.4.cn # 工作室/笔记本前端地址(用于 auth/callback 等跳转) VITE_AIPI_FRONTEND_URL=https://knowledgetoolserver.b.sit.4.cn -# 工作室侧边栏显示开关;仅控制入口显示,展开内容仍依赖 notebook 接口成功返回数据 -VITE_STUDIO_ENABLED=true # 可选:Canvas 独立 LangGraph 地址 # VITE_CANVAS_LANGGRAPH_BASE_URL= diff --git a/frontend-web/src/components/assistant-ui/document-upload-popup.tsx b/frontend-web/src/components/assistant-ui/document-upload-popup.tsx index 4f5587a5..6fbb5e57 100644 --- a/frontend-web/src/components/assistant-ui/document-upload-popup.tsx +++ b/frontend-web/src/components/assistant-ui/document-upload-popup.tsx @@ -50,7 +50,7 @@ function getYUserId(): string { const obj = JSON.parse(raw) as { yUserId?: string }; if (obj?.yUserId) return obj.yUserId; } - } catch {} + } catch { } return "1157761008018653184"; } @@ -72,6 +72,23 @@ interface DocumentUploadDialogContextType { mode?: "search", data?: { query: string; mode: string } ) => Promise; + // 上传成功回调,返回上传的来源信息 + onUploadComplete?: (sources: Array<{ id?: number; title: string; task_id?: string; status: string }>) => void; +} + +// ── 任务轮询类型 ───────────────────────────────────────────── +interface TaskSource { + task_id: string; + title: string; + status: 'processing' | 'success' | 'error'; + source_type: string; +} + +interface UploadResponse { + status: string; + uploaded: number; + skipped: number; + sources: TaskSource[]; } interface listDataItem { @@ -83,6 +100,10 @@ interface listDataItem { title: string; content: string; url: string; + // 上传文件轮询相关字段 + task_id?: string; + processing_status?: 'processing' | 'success' | 'error'; + is_uploaded_file?: boolean; country?: string; dateOfBirth?: string; occupationData?: string; @@ -188,9 +209,10 @@ export const DocumentUploadDialogProvider: FC<{ mode?: "search", data?: { query: string; mode: string } ) => void | Promise; - searchSpace: { id: number | string; [key: string]: unknown }; + searchSpace: { id: number | string;[key: string]: unknown }; onUploadSuccess?: () => void; -}> = ({ children, onClose, searchSpace, onUploadSuccess }) => { + onUploadComplete?: (sources: Array<{ id?: number; title: string; task_id?: string; status: string }>) => void; +}> = ({ children, onClose, searchSpace, onUploadSuccess, onUploadComplete }) => { const [isOpen, setIsOpen] = useState(false); const [initialSearchText, setInitialSearchText] = useState(""); const isClosingRef = useRef(false); @@ -236,7 +258,7 @@ export const DocumentUploadDialogProvider: FC<{ ); return ( - + {children} void; - searchSpace: { id: number | string; [key: string]: unknown }; + searchSpace: { id: number | string;[key: string]: unknown }; onUploadSuccess?: () => void; closeDialog: ( mode?: "search", @@ -265,12 +287,15 @@ const DocumentUploadPopupContent: FC<{ ) => Promise; initialSearchText?: string; }> = ({ isOpen, onOpenChange, searchSpace, onUploadSuccess, initialSearchText }) => { + const { onUploadComplete } = useContext(DocumentUploadDialogContext) || {}; const searchSpaceId = String(searchSpace?.id); - const backendUrl = - typeof window !== "undefined" - ? (import.meta.env.VITE_BACKEND_BASE_URL || "http://localhost:8001") - : "http://localhost:8001"; - const consumerUrl = "http://ch1.b.uat.4.cn/consumer"; + + // 从环境变量获取配置 + const backendUrl = import.meta.env.VITE_AIPI_BACKENP_URL || "http://localhost:8001"; + const consumerUrl = import.meta.env.VITE_AIPI_CONSUMER_URL || "http://ch1.b.uat.4.cn/consumer"; + const presentUrl = import.meta.env.VITE_AIPI_PRESENT_URL || "http://present.a.uat.4.cn/present/domain"; + const knowesUrl = import.meta.env.VITE_AIPI_KNOWES_URL || "http://ch1.b.uat.4.cn/knowes"; + const knowledgeUrl = import.meta.env.VITE_AIPI_KNOWLEDGE_URL || "http://chlib.b.uat.4.cn/knowlibrary"; const [searchText, setSearchText] = useState(""); const [searchValue, setSearchValue] = useState(""); @@ -321,8 +346,19 @@ const DocumentUploadPopupContent: FC<{ body: formData, }); if (res.ok) { - toast.success("上传成功"); - handleSuccess(); + const data = await res.json() as UploadResponse; + // 调用上传完成回调,传递来源信息 + if (data.sources && data.sources.length > 0) { + onUploadComplete?.(data.sources.map(s => ({ + id: undefined, // 后端返回的数据中暂时没有 id + title: s.title, + task_id: s.task_id, + status: s.status, + }))); + } + toast.success(`上传成功 ${data.uploaded || files.length} 个文件`); + // 只关闭上传弹窗 + onOpenChange(false); } else { toast.error("上传失败,请重试"); } @@ -414,7 +450,7 @@ const DocumentUploadPopupContent: FC<{ item.title = item.name || ""; item.content = item.abstractz || ""; const redirect = urlSafeBtoa(`/gene/#/human/basic?mid=${item.id}`); - item.url = `http://present.a.uat.4.cn/present/domain?inredirect=${redirect}`; + item.url = `${presentUrl}?inredirect=${redirect}`; }); setListData(result); } @@ -437,7 +473,7 @@ const DocumentUploadPopupContent: FC<{ item.title = item.name || ""; item.content = item.abstractz || ""; const redirect = urlSafeBtoa(`/gene/#/organization/basicAttr?mid=${item.mongoId}`); - item.url = `http://present.a.uat.4.cn/present/domain?inredirect=${redirect}`; + item.url = `${presentUrl}?inredirect=${redirect}`; }); setListData(result); } @@ -461,7 +497,7 @@ const DocumentUploadPopupContent: FC<{ item.title = item.community_name || ""; item.content = item.community_description || ""; const redirect = urlSafeBtoa(`/gene/#/commune/basicCommune?cid=${item.id}`); - item.url = `http://present.a.uat.4.cn/present/domain?inredirect=${redirect}`; + item.url = `${presentUrl}?inredirect=${redirect}`; }); setListData(result); } @@ -483,7 +519,7 @@ const DocumentUploadPopupContent: FC<{ item.title = item.issue_name || ""; item.content = item.issue_type || ""; const redirect = encodeURIComponent(`/gene/#/issue/zzyyIssue?mid=${item.id}&event_type=issue`); - item.url = `http://present.a.uat.4.cn/present/domain?inredirect=${redirect}`; + item.url = `${presentUrl}?inredirect=${redirect}`; }); setListData(result); } @@ -504,7 +540,7 @@ const DocumentUploadPopupContent: FC<{ result.forEach((item) => { item.checked = false; const redirect = urlSafeBtoa(`/gene/#/event/basicEvent?event_type=hot&mid=${item.id}`); - item.url = `http://present.a.uat.4.cn/present/domain?inredirect=${redirect}`; + item.url = `${presentUrl}?inredirect=${redirect}`; }); setListData(result); } @@ -526,7 +562,7 @@ const DocumentUploadPopupContent: FC<{ results.forEach((item) => { item.checked = false; const redirect = urlSafeBtoa(`/gene/#/event/basicEvent?event_type=hot&mid=${item.id}`); - item.url = `http://present.a.uat.4.cn/present/domain?inredirect=${redirect}`; + item.url = `${presentUrl}?inredirect=${redirect}`; }); result = [...result, ...results]; } @@ -614,9 +650,8 @@ const DocumentUploadPopupContent: FC<{