diff --git a/web-code/App.css b/web-code/App.css new file mode 100644 index 00000000..a7b94ee4 --- /dev/null +++ b/web-code/App.css @@ -0,0 +1,383 @@ +#root { + margin: 0 auto; +} + +:root { + /* 深色主题(默认) */ + --bg: #0f1117; + --surface: #161b22; + --card: #1c2128; + --border: #30363d; + --text: #e6edf3; + --text-muted: #8b949e; + --accent: #58a6ff; + --green: #3fb950; + --yellow: #d29922; + --red: #f85149; + --purple: #8957e5; + + --phase-starting: var(--accent); + --phase-diverging: var(--yellow); + --phase-closing: var(--green); + --phase-done: var(--purple); + + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; + /* font-size: 14px; */ + line-height: 1.6; + color: var(--text); + background: var(--bg); +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} + +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} + +.logo.react:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +@keyframes logo-spin { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +} + +@media (prefers-reduced-motion: no-preference) { + a:nth-of-type(2) .logo { + animation: logo-spin infinite 20s linear; + } +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} + + +/* 多智能体检索 */ +/* 浅色主题 */ +[data-theme="light"] { + --bg: #f5f7fa; + --surface: #ffffff; + --card: #f0f2f5; + --border: #e2e8f0; + --text: #1a202c; + --text-muted: #718096; + --accent: #3182ce; + --green: #38a169; + --yellow: #d69e2e; + --red: #e53e3e; + --purple: #805ad5; +} + +body { + background: var(--bg); + color: var(--text); + min-height: 100vh; +} + +#root { + min-height: 100vh; + display: flex; + flex-direction: column; +} + +/* App layout */ +.app { + display: flex; + flex-direction: column; + min-height: 100vh; +} + +/* Idle: centered form */ +.app-idle { + position: relative; + display: flex; + align-items: flex-start; + justify-content: center; + min-height: 100vh; + padding: 24px; + background: var(--bg); +} + +.app-idle-header { + position: absolute; + top: 16px; + right: 16px; +} + +.app-idle-scroll { + align-items: flex-start; + overflow-y: auto; +} + +/* Running / done: two-column */ +.app-running { + display: flex; + flex-direction: column; + height: 100vh; + overflow: hidden; +} + +.app-header { + background: var(--surface); + border-bottom: 1px solid var(--border); + padding: 10px 16px; + display: flex; + align-items: center; + gap: 12px; + flex-shrink: 0; +} + +.app-header-logo { + font-weight: 700; + /* font-size: 15px; */ + color: var(--accent); + letter-spacing: 0.5px; +} + +.app-header-task { + flex: 1; + color: var(--text-muted); + /* font-size: 13px; */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.app-header-actions { + display: flex; + gap: 8px; + align-items: center; +} + +/* 主题切换按钮 */ +.theme-toggle { + background: transparent; + border: 1px solid var(--border); + color: var(--text-muted); + padding: 4px 10px; + border-radius: 4px; + cursor: pointer; + /* font-size: 12px; */ + display: flex; + align-items: center; + gap: 4px; + transition: all 0.2s; +} + +.theme-toggle:hover { + color: var(--text); + border-color: var(--text-muted); + background: var(--card); +} + +.app-body { + display: flex; + flex: 1; + overflow: hidden; +} + +.app-sidebar { + width: 240px; + flex-shrink: 0; + overflow-y: auto; + border-right: 1px solid var(--border); + background: var(--surface); +} + +.app-main { + flex: 1; + overflow-y: auto; + padding: 20px; +} + +.app-progress-sidebar { + width: 300px; + flex-shrink: 0; + overflow-y: auto; + border-left: 1px solid var(--border); + background: var(--surface); +} + +/* Buttons */ +button { + cursor: pointer; + border: none; + border-radius: 6px; + padding: 7px 16px; + /* font-size: 13px; */ + font-family: inherit; + transition: opacity 0.15s, background 0.15s; +} + +button:disabled { + opacity: 0.5; + cursor: not-allowed; +} + +.btn-primary { + background: var(--accent); + color: #000; + font-weight: 600; +} + +.btn-primary:hover:not(:disabled) { + opacity: 0.85; +} + +.btn-danger { + background: transparent; + color: var(--red); + border: 1px solid var(--red); +} + +.btn-danger:hover:not(:disabled) { + background: rgba(248, 81, 73, 0.1); +} + +.btn-secondary { + background: transparent; + color: var(--text-muted); + border: 1px solid var(--border); +} + +.btn-secondary:hover:not(:disabled) { + color: var(--text); + border-color: var(--text-muted); +} + +.btn-ghost { + background: transparent; + color: var(--text-muted); + padding: 4px 8px; + /* font-size: 12px; */ +} + +.btn-ghost:hover { + color: var(--text); +} + +/* Badges */ +.badge { + display: inline-block; + padding: 2px 8px; + border-radius: 12px; + /* font-size: 11px; */ + font-weight: 600; + letter-spacing: 0.3px; +} + +.badge-starting { background: rgba(88, 166, 255, 0.15); color: var(--accent); } +.badge-diverging { background: rgba(210, 153, 34, 0.15); color: var(--yellow); } +.badge-closing { background: rgba(63, 185, 80, 0.15); color: var(--green); } +.badge-done { background: rgba(137, 87, 229, 0.15); color: var(--purple); } +.badge-default { background: rgba(139, 148, 158, 0.15); color: var(--text-muted); } + +/* Spinner */ +@keyframes spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} + +.spinner { + display: inline-block; + animation: spin 1s linear infinite; +} + +/* Reference cite */ +.ref-cite { + display: inline-block; + background: rgba(88, 166, 255, 0.2); + color: var(--accent); + border-radius: 4px; + padding: 0 3px; + font-family: 'SFMono-Regular', Consolas, monospace; + /* font-size: 11px; */ + cursor: pointer; + position: relative; +} + +.ref-cite:hover::after { + content: attr(data-tooltip); + position: absolute; + bottom: calc(100% + 4px); + left: 50%; + transform: translateX(-50%); + background: var(--card); + border: 1px solid var(--border); + color: var(--text); + padding: 4px 8px; + border-radius: 4px; + /* font-size: 11px; */ + white-space: nowrap; + z-index: 100; + font-family: inherit; + pointer-events: none; + max-width: 300px; + overflow: hidden; + text-overflow: ellipsis; +} + +/* Error banner */ +.error-banner { + background: rgba(248, 81, 73, 0.1); + border: 1px solid var(--red); + border-radius: 6px; + padding: 8px 12px; + color: var(--red); + /* font-size: 13px; */ + margin-bottom: 12px; +} + +@media (max-width: 1200px) { + .app-progress-sidebar { + width: 260px; + } +} + +@media (max-width: 960px) { + .app-body { + flex-direction: column; + } + + .app-sidebar, + .app-progress-sidebar { + width: 100%; + border-right: none; + border-left: none; + border-bottom: 1px solid var(--border); + max-height: 260px; + } + + .app-main { + padding: 14px; + } +} + + +@keyframes qa-typing-dot { + 0%, 80%, 100% { + transform: translateY(0); + opacity: 0.35; + } + + 40% { + transform: translateY(-5px); + opacity: 1; + } +} \ No newline at end of file diff --git a/web-code/App.tsx b/web-code/App.tsx new file mode 100644 index 00000000..91feb81f --- /dev/null +++ b/web-code/App.tsx @@ -0,0 +1,798 @@ +import { + Routes, + Route, + useLocation, + useParams, + Navigate, + useNavigate, + useSearchParams, +} from "react-router-dom"; +import "./App.css"; +import { ThemeProvider } from "./contexts/ThemeContext"; +import { ChatProvider } from "./contexts/ChatContext"; +import Sidebar, { PageType } from "./components/Sidebar"; +import Header from "./components/Header"; +import SceneList from "./pages/SceneList"; +import SceneDetail from "./pages/SceneDetail"; +import AgentList from "./pages/AgentList"; +import AgentDetail from "./pages/AgentDetail"; +import AgentTrial from "./pages/AgentTrial"; +import TaskList from "./components/taskManagement/TaskList"; +import TaskCreate from "./components/taskManagement/TaskCreate"; +import TaskSingle from "./components/taskManagement/TaskSingle"; +import TaskWorkspace from "./components/taskManagement/TaskWorkspace"; +import TaskConsultCreate from "./components/taskManagement/TaskConsultCreate"; +import TaskConsult from "./components/taskManagement/TaskConsult"; +import TaskConsultResult from "./components/taskManagement/TaskConsultResult"; +import StrategyResult from "./pages/StrategyResult"; +import FinalPlan from "./pages/FinalPlan"; +import SystemSettings from "./pages/SystemSettings"; +import TaskDashboard from "./components/taskManagement/TaskDashboard"; +import TaskListPage from "./components/taskManagement/TaskListPage"; +import QA from "./pages/QA"; +import QARecords from "./pages/QARecords"; +import ResultManagement from "./pages/ResultManagement"; +import ResultDetail from "./pages/ResultDetail"; +import ZZResourceManagement from "./pages/ZZResourceManagement"; +import NetworkActorResourceManagement from "./pages/NetworkActorResourceManagement"; +import KnowledgeBaseResourceManagement from "./pages/KnowledgeBaseResourceManagement"; +import EvaluationIndexResourceManagement from "./pages/EvaluationIndexResourceManagement"; +import LightAppSquare from "./pages/LightAppSquare"; +import LightAppRun from "./pages/LightAppRun"; +import LightAppRecords from "./pages/LightAppRecords"; +import { LightAppType } from "./pages/LightAppSquare"; +import { MessagePlugin, Button, Space } from "tdesign-react"; +import { useState, useEffect } from "react"; +import TaskManagement from "./pages/TaskManagement"; +import TaskAnalyzes from "./components/taskManagement/TaskAnalyzes"; +import SentimentAnalyzes from "./components/taskManagement/SentimentAnalyzes"; +import { ActionAnalyzes } from "./components/taskManagement/ActionAnalyzes"; +import MopeChat from "./components/qa/MopeChat"; + +import QACenterPage from "./components/qa/QACenterPage"; +import GeneralQA from "./components/qa/GeneralQa"; +import AgentQA from "./components/qa/AgentQA"; +import CollaborativeQA from "./components/qa/CollaborativeQA"; +import ResultManagementLayout from "./components/result/ResultManagementLayout"; +import ResultPlanning from "./components/result/ResultPlanning"; +import ResultMnty from "./components/result/ResultMnty"; +import ResultEffectPg from "./components/result/ResultEffectPg"; +import ResultXk from "./components/result/ResultXk"; +import ResultDq from "./components/result/ResultDq"; +import ResultOther from "./components/result/ResultOther"; +import ExpertsAgentsPage from "./pages/AgentListExperts"; +import AgentExpertCenterPage from "./components/agent/AgentExpertCenterPage"; +import AgentExpertEditPage from "./components/agent/AgentExpertEditPage"; +import AgentChatPage from "./components/agent/AgentChatPage"; +import SkillsWorkshop from "./components/agent/SkillsWorkshop"; +import SkillCreatorPage from "./components/agent/SkillCreatorPage"; +import TemplateEditor from "./components/qa/TemplateEditor"; +import Template6BEditor from "./components/qa/Template6BEditor"; +import SixStepChatPage from "./components/angentchat/SixStepChatPage"; +import TopicResearch from "./components/qa/TopicResearch"; +// import Login from './pages/Login'; +import TaskChat from "./components/qa/TaskChat"; +import ActionChat from "./components/qa/ActionChat"; +import GAFromQA from "./components/qa/GAFrom"; +import XingdongTyPage from "./components/taskManagement/XingdongTy"; +import FanganTyPage from "./components/taskManagement/FanganTy"; +import XXTyPage from "./components/taskManagement/XxTy"; +import ObservabilityPage from './pages/ObservabilityPage'; +import AgentCardList from './components/angentchat/AgentCardList'; +import AgentEditPage from './components/angentchat/AgentEditPage'; +import FileSkillsWorkshop from './components/agent/FileSkillsWorkshop'; +import TaskPgFrom from './components/taskManagement/TaskPgFrom'; +import Login from './pages/Login'; +import TaskXkFrom from "./components/taskManagement/TaskXkFrom"; +import GAFromNewQA from "./components/qa/GAFromNew"; + +function AppContent() { + const location = useLocation(); + const params = useParams(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + + // 从查询参数中获取appId + const appIdFromQuery = searchParams.get("appId"); + + // 页面初始化时打印params + useEffect(() => { + console.log("页面初始化,当前params:", params); + console.log("查询参数appId:", appIdFromQuery); + }, []); + + // 从路径中提取当前页面ID,忽略层级结构 + const getCurrentPageFromPath = (path: string): PageType => { + console.log(path, "path"); + const parts = path.split("/").filter(Boolean); + if (parts.length === 0) return "dashboard"; + + // 提取最后一个部分作为页面ID + let pageId = parts[parts.length - 1]; + + // 处理特殊情况 + if (pageId === "index") { + pageId = parts[parts.length - 2] || "dashboard"; + } + + return pageId as PageType; + }; + + const currentPage = getCurrentPageFromPath(location.pathname); + + const getTaskMenuConfig = (page: PageType) => { + const configs: Record< + string, + { title: string; category: string; subCategory: string } + > = { + "xk-task-jc": { + title: "任务JC", + category: "XK任务", + subCategory: "XK任务", + }, + "xk-task-dispatch": { + title: "任务调度", + category: "XK任务", + subCategory: "XK任务", + }, + "plan-task-fx": { + title: "任务FX", + category: "规划任务", + subCategory: "规划任务", + }, + "plan-task-action": { + title: "行动CE", + category: "规划任务", + subCategory: "规划任务", + }, + "mnty-task-mechanism": { + title: "XDTY任务", + category: "MNTY任务", + subCategory: "MNTY任务", + }, + "mnty-task-plan": { + title: "方案TY任务", + category: "MNTY任务", + subCategory: "MNTY任务", + }, + "mnty-task-zsty": { + title: "XXTY任务", + category: "MNTY任务", + subCategory: "MNTY任务", + }, + "effect-task-pg": { + title: "任务PG", + category: "效果PG任务", + subCategory: "效果PG任务", + }, + "effect-action-pg": { + title: "行动PG", + category: "效果PG任务", + subCategory: "效果PG任务", + }, + "effect-info-pg": { + title: "信息PG", + category: "效果PG任务", + subCategory: "效果PG任务", + }, + "effect-account-pg": { + title: "账号PG", + category: "效果PG任务", + subCategory: "效果PG任务", + }, + }; + return ( + configs[page] || { title: "任务管理", category: "", subCategory: "" } + ); + }; + + const isTaskSubMenuPage = (page: PageType): boolean => { + return [ + "xk-task-jc", + "xk-task-dispatch", + "plan-task-fx", + "plan-task-action", + "mnty-task-mechanism", + "mnty-task-plan", + "mnty-task-zsty", + "effect-task-pg", + "effect-action-pg", + "effect-info-pg", + "effect-account-pg", + ].includes(page); + }; + + const handleNavigate = (page: PageType, appId?: string) => { + console.log("导航到:", page, appId); + + // 根据页面ID构建正确的导航路径 + let path = `/${page}`; + + // 任务管理下的子页面 + if ( + page.startsWith("xk-task") || + page.startsWith("plan-task") || + page.startsWith("mnty-task") || + page.startsWith("effect-task") + ) { + const taskType = page.split("-")[0] + "-" + page.split("-")[1]; + path = `/task-management/${taskType}/${page}`; + } + // 任务管理下的其他页面 + else if ( + [ + "dashboard", + "task-create", + "task-single", + "task-scene", + "task-consult-create", + "task-consult", + "task-consult-result", + "task-list", + ].includes(page) + ) { + path = `/task-management/${page}`; + } + // 问答中心下的子页面 + else if ( + [ + "new-qa", + "general-qa", + "agent-qa", + "multi-agent-qa", + "qa-records", + ].includes(page) + ) { + path = `/qa-center/${page}`; + } + // 轻应用中心下的子页面 + else if ( + ["light-app-square", "light-app-records", "light-app-run"].includes(page) + ) { + path = `/light-app-center/${page}`; + // 如果是light-app-run且有appId,添加到路径 + if (page === "light-app-run" && appId) { + path = `/light-app-center/light-app-run?appId=${appId}`; + } + } + // 智能体管理下的子页面 + else if (["agent-trial"].includes(page)) { + path = `/agent-list/${page}`; + } + // 结果管理下的子页面 + else if ( + [ + "result-planning", + "result-mnty", + "result-effect-pg", + "result-xk", + "result-dq", + "result-other", + "result-detail", + ].includes(page) + ) { + path = `/result-management/${page}`; + } + // 资源管理下的子页面 + else if ( + [ + "resource-zz", + "resource-network-actor", + "resource-knowledge-base", + "resource-evaluation-index", + ].includes(page) + ) { + path = `/resource-management/${page}`; + } + + navigate(path); + }; + + return ( +
+ +
+
+
+ {appIdFromQuery} + + } /> + + {/* 问答中心 */} + {/* } /> + } /> + } /> + } /> + } /> + } /> */} + {/* 问答中心 - 嵌套路由 */} + }> + {/* 默认重定向到通用问答页面 */} + } + /> + {/* 新建问答页面 - 初始化模式为新建 */} + + } + /> + {/* 通用问答页面 - 初始化模式为通用 */} + + } + /> + {/* 智能体问答页面 - 基于AI智能体的问答功能 */} + } + /> + {/* 多智能体协作问答页面 - 多个AI智能体协同回答问题 */} + } + /> + {/* 问答记录 */} + } + /> + } /> + } /> + } /> + } /> + {/* + } + /> */} + + } + /> + + } + /> + + } + /> + } /> + } /> + } /> + } /> + } /> + + {/* 轻应用中心 */} + } + /> + } + /> + } + /> + + + } + /> + {/* 任务管理 */} + }> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + + navigate(`/task-management/task-scene/${id}`) + } + onNavigate={handleNavigate} + /> + } + /> + + {/* XK任务 */} + + } + /> + + } + /> + + {/* 规划任务 */} + + } + /> + + } + /> + + } + /> + + {/* MNTY任务 */} + + } + /> + + } + /> + + } + /> + + {/* 效果PG任务 */} + + } + /> + + } + /> + + } + /> + + } + /> + + + {/* 场景管理 */} + navigate(`/scene-detail/${id}`)} + onNavigate={handleNavigate} + /> + } + /> + navigate("/scene-list")} + /> + } + /> + + {/* 智能体管理 */} + navigate(`/agent-detail/${id}`)} + onNavigate={handleNavigate} + /> + } + /> + } + /> + navigate("/agent-list")} + /> + } + /> + } + > + {/* */} + {/* } + /> */} + } + /> + } + /> + } /> + } /> + } /> + navigate(`/sixstep-agent-edit?key=${key}`)} />} + /> + navigate('/sixstep-agents')} + /> + } + /> + } /> + {/* 结果管理 */} + {/* } /> + } /> + } /> + } /> + } /> + } /> + } /> + navigate('/result-management')} />} /> + navigate('/result-management')} />} /> */} + {/* 结果管理 - 嵌套路由 */} + } + > + + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + navigate("/result-management")} + /> + } + /> + navigate("/result-management")} + /> + } + /> + + + {/* 资源管理 */} + } + /> + } + /> + + } + /> + + } + /> + {/* + } + /> */} + + } + /> + + {/* 其他路由 */} + } + /> + } + /> + } + /> + } + /> + } /> + }/> + } /> + +
+
+
+ ); +} + +function App() { + return ( + + + + + + ); +} + +export default App; diff --git a/web-code/assets/icon/default-icon.svg b/web-code/assets/icon/default-icon.svg new file mode 100644 index 00000000..746c61e4 --- /dev/null +++ b/web-code/assets/icon/default-icon.svg @@ -0,0 +1,17 @@ + diff --git a/web-code/assets/icon/information-logo.png b/web-code/assets/icon/information-logo.png new file mode 100644 index 00000000..6a393438 Binary files /dev/null and b/web-code/assets/icon/information-logo.png differ diff --git a/web-code/assets/icon/轻应用logo-DB.svg b/web-code/assets/icon/轻应用logo-DB.svg new file mode 100644 index 00000000..5df2b308 --- /dev/null +++ b/web-code/assets/icon/轻应用logo-DB.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web-code/components/CreateTaskModal.tsx b/web-code/components/CreateTaskModal.tsx new file mode 100644 index 00000000..f5a6883f --- /dev/null +++ b/web-code/components/CreateTaskModal.tsx @@ -0,0 +1,175 @@ +import React, { useState } from 'react'; +import { X, Upload, FileText, Calendar, Users, AlertTriangle } from 'lucide-react'; + +interface CreateTaskModalProps { + isOpen: boolean; + onClose: () => void; + onCreate: (taskData: any) => void; +} + +const CreateTaskModal: React.FC = ({ isOpen, onClose, onCreate }) => { + const [formData, setFormData] = useState({ + name: '', + description: '', + scene: '宣传策略生成', + deadline: '', + resources: '', + constraints: '', + }); + + const handleSubmit = () => { + if (!formData.name || !formData.scene) { + alert('请填写必填项'); + return; + } + onCreate(formData); + onClose(); + }; + + if (!isOpen) return null; + + return ( +
+
+
+ {/* Header */} +
+
+

新建任务

+

创建一个新的宣传策略分析任务

+
+ +
+ + {/* Content */} +
+ {/* Task Name */} +
+ + setFormData({ ...formData, name: e.target.value })} + placeholder="例如:五四青年节宣传活动策略" + className="w-full px-4 py-3 bg-slate-900/50 border border-blue-800/30 rounded-lg text-white placeholder-slate-500 text-sm focus:outline-none focus:border-blue-500/50 transition-colors" + /> +
+ + {/* Task Description */} +
+ +