Explorar o código

修复类型匹配问题

537yaha hai 6 meses
pai
achega
07e7287a00

+ 6 - 2
frontend/app/agent/dashboard/page.tsx

@@ -1,7 +1,11 @@
+import { Suspense } from "react";
 import { DashboardShell } from "@/components/dashboard/DashboardShell";
 
 export default function AgentDashboardPage() {
-  // 页面采用纯客户端渲染,所有业务逻辑由 DashboardShell 承担
-  return <DashboardShell />;
+  return (
+    <Suspense fallback={<div className="flex justify-center items-center min-h-screen bg-background"><div className="text-muted-foreground">加载中...</div></div>}>
+      <DashboardShell />
+    </Suspense>
+  );
 }
 

+ 3 - 3
frontend/components/visitor/ChatWidget.tsx

@@ -260,9 +260,9 @@ export function ChatWidget({ visitorId, isOpen, onToggle }: ChatWidgetProps) {
         return;
       }
       
-      // 如果是客服发送的消息(不是访客自己发送的),播放提示音
-      if (message.sender_is_agent) {
-        playNotificationSound(soundEnabled);
+      // 如果是客服发送的消息(不是访客自己发送的)且开启声音,播放提示音
+      if (message.sender_is_agent && soundEnabled) {
+        playNotificationSound();
       }
       
       setMessages((prev) => {

+ 1 - 1
frontend/features/agent/hooks/useMessages.ts

@@ -234,7 +234,7 @@ export function useMessages({
     (message: MessageItem) => {
       // 如果是访客发送的消息(不是客服自己发送的),播放提示音
       if (!message.sender_is_agent && soundEnabled) {
-        playNotificationSound(soundEnabled);
+        playNotificationSound();
       }
       
       // 检查对话是否存在

+ 7 - 2
frontend/lib/constants/agent-pages.tsx

@@ -52,6 +52,7 @@ export const AGENT_PAGES = [
     label: "对话",
     title: "对话",
     Icon: MessageCircle,
+    adminOnly: false,
     isChatPage: true,
   },
   {
@@ -59,6 +60,7 @@ export const AGENT_PAGES = [
     label: "知识库测试",
     title: "知识库测试",
     Icon: Lightbulb,
+    adminOnly: false,
     isChatPage: true,
   },
   {
@@ -66,6 +68,7 @@ export const AGENT_PAGES = [
     label: "知识库",
     title: "知识库",
     Icon: BookOpen,
+    adminOnly: false,
     component: KnowledgePage,
   },
   {
@@ -73,6 +76,7 @@ export const AGENT_PAGES = [
     label: "事件管理",
     title: "事件管理",
     Icon: ClipboardList,
+    adminOnly: false,
     component: FAQsPage,
   },
   {
@@ -88,17 +92,18 @@ export const AGENT_PAGES = [
     label: "AI 配置",
     title: "AI 配置",
     Icon: Settings,
+    adminOnly: false,
     component: SettingsPage,
   },
 ] as const;
 
 export type NavigationPage = (typeof AGENT_PAGES)[number]["id"];
 
-const VALID_PAGE_IDS = new Set(AGENT_PAGES.map((p) => p.id));
+const VALID_PAGE_IDS = new Set<string>(AGENT_PAGES.map((p) => p.id));
 
 export function getPageFromSearchParams(searchParams: URLSearchParams | null): NavigationPage {
   const p = searchParams?.get("page") ?? null;
-  if (p && VALID_PAGE_IDS.has(p)) return p as NavigationPage;
+  if (p != null && VALID_PAGE_IDS.has(p)) return p as NavigationPage;
   return "dashboard";
 }