diff --git a/nac-admin/client/src/App.tsx b/nac-admin/client/src/App.tsx new file mode 100644 index 0000000..16c1105 --- /dev/null +++ b/nac-admin/client/src/App.tsx @@ -0,0 +1,61 @@ +import { Toaster } from "@/components/ui/sonner"; +import { TooltipProvider } from "@/components/ui/tooltip"; +import NotFound from "@/pages/NotFound"; +import { Route, Switch } from "wouter"; +import ErrorBoundary from "./components/ErrorBoundary"; +import { ThemeProvider } from "./contexts/ThemeContext"; +import Login from "./pages/Login"; +import Dashboard from "./pages/Dashboard"; +import KnowledgeBase from "./pages/KnowledgeBase"; +import Crawlers from "./pages/Crawlers"; +import ApprovalCases from "./pages/ApprovalCases"; +import TagEngine from "./pages/TagEngine"; +import ProtocolRegistry from "./pages/ProtocolRegistry"; +import AuditLog from "./pages/AuditLog"; +import AIAgents from "./pages/AIAgents"; +import NotificationSettings from "./pages/NotificationSettings"; +import ArchiveManagement from "./pages/ArchiveManagement"; +import RegulatoryMonitor from "./pages/RegulatoryMonitor"; +import KnowledgeAnalytics from "./pages/KnowledgeAnalytics"; +import ConflictDetector from "./pages/ConflictDetector"; +import ChainValidation from "./pages/ChainValidation"; +import AdminLayout from "./components/AdminLayout"; + +function Router() { + return ( + + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + } /> + } /> + } /> + } /> + } /> + } /> + + + + ); +} + +function App() { + return ( + + + + + + + + + ); +} + +export default App; diff --git a/nac-admin/client/src/pages/AIAgents.tsx b/nac-admin/client/src/pages/AIAgents.tsx index 1b5e65e..171e1cb 100644 --- a/nac-admin/client/src/pages/AIAgents.tsx +++ b/nac-admin/client/src/pages/AIAgents.tsx @@ -9,9 +9,8 @@ import { Send, Bot, User, Loader2, Sparkles, AlertCircle, CheckCircle2, Info, MessageSquare, Plus, Trash2, Clock, ChevronDown, ChevronUp, - ExternalLink, Zap, SquarePen, + ExternalLink, Zap, SquarePen, LogIn, UserPlus, LogOut, } from "lucide-react"; -import { useLocation } from "wouter"; // ─── 类型定义 ───────────────────────────────────────────────────── type AgentType = "knowledge_qa" | "compliance" | "translation" | "approval_assist"; @@ -39,12 +38,16 @@ const ICON_MAP: Record = { }; const AGENT_LABELS: Record = { - knowledge_qa: { name: "知识问答", desc: "NAC公链技术与规则", color: "text-blue-400", icon: "BookOpen" }, - compliance: { name: "合规审查", desc: "RWA合规与监管分析", color: "text-red-400", icon: "Shield" }, - translation: { name: "多语翻译", desc: "10种语言专业翻译", color: "text-green-400", icon: "Languages" }, - approval_assist: { name: "审批助手", desc: "资产审批流程辅助", color: "text-purple-400", icon: "ClipboardCheck" }, + knowledge_qa: { name: "知识问答", desc: "NAC公链技术与规则", color: "text-blue-400", icon: "BookOpen" }, + compliance: { name: "合规审查", desc: "RWA合规与监管分析", color: "text-red-400", icon: "Shield" }, + translation: { name: "多语翻译", desc: "10种语言专业翻译", color: "text-green-400", icon: "Languages" }, + approval_assist: { name: "审批助手", desc: "资产审批流程辅助", color: "text-purple-400", icon: "ClipboardCheck" }, }; +// NAC 注册/登录地址 +const NAC_REGISTER_URL = "https://id.newassetchain.io/"; +const NAC_LOGIN_URL = "https://id.newassetchain.io/"; + // ─── 置信度徽章 ─────────────────────────────────────────────────── function ConfidenceBadge({ confidence }: { confidence: number }) { const pct = Math.round(confidence * 100); @@ -63,7 +66,7 @@ function SourceBadge({ source, onClick }: { source: string; onClick: () => void + {/* 历史会话(仅登录用户) */} + {currentUser && ( +
+ - {showHistory && ( -
- {conversations.length === 0 ? ( -

暂无历史会话

- ) : ( - conversations.map(conv => ( - handleSelectConversation(conv)} - onDelete={() => deleteConvMutation.mutate({ conversationId: conv.conversationId })} - /> - )) - )} + {showHistory && ( +
+ {conversations.length === 0 ? ( +

暂无历史会话

+ ) : ( + conversations.map(conv => ( + handleSelectConversation(conv)} + onDelete={() => deleteConvMutation.mutate({ conversationId: conv.conversationId })} + /> + )) + )} +
+ )} +
+ )} + + {/* 未登录时:引导提示 */} + {!currentUser && ( +
+
+

登录后可保存对话历史

+

参与即是共识 · CBPP原则

- )} -
+
+ )} {/* ══════════════════════════════════════════ @@ -468,6 +484,7 @@ export default function AIAgents() { {/* 顶部栏 */}
+ {/* 左:AI 信息 */}
{agentInfo && (() => { @@ -482,6 +499,8 @@ export default function AIAgents() {

+ + {/* 右:用户区域 */}
{activeConvId && ( +
+ ) : ( + /* 未登录:登录 + 注册按钮 */ +
+ + + 登录 + + + + 注册 + +
+ )}
@@ -521,7 +583,7 @@ export default function AIAgents() { {/* 消息列表 */} {messages.map((msg, i) => ( - + ))} {/* AI 思考中 */} @@ -577,7 +639,7 @@ export default function AIAgents() {

- NAC公链AI 基于 NAC 原生知识库提供参考,重要合规决策请咨询专业法律顾问 + NAC公链AI 基于 NAC 原生知识库提供参考 · 参与即是共识 · CBPP原则

diff --git a/nac-admin/nginx/chat.newassetchain.io.conf b/nac-admin/nginx/chat.newassetchain.io.conf new file mode 100644 index 0000000..ad5d6f8 --- /dev/null +++ b/nac-admin/nginx/chat.newassetchain.io.conf @@ -0,0 +1,40 @@ +# chat.newassetchain.io - NAC公链AI 对话界面 +# 代理到 nac-admin 服务(端口 9560),路由 /ai-agents + +server { + listen 80; + server_name chat.newassetchain.io; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + server_name chat.newassetchain.io; + + ssl_certificate /root/ssl/_.newassetchain.io.pem; + ssl_certificate_key /root/ssl/_.newassetchain.io.key; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:10m; + ssl_session_timeout 10m; + + # 访问根路径直接重定向到 /ai-agents + location = / { + return 301 https://$host/ai-agents; + } + + # 所有请求代理到 nac-admin 服务 + location / { + proxy_pass http://127.0.0.1:9560; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 300s; + proxy_connect_timeout 75s; + } +}