Quellcode durchsuchen

feat: 添加数据访问详情页

王晓东 vor 1 Monat
Ursprung
Commit
76fc75e87b
34 geänderte Dateien mit 476 neuen und 406 gelöschten Zeilen
  1. 1 0
      src/app.config.ts
  2. 10 14
      src/components/AgentPage/index.tsx
  3. 37 0
      src/components/KnowledgeIcon/index.tsx
  4. 1 1
      src/components/KnowledgeList/index.tsx
  5. 2 2
      src/components/Picker/PickerSingleColumn.tsx
  6. 13 0
      src/components/WeComQRcode/index.tsx
  7. 2 2
      src/components/chat-message/MessageRobot.tsx
  8. 18 5
      src/components/chat-message/MessageRobotRich.tsx
  9. 1 1
      src/components/component-list/components/new-comp-button/index.tsx
  10. 7 3
      src/components/page-custom/index.tsx
  11. 5 24
      src/components/page-wrapper/index.tsx
  12. 51 2
      src/pages/chat/index.tsx
  13. 43 0
      src/pages/dashboard-visited-detail/components/VisitorSummary/index.tsx
  14. 5 0
      src/pages/dashboard-visited-detail/index.config.ts
  15. 5 0
      src/pages/dashboard-visited-detail/index.module.less
  16. 92 0
      src/pages/dashboard-visited-detail/index.tsx
  17. 25 0
      src/pages/dashboard-visited-detail/visitedDetail.ts
  18. 44 25
      src/pages/dashboard/components/VisitorCard/index.tsx
  19. 12 17
      src/pages/dashboard/components/VisitorList/index.tsx
  20. 7 11
      src/pages/dashboard/index.tsx
  21. 3 3
      src/pages/index/components/InitView/index.tsx
  22. 7 5
      src/pages/index/components/WelcomeTips/index.tsx
  23. 1 1
      src/pages/index/index.tsx
  24. 2 6
      src/pages/knowledge/components/CompanyTab/index.tsx
  25. 3 7
      src/pages/knowledge/components/asistant-message/index.tsx
  26. 4 8
      src/pages/knowledge/components/personal-tab/index.tsx
  27. 17 76
      src/pages/knowledge/components/view-style/ViewStyleChat.tsx
  28. 4 70
      src/pages/knowledge/components/view-style/ViewStyleChatEnt.tsx
  29. 2 25
      src/pages/knowledge/components/view-style/ViewStyleList.tsx
  30. 2 25
      src/pages/knowledge/components/view-style/ViewStyleListEnt.tsx
  31. 0 1
      src/service/agent.ts
  32. 9 26
      src/service/visitor.ts
  33. 14 31
      src/store/appStore.ts
  34. 27 15
      src/types/visitor.ts

+ 1 - 0
src/app.config.ts

@@ -4,6 +4,7 @@ export default defineAppConfig({
     'pages/profile/index',
     'pages/login/index',
     'pages/dashboard/index',
+    'pages/dashboard-visited-detail/index',
     'pages/contact/index',
     'pages/knowledge/index',
     'pages/knowledge-item/index',

+ 10 - 14
src/components/AgentPage/index.tsx

@@ -1,10 +1,10 @@
 import NavBarNormal from "@/components/nav-bar-normal";
 
-import { Image, Text, View } from "@tarojs/components";
+import { View } from "@tarojs/components";
 import Logo from "@/components/logo";
 import SummaryBar from "./components/SummaryBar";
 import { useAgentStore } from "@/store/agentStore";
-import { useEffect, useState } from "react";
+import { useEffect } from "react";
 import { useComponentStore } from "@/store/componentStore";
 import ComponentList from "@/components/component-list";
 import { useUserStore } from "@/store/userStore";
@@ -14,29 +14,25 @@ interface IProps {
   agentId: string;
 }
 export default function Index({ agentId }: IProps) {
-  const { fetchAgent, fetchAgents } = useAgentStore();
+  const { fetchAgent } = useAgentStore();
   const agent = useAgentStore((state)=> state.agent);
   const { fetchMyEntList } = useUserStore();
   
   const { setComponentList } = useComponentStore()
   const components = useComponentStore((state) => state.components);
 
-  const fetchAgentDetail = async (agentId: string) => {
-    const result = await fetchAgent(agentId);
-    if (result) {
-      const components = result.components ?? []
-      // 过滤掉没有 id 的组件防止有错误数据
-      setComponentList(components.filter(c => !!c.data?.id), agentId);
-    }
-  };
-
   useEffect(() => {
     if (agentId) {
-      fetchAgentDetail(agentId);
-      
+      fetchAgent(agentId)
     }
   }, [agentId]);
 
+  useEffect(()=> {
+    const components = agent?.components ?? []
+    // 过滤掉没有 id 的组件防止有错误数据
+    setComponentList(components.filter(c => !!c.data?.id), agentId);
+  }, [agent])
+
   useEffect(()=> {
     fetchMyEntList()
   }, [])

+ 37 - 0
src/components/KnowledgeIcon/index.tsx

@@ -0,0 +1,37 @@
+import { ScrollView, View, Image } from "@tarojs/components";
+import IconFileLink from "@/components/icon/IconFileLink";
+import IconFileTxt from "@/components/icon/IconFileDOC";
+import IconFilePDF from "@/components/icon/IconFilePDF";
+import IconFileXLSX from "@/components/icon/IconFileXLSX";
+import { TKnowledgeItem } from "@/types/knowledge";
+export interface Iprops {
+  data: TKnowledgeItem
+}
+const KnowledgeIcon = ({data}:Iprops) => {
+  // todo: 更多类型
+  const renderIcon = ()=> {
+    const type = data.type
+    if(type === 'image'){
+      return <Image src={data.picUrl || data.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>
+    }
+    if(type === 'text'){
+      return <IconFileTxt/>
+    }
+    if(type === 'web'){
+      return <IconFileLink/>
+    }
+    if(type === 'video'){
+      return <IconFileLink/>
+    }
+
+    // 默认使用 icon 字段
+    return <Image src={data.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>    
+
+  }
+
+  return <View className="w-36 h-36 overflow-hidden">
+    {renderIcon()}
+  </View>
+}
+
+export default KnowledgeIcon

+ 1 - 1
src/components/KnowledgeList/index.tsx

@@ -5,7 +5,7 @@ import FigureListItem from "@/components/list/figure-list-item";
 import { useEffect } from "react";
 import WemetaRadio from "@/components/wemeta-radio/index";
 
-import IconFIleLink from "@/components/icon/IconFIleLink"
+import IconFIleLink from "@/components/icon/IconFileLink"
 
 
 import { useKnowledge } from "./knowledge";

+ 2 - 2
src/components/Picker/PickerSingleColumn.tsx

@@ -8,7 +8,7 @@ export interface IndexProps {
   showPicker: boolean
   setShowPicker: (show:boolean) => void
   onChange?: (value: string) => void
-  onPicked: (value: string) => void
+  onPicked?: (value: string) => void
   children: JSX.Element|JSX.Element[]
 }
 
@@ -28,7 +28,7 @@ const Index = ({selected, showPicker, setShowPicker,onChange,onPicked, options,
   // 确认选择
   const handleConfirm = () => {
     setShowPicker(false)
-    onPicked(current)
+    onPicked && onPicked(current)
   }
   return <View>
     {children}

+ 13 - 0
src/components/WeComQRcode/index.tsx

@@ -0,0 +1,13 @@
+import { Image } from "@tarojs/components";
+
+const WeComQRcode = () => {
+  return (
+    <Image
+          showMenuByLongpress
+          src="https://cdn.wehome.cn/cmn/jpg/141/META-H8UKWHWU-5YMWRSCR77VBOBA6AANE3-UFEPQICM-26.jpg"
+          style={{ width: "160px", height: "160px" }}
+        />
+  );
+};
+
+export default WeComQRcode;

+ 2 - 2
src/components/chat-message/MessageRobot.tsx

@@ -33,7 +33,7 @@ export default ({agent, text, textReasoning=''}:Props) => {
     }
   }
   return <View>
-      <View className="flex gap-8 mb-10">
+      {agent && <View className="flex gap-8 mb-10">
         <View className={style.avatarContainer}>
           {agent?.avatarUrl && (
             <Image
@@ -44,7 +44,7 @@ export default ({agent, text, textReasoning=''}:Props) => {
           )}
         </View>
         <View className="font-medium text-16 leading-24">{agent?.name}</View>
-      </View>
+      </View>}
 
       <View className={`${style.message } ${style.messageRobot} gap-10`}>
         <View className={style.messageContent}>

+ 18 - 5
src/components/chat-message/MessageRobotRich.tsx

@@ -3,7 +3,8 @@ import ThinkAnimation from "../think-animation/index";
 import style from "./index.module.less";
 interface Props {
   loading?: boolean;
-  analyzeStatus?: 'idle'|'doing'|'done';
+  analyzeStatus?: "idle" | "doing" | "done";
+  content?: string;
   data?: {
     avatar: string;
     name: string;
@@ -11,7 +12,13 @@ interface Props {
   };
   children?: JSX.Element | JSX.Element[];
 }
-export default ({ data, loading, analyzeStatus='idle', children }: Props) => {
+export default ({
+  data,
+  loading,
+  content = '',
+  analyzeStatus = "idle",
+  children,
+}: Props) => {
   return (
     <View className="flex gap-8 items-start">
       <View className={style.avatarContainer}>
@@ -25,10 +32,16 @@ export default ({ data, loading, analyzeStatus='idle', children }: Props) => {
           <View className={`${style.message}  ${style.messageRobotRich}`}>
             <View className={style.messageContent}>
               {loading && <ThinkAnimation></ThinkAnimation>}
-              {analyzeStatus !== 'idle' && (
+              {analyzeStatus !== "idle" && (
                 <View className="flex items-center gap-6">
-                  <View className="text-14 leading-28">{analyzeStatus === 'doing' ? '正在为您解析' : `已成功解析 ${data?.fileLen} 份知识`} </View>
-                  {(analyzeStatus === 'doing') && <ThinkAnimation></ThinkAnimation>}
+                  <View className="text-14 leading-28">
+                    {analyzeStatus === "doing"
+                      ? "正在为您解析"
+                      : content}
+                  </View>
+                  {analyzeStatus === "doing" && (
+                    <ThinkAnimation></ThinkAnimation>
+                  )}
                 </View>
               )}
               {children}

+ 1 - 1
src/components/component-list/components/new-comp-button/index.tsx

@@ -5,6 +5,6 @@ interface Props {
 }
 export default ({index}:Props) => {
   return <View className={`flex items-center justify-center gap-8 py-12 rounded-12 ${style.container}`}>
-    <Text className={`iconfont icon-icon_20_add text-16 ${style.textColor}`}></Text><Text className={`text-14 font-medium leading-28 ${style.textColor}`}>添加组件{index}</Text>
+    <Text className={`iconfont icon-icon_20_add text-16 ${style.textColor}`}></Text><Text className={`text-14 font-medium leading-28 ${style.textColor}`}>添加组件</Text>
   </View>
 }

+ 7 - 3
src/components/page-custom/index.tsx

@@ -9,16 +9,20 @@ interface Props {
   isflex?: boolean; // 有横向滚动的scroll-view 容器不能包裹在 flex comlumn 布局中
   style?: React.CSSProperties;
   paddingTop?: number;
+  fullPage?: boolean;
 }
 
-const Index: React.FC<Props> = ({ children, isflex = true, paddingTop, style }) => {
+const Index: React.FC<Props> = ({ children, isflex = true, fullPage = false,  paddingTop, style }) => {
   const headerHeight = useAppStore((state) => state.headerHeight);
+  const bottomSafeHeight = useAppStore((state) => state.bottomSafeHeight);
   const flexStyle = isflex ? "flex flex-col items-center" : "";
+  const offsetTop = paddingTop ?? headerHeight;
+  const pageHeight = fullPage ? `calc(100vh - ${bottomSafeHeight}px)` : 'auto'
   return (
     <PageWrapper style={style}>
       <View
-          className={`${flexStyle} min-h-screen w-full`}
-          style={{ paddingTop: paddingTop ?? headerHeight }}
+          className={`${flexStyle} h-full w-full`}
+          style={{ paddingTop: offsetTop, height: pageHeight}}
         >
           {children}
         </View>

+ 5 - 24
src/components/page-wrapper/index.tsx

@@ -4,43 +4,24 @@
 import { View, Image } from "@tarojs/components";
 import React from "react";
 import pageStyle from "./index.module.less";
-import PopupVip from '@/components/popup/popup-vip/index'
-import PopupTips from '@/components/popup/popup-tips'
 import { GlobalModal } from '@/components/GlobalModal/index';
-import { useAppStore } from "@/store/appStore";
 interface Props {
   children?: React.ReactChild | React.ReactChild[];
   style?: React.CSSProperties;
+  styleBg?: React.CSSProperties;
 }
 
-const Index: React.FC<Props> = ({ children, style }) => {
+const Index: React.FC<Props> = ({ children, styleBg, style }) => {
   // 是否提示非移动端打开小程序
-  const desktopPopupVisible = useAppStore((state)=> state.desktopPopupTips)
-  const vipPopupVisible = useAppStore((state)=> state.vipPopupVisible)
-  // 全局控制显示 vip 提示
-  const {setVipPopupVisible} = useAppStore()
-
-
+  // const desktopPopupVisible = useAppStore((state)=> state.desktopPopupTips)
   //  盖在背景上面的是视口高度的 渐变色
   return (
-    // ${!style ? "global-gray-bg" : ""} 
     <View className={`relative font-normal text-14 leading-22`}>
-      {/* vip 提示 */}
-      {/* <PopupVip show={vipPopupVisible} onClose={()=> setVipPopupVisible(false)}></PopupVip> */}
-
-      {/* 桌面端提示 */}
-      {/* <PopupTips show={desktopPopupVisible} onClose={()=> {}} contentStyle={{background:'white'}}>
-        <Image src='https://cdn.wehome.cn/cmn/png/134/META-H8UKWHWU-KIWQFXN9CWIKI7PA148U3-CF713F5M-WX1.png' mode="widthFix" className="w-full mt-20 mb-20"></Image>
-        <View>桌面端暂不支持</View>
-        <View>请用手机微信继续体验</View>
-      </PopupTips> */}
       {/* bg 背景图 */}
-      <View style={style} className={pageStyle.bg}></View>
+      <View className={pageStyle.bg}></View>
       {/* cover 背景图覆盖从上至下渐变 */}
       <View className={`global-linear-gradient-bg ${pageStyle.bgVerticalGradient}`}></View>
-      {/* fillBgRest 背景图100vh 视口高度以下填充颜色  */}
-      {/* <View className={pageStyle.fillBgRest}></View> */}
-      <View className="relative z-0">{children}</View>
+      <View className="relative z-0 h-full" style={style}>{children}</View>
       <GlobalModal></GlobalModal>
     </View>
   );

+ 51 - 2
src/pages/chat/index.tsx

@@ -44,6 +44,9 @@ export default function Index() {
   const [histories, setHistories] = useState<(TMessage|TRobotMessage)[]>([]);
   
   const [keyboardHeight, setKeyboardHeight] = useState(0);
+  const [contentHeight, setContentHeight] = useState(0);
+  const [scrollViewHeight, setScrollViewHeight] = useState(0);
+
   const scrollViewRef = useRef<any>(null);
   // const headerHeight = useAppStore((state) => state.headerHeight);
   
@@ -102,8 +105,54 @@ export default function Index() {
   }, [data, page]);
   
   
-
+  // 计算 marginTopOffset 偏移的距离
+  const marginTopOffset = (() => {
+    if (keyboardHeight <= 0) return 0;
+    // 如果内容超过滚动容器,取键盘弹起高度
+    if(contentHeight > scrollViewHeight){
+      return  -(keyboardHeight)
+    }
+    // 如果内容+键盘弹起高度超过滚动容器, 则取其差值
+    if( contentHeight + keyboardHeight > scrollViewHeight){ 
+      // 内容+键盘弹起高度 - 滚动容器高度
+      return -(contentHeight + keyboardHeight - scrollViewHeight)  
+    }
+  })();
   
+  useEffect(() => {
+    // 监听键盘高度变化
+    Taro.onKeyboardHeightChange((res) => {
+      if(res.height <= 0){
+        return setKeyboardHeight(0);
+      }
+      
+      setKeyboardHeight(res.height - 24);
+    });
+
+    return () => {
+      // 清理监听器
+      Taro.offKeyboardHeightChange();
+    };
+  }, []);
+
+  // 监听内容高度和 ScrollView 高度变化
+  useEffect(() => {
+    if (scrollViewRef.current) {
+      const query = Taro.createSelectorQuery();
+      // 获取聊天内容高度
+      query.select('#message-list').boundingClientRect((rect: any) => {
+        if (rect) {
+          setContentHeight(rect.height);
+        }
+      }).exec();
+      // 获取滚动容器高度
+      query.select('#scroll-view').boundingClientRect((rect: any) => {
+        if (rect) {
+          setScrollViewHeight(rect.height);
+        }
+      }).exec();
+    }
+  }, [messageList]);
 
   
   
@@ -134,7 +183,7 @@ export default function Index() {
   return (
     <PageCustom>
       <NavBarNormal scrollFadeIn leftColumn={renderNavLeft}></NavBarNormal>
-      <View className="flex flex-col w-full h-screen">
+      <View className="flex flex-col w-full h-screen" style={{marginTop: `${marginTopOffset}px`}}>
         <ScrollView
           ref={scrollViewRef}
           scrollY

+ 43 - 0
src/pages/dashboard-visited-detail/components/VisitorSummary/index.tsx

@@ -0,0 +1,43 @@
+import { View, Text, Image } from "@tarojs/components";
+import DigitalCardBasic from "@/components/DigitalCard/DigitalCardBasic";
+import { TVisitorAgent } from "@/types/visitor";
+
+export interface IndexProps {
+  data: TVisitorAgent;
+}
+
+const VisitorSummary = ({ data }: IndexProps) => {
+  return (
+    <View className="w-full p-12">
+      <View className="flex items-center gap-12">
+        <View className="flex items-center rounded-full overflow-hidden">
+          <View className="w-56 h-56 bg-gray-3 rounded-full">
+            {!!data.avatarUrl && (
+              <Image
+                src={data.avatarUrl}
+                mode="aspectFill"
+                className="w-56 h-56 bg-gray-3 rounded-full"
+              ></Image>
+            )}
+          </View>
+        </View>
+        <View className="flex flex-col gap-8">
+          <DigitalCardBasic
+            name={data.name}
+            position={data.position ?? ""}
+            company={'---'}
+            certificated={data.isEnt}
+          />
+          <View className="flex-center text-12 leading-20">
+            <View className="flex-1">
+              <Text className="text-primary">{data.chatRound}</Text> 轮对话
+            </View>
+            <View className="text-gray-45 leading-20">{data.lastChatTime}</View>
+          </View>
+        </View>
+      </View>
+    </View>
+  );
+};
+
+export default VisitorSummary;

+ 5 - 0
src/pages/dashboard-visited-detail/index.config.ts

@@ -0,0 +1,5 @@
+export default definePageConfig({
+  navigationBarTitleText: '分析',
+  "usingComponents": {},
+  "navigationStyle": 'custom',
+})

+ 5 - 0
src/pages/dashboard-visited-detail/index.module.less

@@ -0,0 +1,5 @@
+.scrollContainer{
+  padding: 0 16px;
+  height: 100%;
+  flex: 1;
+}

+ 92 - 0
src/pages/dashboard-visited-detail/index.tsx

@@ -0,0 +1,92 @@
+import { View, ScrollView } from "@tarojs/components";
+import Taro, { useDidShow, useRouter } from "@tarojs/taro";
+import NavBarNormal from "@/components/nav-bar-normal/index";
+import PageCustom from "@/components/page-custom/index";
+import IconArrowDownRounded from "@/components/icon/IconArrowDownRounded";
+import { useEffect, useState } from "react";
+import { useAgentStore } from "@/store/agentStore";
+import { isSuccess } from "@/utils";
+import ChatMessage from "@/components/chat-message";
+import { getVisitorInfo } from "@/service/visitor";
+import { TVisitorAgent, TVisitorMessage } from "@/types/visitor";
+import type { TMessage, TRobotMessage } from "@/store/textChat";
+import VisitorSummary from "./components/VisitorSummary";
+
+import { useVisitorMessages } from "./visitedDetail";
+import style from "./index.module.less";
+
+export default () => {
+  const router = useRouter();
+  const { visitorId } = router.params;
+  if (!visitorId) {
+    return <View>...</View>;
+  }
+
+  const [visitor, setVisitor] = useState<TVisitorAgent>();
+  const [list, setList] = useState<
+    (TMessage & TRobotMessage & TVisitorMessage)[]
+  >([]);
+
+  const fetchData = async () => {
+    if (visitorId) {
+      const response = await getVisitorInfo(visitorId);
+      if (isSuccess(response.status)) {
+        setVisitor(response.data);
+      }
+    }
+  };
+
+  const { data, loadMore } = useVisitorMessages(visitorId);
+
+  const onScrollToLower = () => {
+    loadMore();
+  };
+
+  useEffect(() => {
+    fetchData();
+  }, []);
+
+  useEffect(() => {
+    if (data?.data) {
+      //@ts-ignore
+      setList([...list, ...data.data]);
+    }
+  }, [data]);
+
+  return (
+    <PageCustom fullPage style={{ overflow: "hidden" }}>
+      <NavBarNormal backText="访问详情"></NavBarNormal>
+      {visitor ? <VisitorSummary data={visitor} /> : <></>}
+      <View className="rounded-container-header"></View>
+      <View className="flex-1 overflow-hidden">
+        <ScrollView
+          scrollY
+          onScrollToLower={onScrollToLower}
+          style={{
+            flex: 1,
+            height: "100%", // 高度自适应
+          }}
+        >
+          <View>
+            <View className="flex flex-col gap-16 px-16">
+              {list.map((message) => {
+                return (
+                  <>
+                    <View className="text-12 text-gray-45 leading-20 text-center">
+                      {message?.msgTime}
+                    </View>
+                    <ChatMessage
+                      key={message.msgUk}
+                      role={message.role}
+                      text={message.content}
+                    ></ChatMessage>
+                  </>
+                );
+              })}
+            </View>
+          </View>
+        </ScrollView>
+      </View>
+    </PageCustom>
+  );
+};

+ 25 - 0
src/pages/dashboard-visited-detail/visitedDetail.ts

@@ -0,0 +1,25 @@
+import { getVisitorMessages } from "@/service/visitor";
+import { TVisitorMessage } from "@/types/visitor";
+import { useLoadMore } from "@/utils/loadMore";
+
+export const useVisitorMessages = (visitorId: string|number) => {
+  const fetcher = async ([_url, nextId, page, pageSize, _keyword]) => {
+    const res = await getVisitorMessages({ startId: nextId, pageSize, visitorId });
+    return res.data;
+  };
+
+  const { data, loadMore, refetch } = useLoadMore<{
+    data?: TVisitorMessage[]
+    nextId?: string,
+    totalCount?: number
+  }>({
+    url: '/blue-aiagent/api/v1/my/contacts',
+    fetcher,
+  });
+
+  return {
+    data,
+    loadMore,
+    refetch
+  }
+}

+ 44 - 25
src/pages/dashboard/components/VisitorCard/index.tsx

@@ -1,40 +1,59 @@
 import { View, Text, Image } from "@tarojs/components";
 import DigitalCardBasic from "@/components/DigitalCard/DigitalCardBasic";
+import Taro from "@tarojs/taro";
+import { TVisitorAgent } from "@/types/visitor";
 
 export interface IndexProps {
   data: {
     certificated?: boolean
     name: string
-    position?: string
-    avatarUrl?: string
     company: string
     agentName: string
-    visitNum: number
-    chatNum: number
-    disLikeNum: number
-    visitTime: number
-  }
+    
+  }&TVisitorAgent;
 }
 
 const Index = ({ data }: IndexProps) => {
-  
-  return <View className="bg-white rounded-12 p-12">
-  <View className="flex items-start gap-12">
-    <View className="flex items-star rounded-full overflow-hidden">
-      <View className="w-56 h-56 bg-gray-3 rounded-full">
-        {(!!data.avatarUrl) && <Image src={data.avatarUrl} mode="aspectFill" className="w-56 h-56 bg-gray-3 rounded-full"></Image>}
-      </View>
-    </View>
-    <View className="flex flex-col gap-8">
-      <DigitalCardBasic name={data.name} position={data.position ?? ''} company={data.company} certificated />
-      <View className="text-14 font-medium leading-22">第 <Text className="text-yellow">{data.visitNum}</Text> 次访问了你的智能体【{data.agentName}】</View>
-      <View className="flex-center text-12 leading-20">
-        <View className="flex-1"><Text className="text-primary">{data.chatNum}</Text> 轮对话</View>
-        <View className="text-gray-45 leading-20">5小时前</View>
+  const handleClick = ()=> {
+    Taro.navigateTo({
+      url: `/pages/dashboard-visited-detail/index?visitorId=${data.visitorId}`
+    })
+  }
+  return (
+    <View className="bg-white rounded-12 p-12" onClick={handleClick}>
+      <View className="flex items-start gap-12">
+        <View className="flex items-star rounded-full overflow-hidden">
+          <View className="w-56 h-56 bg-gray-3 rounded-full">
+            {!!data.avatarUrl && (
+              <Image
+                src={data.avatarUrl}
+                mode="aspectFill"
+                className="w-56 h-56 bg-gray-3 rounded-full"
+              ></Image>
+            )}
+          </View>
+        </View>
+        <View className="flex flex-col gap-8">
+          <DigitalCardBasic
+            name={data.name}
+            position={data.position ?? ""}
+            company={data.company}
+            certificated
+          />
+          <View className="text-14 font-medium leading-22">
+            第 <Text className="text-yellow">{data.visitTimes}</Text>{" "}
+            次访问了你的智能体【{data.agentName}】
+          </View>
+          <View className="flex-center text-12 leading-20">
+            <View className="flex-1">
+              <Text className="text-primary">{data.chatRound}</Text> 轮对话
+            </View>
+            <View className="text-gray-45 leading-20">{data.lastChatTime}</View>
+          </View>
+        </View>
       </View>
     </View>
-  </View>
-</View>
-}
+  );
+};
 
-export default Index;
+export default Index;

+ 12 - 17
src/pages/dashboard/components/VisitorList/index.tsx

@@ -1,6 +1,6 @@
 import { View, Text } from "@tarojs/components";
 import Taro, { useReachBottom } from "@tarojs/taro";
-import VisitorCard from "../VisitorCard";
+import VisitorCard from '../VisitorCard/index';
 import { useEffect, useState } from "react";
 
 import { TVisitorAgent } from "@/types/visitor";
@@ -8,7 +8,7 @@ import { useLoadMore } from "@/utils/loadMore";
 import { getVisitorList } from "@/service/visitor";
 
 interface IProps {
-  agentId: string | number;
+  agentId?: string | number;
 }
 
 export default ({ agentId }: IProps) => {
@@ -38,6 +38,15 @@ export default ({ agentId }: IProps) => {
     }
   }, [data]);
 
+  useEffect(()=> {
+    setList([])
+    refetch()
+  }, [agentId])
+
+  if(!list.length){
+    <View></View>
+  }
+
   return (
     <View>
       <View className="mb-8 text-14 leading-22 font-medium">访问详情</View>
@@ -46,30 +55,16 @@ export default ({ agentId }: IProps) => {
           return (
             <VisitorCard
               data={{
+                ...item,
                 name: item.name ?? "",
                 company: "",
                 avatarUrl: item.avatarUrl,
                 position: item.position ?? "",
                 agentName: item.myAgentName ?? "",
-                chatNum: item.chatRound,
-                visitNum: item.visitTimes,
-                disLikeNum: item.dislikeCnt,
-                visitTime: item.visitTimes,
               }}
             ></VisitorCard>
           );
         })}
-
-        {/* <VisitorCard data={{
-            name: '李四',
-            company: '北京茗视光眼科医院管理有限公司',
-            position: '商务经理',
-            agentName: '张医生',
-            chatNum: 10,
-            visitNum: 7,
-            disLikeNum: 2,
-            visitTime: 5
-          }}></VisitorCard> */}
       </View>
     </View>
   );

+ 7 - 11
src/pages/dashboard/index.tsx

@@ -33,18 +33,14 @@ export default () => {
   }, [])
 
   useEffect(() => {
-    if (agents?.length && !selected) {
-      setSelected(agents[0].name)
-    }
-  }, [agents, selected])
+    setSelected('全部智能体')
+  }, [])
 
 
   const fetchInitData = async () => {
     const currentAgent = agents.find( _agent => _agent.name === selected)
-    if(!currentAgent){
-      return
-    }
-    const response = await getVisitorSummary(currentAgent.agentId)
+    
+    const response = await getVisitorSummary(currentAgent?.agentId)
     if(isSuccess(response.status)){
       setSummary(response.data)
     }
@@ -52,7 +48,7 @@ export default () => {
 
   useEffect(()=> {
     fetchInitData()
-  }, [])
+  }, [selected])
 
 
 
@@ -60,7 +56,7 @@ export default () => {
     return <View>...</View>
   }
 
-  const options = agents.map(_agent => _agent.name)
+  const options = ['全部智能体', ...agents.map(_agent => _agent.name)]
 
 
   return (
@@ -88,7 +84,7 @@ export default () => {
           <DataCard text="待处理差评" unitText="条" value={summary?.unprocessedDislikeCnt ?? 0} arrow />
         </View>
 
-        {currentAgent?.agentId && <VisitorList agentId={currentAgent.agentId}></VisitorList>}
+        <VisitorList agentId={currentAgent?.agentId}></VisitorList>
 
       </View>
       

+ 3 - 3
src/pages/index/components/InitView/index.tsx

@@ -13,10 +13,10 @@ import { useAgentStore } from '@/store/agentStore'
 import { useSystemStore } from '@/store/systemStore'
 import { TAgent } from "@/types/agent";
 import { useUserStore } from "@/store/userStore";
-interface Iprops {
+interface IProps {
   setDefault: (agent: TAgent) => void
 }
-export default function Index({setDefault}: Iprops) {
+export default function Index({setDefault}: IProps) {
 
   const [userInfo, setUserInfo] = useState<UserInfoResponse>()
   const isLogin = useIsLogin()
@@ -66,7 +66,7 @@ export default function Index({setDefault}: Iprops) {
     <PageCustom>
       <NavBarNormal leftColumn={renderLogo}></NavBarNormal>
       <View className="relative w-full">
-        <WelcomeTips>
+        <WelcomeTips setDefault={setDefault}>
           <View className="flex items-center">
             <View>{userInfo?.logo && <Image className="w-24 h-24" src={userInfo?.logo}></Image>}</View>
             <View>{isLogin ? `已登录「${userInfo?.nickName}」` : '未登录'}</View>

+ 7 - 5
src/pages/index/components/WelcomeTips/index.tsx

@@ -5,22 +5,24 @@ import Taro from "@tarojs/taro";
 import { getAgents, getAgent, createAgent, } from "@/service/agent";
 
 import { isSuccess } from "@/utils";
-
-export default function Index({children}) {
+interface IProps {
+  setDefault: (agent: TAgent) => void
+  children: JSX.Element|JSX.Element[]
+}
+export default function Index({children, setDefault}: IProps) {
   
   const saveAgent = async () => {
     const res = await createAgent()
     console.log(res)
     Taro.navigateTo({url: '/pages/agent-gen/index'})
   }
-  const test = ()=> {
-    
-  }
+  
   const go = async () => {
     const response = await getAgents()
     const res = await createAgent()
     
     if(isSuccess(res.status)){
+      setDefault(res.data)
       console.log(response, 'gogogo')
     }
     

+ 1 - 1
src/pages/index/index.tsx

@@ -16,7 +16,7 @@ export default function Index() {
   return (
     <PageCustom>
       <>
-      
+      {/* <InitView setDefault={setDefaultAgent}></InitView> */}
       {!defaultAgent && <InitView setDefault={setDefaultAgent}></InitView>}
       {defaultAgent && <DefaultAgent agentId={defaultAgent.agentId}></DefaultAgent>}
       </>

+ 2 - 6
src/pages/knowledge/components/CompanyTab/index.tsx

@@ -1,4 +1,4 @@
-import { Image, View } from "@tarojs/components";
+import { View } from "@tarojs/components";
 import RoundedLabel from "../rounded-label";
 import IconFilterFeeds from "@/components/icon/IconFilterFeeds";
 import IconFilterBatch from "@/components/icon/IconFilterBatch";
@@ -8,7 +8,7 @@ import IconFilterList from "@/components/icon/IconFilterList";
 
 import Popup from "@/components/popup/popup";
 import WemetaSwitch from "@/components/wemeta-switch";
-import { useEffect, useState } from "react";
+import { useState } from "react";
 
 import ViewStyleChatEnt from '../view-style/ViewStyleChatEnt'
 import ViewStyleListEnt from '../view-style/ViewStyleListEnt'
@@ -66,10 +66,6 @@ const Index = () => {
   }
 
 
-  useEffect(() => {
-    console.log("hellow");
-  }, []);
-
   return (
     <>
       <View className="pt-12 h-full">

+ 3 - 7
src/pages/knowledge/components/asistant-message/index.tsx

@@ -1,5 +1,5 @@
-import { View, Text, Image } from "@tarojs/components";
-
+import { View, Text } from "@tarojs/components";
+import WeComQRcode from "@/components/WeComQRcode";
 export const WelcomeCard = () => {
   return (
     <View>
@@ -12,11 +12,7 @@ export const WelcomeCard = () => {
          · 无需小程序,直接在微信内操作;
          · 智能解析处理,生成高质量的QA集。`}
       </Text>
-      <Image
-        showMenuByLongpress
-        src="https://nexthuman.cn/api-web/img/wechat.9d5eaf4d.jpg"
-        style={{ width: "160px", height: "160px" }}
-      />
+      <WeComQRcode />
     </View>
   );
 };

+ 4 - 8
src/pages/knowledge/components/personal-tab/index.tsx

@@ -5,8 +5,8 @@ import IconFilterBatch from "@/components/icon/IconFilterBatch";
 import IconFilterList from "@/components/icon/IconFilterList";
 
 import IconPlusBig from "@/components/icon/icon-plus-big";
-import IconFIlePDF from "@/components/icon/IconFIlePDF";
-import IconFIleXLSX from "@/components/icon/IconFIleXLSX";
+import IconFIlePDF from "@/components/icon/IconFilePDF";
+import IconFIleXLSX from "@/components/icon/IconFileXLSX";
 
 import FigureList from "@/components/list/figure-list";
 import FigureListItem from "@/components/list/figure-list-item";
@@ -18,7 +18,7 @@ import { useEffect, useState } from "react";
 import ViewStyleChat from "../view-style/ViewStyleChat";
 import ViewStyleList from "../view-style/ViewStyleList";
 import Taro from "@tarojs/taro";
-import { uploadKnowledgeFile } from "@/service/knowledge";
+import WeComQRcode from '@/components/WeComQRcode'
 
 import { useKnowledgeStore } from "@/store/knowledge";
 type TListStyle = "chat" | "list";
@@ -116,11 +116,7 @@ const Index = () => {
             · 无需小程序,直接在微信内操作;;
             · 智能解析处理,生成高质量的QA集。`}
           </Text>
-          <Image
-            showMenuByLongpress
-            src="https://nexthuman.cn/api-web/img/wechat.9d5eaf4d.jpg"
-            style={{ width: "160px", height: "160px" }}
-          />
+          <WeComQRcode />
         </View>
       </Popup>
 

+ 17 - 76
src/pages/knowledge/components/view-style/ViewStyleChat.tsx

@@ -2,10 +2,8 @@ import { ScrollView, View,Image } from "@tarojs/components";
 import MessageRobotRich from "@/components/chat-message/MessageRobotRich";
 import MessageRich from "@/components/chat-message/MessageRich";
 import { WelcomeCard, AddSuccessfulTips } from "../asistant-message";
+import KnowledgeIcon from '@/components/KnowledgeIcon'
 
-// import IconFIleTxt from "@/components/icon/IconFIleTxt";
-// import IconFIlePDF from "@/components/icon/IconFIlePDF";
-// import IconFIleXLSX from "@/components/icon/IconFIleXLSX";
 
 import FigureList from "@/components/list/figure-list";
 import FigureListItem from "@/components/list/figure-list-item";
@@ -15,6 +13,7 @@ import Taro, { useDidShow } from "@tarojs/taro";
 
 import { useUserStore } from "@/store/userStore";
 import { useKnowledgeStore } from "@/store/knowledge";
+import { TKnowledgeItem } from "@/types/knowledge";
 
 const ViewStyleChat = () => {
   const { list, scrollTop, loadMore } = useKnowledgeStore();
@@ -29,6 +28,15 @@ const ViewStyleChat = () => {
     loadMore();
   };
 
+  const handleEdit = (item: TKnowledgeItem)=> {
+    if(item.parseStatus !== 'parsed'){
+      return ;
+    }
+    Taro.navigateTo({
+      url: `/pages/knowledge-item/index?knowledgeId=${item.knowledgeId}`
+    })
+  }
+
   useEffect(() => {
     loadMore()
   }, []);
@@ -50,9 +58,9 @@ const ViewStyleChat = () => {
         </MessageRobotRich>
 
         {/* 添加小蓝本助手成功 */}
-        <MessageRobotRich data={avatarData}>
+        {/* <MessageRobotRich data={avatarData}>
           <AddSuccessfulTips />
-        </MessageRobotRich>
+        </MessageRobotRich> */}
 
         {list.map((group) => {
           // 渲染自己发送的消息
@@ -64,7 +72,7 @@ const ViewStyleChat = () => {
                   name: whoami?.nickName ?? ''
                 }}>
                   <View className="flex items-center gap-12">
-                    <Image src={item.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>
+                    <View className="w-36 h-36 overflow-hidden"><Image src={item.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image></View>
                     <View className="flex flex-col flex-1 gap-2">
                       <View className="text-14 leading-22">{item.title}</View>
                       <View className="text-12 leading-20 text-gray-45">
@@ -81,19 +89,18 @@ const ViewStyleChat = () => {
             <MessageRobotRich
               data={{...avatarData, fileLen: group.knowledgeList.length}}
               analyzeStatus={group.isParsing ? "doing" : "done"}
+              content={group.content}
             >
               <FigureList>
                 {group.knowledgeList.map((item, index) => {
                   return (
                     <FigureListItem
                       figure={()=> {
-                        return <Image src={item.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>
+                        return <KnowledgeIcon data={item}/>
                       }}
                       underline={index + 1 < group.knowledgeList.length}
                       arrow={item.parseStatus === 'parsed'}
-                      onClick={()=> Taro.navigateTo({
-                        url: `/pages/knowledge-item/index?knowledgeId=${item.knowledgeId}`
-                      })}
+                      onClick={()=> handleEdit(item)}
                     >
                       <View className="flex flex-col flex-1 gap-2 w-full">
                         <View className="text-14 leading-22">{item.title}</View>
@@ -108,72 +115,6 @@ const ViewStyleChat = () => {
             </MessageRobotRich>
           );
         })}
-
-        {/* <MessageRich data={avatarData}>
-          <View className="flex items-center gap-12">
-            <IconFIleTxt />
-            <View className="flex flex-col flex-1 gap-2">
-              <View className="text-14 leading-22">文件名称</View>
-              <View className="text-12 leading-20 text-gray-45">
-                03-24 12:20 | 822.KB
-              </View>
-            </View>
-          </View>
-        </MessageRich> */}
-
-        {/* <MessageRobotRich data={avatarData} analyzeStatus="doing">
-          <FigureList>
-            <FigureListItem figure={IconFIleTxt} underline>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">文件名称</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-            <FigureListItem figure={IconFIlePDF}>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">飞秒小知识.pdf</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-          </FigureList>
-        </MessageRobotRich>
-
-        <MessageRobotRich data={avatarData} analyzeStatus="done">
-          <FigureList className="bg-gray-2 px-16 py-12">
-            <FigureListItem figure={IconFIleTxt} underline arrow>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">文件名称</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-            <FigureListItem figure={IconFIlePDF} arrow>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">飞秒小知识.pdf</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-          </FigureList>
-        </MessageRobotRich> */}
-
-        {/* <MessageRich data={avatarData}>
-          <View className="flex items-center gap-12">
-            <IconFIleXLSX />
-            <View className="flex flex-col flex-1 gap-2">
-              <View className="text-14 leading-22">文件名称</View>
-              <View className="text-12 leading-20 text-gray-45">
-                03-24 12:20 | 822.KB
-              </View>
-            </View>
-          </View>
-        </MessageRich> */}
       </View>
     </ScrollView>
   );

+ 4 - 70
src/pages/knowledge/components/view-style/ViewStyleChatEnt.tsx

@@ -1,7 +1,6 @@
 import { ScrollView, View,Image } from "@tarojs/components";
 import MessageRobotRich from "@/components/chat-message/MessageRobotRich";
 import MessageRich from "@/components/chat-message/MessageRich";
-import { WelcomeCard, AddSuccessfulTips } from "../asistant-message";
 
 import FigureList from "@/components/list/figure-list";
 import FigureListItem from "@/components/list/figure-list-item";
@@ -11,6 +10,7 @@ import Taro, { useDidShow } from "@tarojs/taro";
 
 import { useUserStore } from "@/store/userStore";
 import { useKnowledgeEntStore } from "@/store/knowledgeEnt";
+import KnowledgeIcon from "@/components/KnowledgeIcon";
 
 export interface Iprops {
   entId: string|number
@@ -31,7 +31,6 @@ const ViewStyleChatEnt = ({entId}: Iprops) => {
 
   useEffect(() => {
     loadMore()
-    console.log(3333)
   }, []);
 
   return (
@@ -55,7 +54,7 @@ const ViewStyleChatEnt = ({entId}: Iprops) => {
                   name: whoami?.nickName ?? ''
                 }}>
                   <View className="flex items-center gap-12">
-                    <Image src={item.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>
+                    <KnowledgeIcon data={item}/>
                     <View className="flex flex-col flex-1 gap-2">
                       <View className="text-14 leading-22">{item.title}</View>
                       <View className="text-12 leading-20 text-gray-45">
@@ -72,13 +71,14 @@ const ViewStyleChatEnt = ({entId}: Iprops) => {
             <MessageRobotRich
               data={{...avatarData, fileLen: group.knowledgeList.length}}
               analyzeStatus={group.isParsing ? "doing" : "done"}
+              content={group.content}
             >
               <FigureList>
                 {group.knowledgeList.map((item, index) => {
                   return (
                     <FigureListItem
                       figure={()=> {
-                        return <Image src={item.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>
+                        return <KnowledgeIcon data={item}/>
                       }}
                       underline={index + 1 < group.knowledgeList.length}
                       arrow={item.parseStatus === 'parsed'}
@@ -99,72 +99,6 @@ const ViewStyleChatEnt = ({entId}: Iprops) => {
             </MessageRobotRich>
           );
         })}
-
-        {/* <MessageRich data={avatarData}>
-          <View className="flex items-center gap-12">
-            <IconFIleTxt />
-            <View className="flex flex-col flex-1 gap-2">
-              <View className="text-14 leading-22">文件名称</View>
-              <View className="text-12 leading-20 text-gray-45">
-                03-24 12:20 | 822.KB
-              </View>
-            </View>
-          </View>
-        </MessageRich> */}
-
-        {/* <MessageRobotRich data={avatarData} analyzeStatus="doing">
-          <FigureList>
-            <FigureListItem figure={IconFIleTxt} underline>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">文件名称</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-            <FigureListItem figure={IconFIlePDF}>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">飞秒小知识.pdf</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-          </FigureList>
-        </MessageRobotRich>
-
-        <MessageRobotRich data={avatarData} analyzeStatus="done">
-          <FigureList className="bg-gray-2 px-16 py-12">
-            <FigureListItem figure={IconFIleTxt} underline arrow>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">文件名称</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-            <FigureListItem figure={IconFIlePDF} arrow>
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">飞秒小知识.pdf</View>
-                <View className="text-12 leading-20 text-gray-45">
-                  03-24 12:20 | 822.KB
-                </View>
-              </View>
-            </FigureListItem>
-          </FigureList>
-        </MessageRobotRich> */}
-
-        {/* <MessageRich data={avatarData}>
-          <View className="flex items-center gap-12">
-            <IconFIleXLSX />
-            <View className="flex flex-col flex-1 gap-2">
-              <View className="text-14 leading-22">文件名称</View>
-              <View className="text-12 leading-20 text-gray-45">
-                03-24 12:20 | 822.KB
-              </View>
-            </View>
-          </View>
-        </MessageRich> */}
       </View>
     </ScrollView>
   );

+ 2 - 25
src/pages/knowledge/components/view-style/ViewStyleList.tsx

@@ -11,6 +11,7 @@ import Taro from "@tarojs/taro";
 import { useKnowledgeStore } from "@/store/knowledge";
 import type { TKnowledgeItem } from "@/types/knowledge";
 import { EKnowlegeTypes } from "@/consts/enum";
+import KnowledgeIcon from "@/components/KnowledgeIcon";
 export interface IProps {
   types?: EKnowlegeTypes[]
 }
@@ -65,7 +66,7 @@ const Index = ({types}: IProps) => {
       <FigureList>
       {listItems.map(item => {
         return <FigureListItem
-            figure={()=> <Image src={item.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>}
+            figure={()=> <KnowledgeIcon data={item}/>}
             underline
             arrow={item.parseStatus === 'parsed'}
             onClick={()=> handleEdit(item)}
@@ -79,30 +80,6 @@ const Index = ({types}: IProps) => {
             </View>
           </FigureListItem>
       })}
-        {/* <FigureListItem
-          figure={IconFIleTxt}
-          underline
-          arrow
-          onClick={handleEdit}
-        >
-          <View className="flex flex-col flex-1 gap-2 w-full">
-            <View className="text-14 leading-22">飞秒小知识</View>
-            <View className="text-12 leading-20 text-gray-45">
-              03-24 12:20 | 822.KB
-            </View>
-          </View>
-        </FigureListItem>
-        <FigureListItem
-          figure={IconFIlePDF}
-          rightRenderer={rightRenderer}
-        >
-          <View className="flex flex-col flex-1 gap-2 w-full">
-            <View className="text-14 leading-22">飞秒小知识.pdf</View>
-            <View className="text-12 leading-20 text-gray-45">
-              03-24 12:20 | 822.KB
-            </View>
-          </View>
-        </FigureListItem> */}
       </FigureList>
     </ScrollView>
   );

+ 2 - 25
src/pages/knowledge/components/view-style/ViewStyleListEnt.tsx

@@ -10,6 +10,7 @@ import Taro from "@tarojs/taro";
 
 import { useKnowledgeEntStore } from "@/store/knowledgeEnt";
 import type { TKnowledgeItem } from "@/types/knowledge";
+import KnowledgeIcon from "@/components/KnowledgeIcon";
 export interface Iprops {
   entId: string|number
 }
@@ -58,7 +59,7 @@ const Index = ({entId}:Iprops) => {
       <FigureList>
       {listItems.map(item => {
         return <FigureListItem
-            figure={()=> <Image src={item.icon} mode="widthFix" style={{width: '36px', height: '36px'}}></Image>}
+            figure={()=> <KnowledgeIcon data={item}/>}
             underline
             arrow={item.parseStatus === 'parsed'}
             onClick={()=> handleEdit(item)}
@@ -72,30 +73,6 @@ const Index = ({entId}:Iprops) => {
             </View>
           </FigureListItem>
       })}
-        {/* <FigureListItem
-          figure={IconFIleTxt}
-          underline
-          arrow
-          onClick={handleEdit}
-        >
-          <View className="flex flex-col flex-1 gap-2 w-full">
-            <View className="text-14 leading-22">飞秒小知识</View>
-            <View className="text-12 leading-20 text-gray-45">
-              03-24 12:20 | 822.KB
-            </View>
-          </View>
-        </FigureListItem>
-        <FigureListItem
-          figure={IconFIlePDF}
-          rightRenderer={rightRenderer}
-        >
-          <View className="flex flex-col flex-1 gap-2 w-full">
-            <View className="text-14 leading-22">飞秒小知识.pdf</View>
-            <View className="text-12 leading-20 text-gray-45">
-              03-24 12:20 | 822.KB
-            </View>
-          </View>
-        </FigureListItem> */}
       </FigureList>
     </ScrollView>
   );

+ 0 - 1
src/service/agent.ts

@@ -14,7 +14,6 @@ export const createAgent = () => {
 // 获取我的智能体详细信息
 // 供编辑页使用,预览页使用智能体信息接口获取
 export const getMyAgent = (agentId: string) => {
-  console.log(agentId,11333)
   return request.get<TAgentDetail>(`${bluebookAiAgent}api/v1/my/agent/${agentId}`)
 }
 

+ 9 - 26
src/service/visitor.ts

@@ -3,7 +3,7 @@ import {
 } from '@/xiaolanbenlib/api/index'
 import request from '@/xiaolanbenlib/module/axios.js'
 
-import { TVisitorAgent } from '@/types/visitor'
+import { TVisitorAgent, TVisitorMessage } from '@/types/visitor'
 
 
 
@@ -78,37 +78,20 @@ export type TVisotorInfoResponse = {
   "visitTimes": number,
   "visitorId": number
 }
-export const getVisitorInfo = (data: {
-  "visitorId": string,
-  "startId": string,
-}) => {
-  return request.get<TVisotorInfoResponse>(`${bluebookAiAgent}api/v1/my/visitor/info`, {params: data})
+export const getVisitorInfo = (visitorId: number|string) => {
+  return request.get<TVisotorInfoResponse>(`${bluebookAiAgent}api/v1/my/visitor/info`, {params: {visitorId}})
 }
 
 // 获取好评记录列表--包含已读未读
 export type TVisitorLikeMessagesResponse = {
-  "data": [
-    {
-      "agentId": string,
-      "visitorId": string,
-      "content": string,
-      "dislikeReason": string,
-      "isDislike": false,
-      "isLike": false,
-      "isStreaming": false,
-      "msgId": number,
-      "msgTime": "2025-05-21T07:09:45.820Z",
-      "msgUk": string,
-      "originalAgentId": string,
-      "role": string
-    }
-  ],
+  "data": TVisitorMessage[],
   "nextId": string,
   "totalCount": number
 }
 export const getVisitorLikeMessages = (data: {
-  "visitorId": string,
-  "startId": string,
+  visitorId: string,
+  startId: string,
+  pageSize: number
 }) => {
   return request.get<TVisitorLikeMessagesResponse>(`${bluebookAiAgent}api/v1/my/visitor/like/messages`, {params: data})
 }
@@ -137,7 +120,7 @@ export type TVisitorMessagesResponse = {
   "totalCount": number
 }
 export const getVisitorMessages = (data: {
-  "visitorId": string,
+  "visitorId": string|number,
   "startId": string,
   "pageSize": string,
 }) => {
@@ -182,7 +165,7 @@ export type TVisitorSummary = {
   unprocessedDislikeCnt?: number// 未处理差评记录数 ,
   unreadLikeCnt?: number// 未查看点赞记录数
 }
-export const getVisitorSummary = (agentId: string) => {
+export const getVisitorSummary = (agentId?: string) => {
   return request.get<TVisitorSummary>(`${bluebookAiAgent}api/v1/my/visitor/summary`, {params: {agentId}})
 }
 

+ 14 - 31
src/store/appStore.ts

@@ -1,6 +1,6 @@
 import { create } from 'zustand'
 
-import { TModelAppConfig, TModelVipProduct } from '@/types/index'
+import { TModelAppConfig } from '@/types/index'
 import { useUserStore } from './userStore'
 import Taro from '@tarojs/taro'
 export interface AppState {
@@ -8,22 +8,17 @@ export interface AppState {
   headerHeight: number
   topDistance: number
   statusBarHeight: number
+  bottomSafeHeight: number
   colorPrimary: string
   colorTextPrimary: string
   systemInfo: Taro.getSystemInfoAsync.Result | null
   isIos: boolean,
   appConfig: TModelAppConfig | null
   keyboardHeight: number
-  vip: TModelVipProduct | null,
-  vipPopupVisible: boolean
-  authPhonePopupVisible: boolean
   desktopPopupTips: boolean
-  setVipPopupVisible: (showVipPopup: boolean)=> void
-  setAuthPhoneVisible: (visible: boolean)=> void
   setSystemInfo: (info: Taro.getSystemInfoAsync.Result)=> void
   setKeyboardHeight: (height: number) => void
   fetchAppConfig: ()=> Promise<TModelAppConfig | null>
-  setVip: (vip: TModelVipProduct)=> void
 }
 
 export const useAppStore = create<AppState>((set) => ({
@@ -40,21 +35,18 @@ export const useAppStore = create<AppState>((set) => ({
   vip: null,
   vipPopupVisible: false,
   desktopPopupTips: false,
-  authPhonePopupVisible: false,
-  setVipPopupVisible: (vipPopupVisible: boolean)=> {
-    set({vipPopupVisible})
-  },
-  setAuthPhoneVisible: (visible: boolean)=> {
-    set({authPhonePopupVisible: visible})
-  },
+  bottomSafeHeight: 0,
   setKeyboardHeight: (height: number)=> {
     set({keyboardHeight: height})
   },
   setSystemInfo: (info) => {
     // 状态栏高度 - 6 偏差值为垂直居中对齐胶囊按钮
+    // statusBarHeight 离顶部导航栏位置
     const statusBarHeight = (isNaN(info.statusBarHeight!) ? 24 : info.statusBarHeight || 47) - 6;
+    
     const system = info.system.toLowerCase() 
     const isIos = system.includes('ios')
+    let bottomSafeHeight = 0
     let desktopPopupTips = false;
     const capsuleInfo = Taro.getMenuButtonBoundingClientRect()
     
@@ -73,29 +65,20 @@ export const useAppStore = create<AppState>((set) => ({
     if (!system.includes('android') && !system.includes('ios')) {
       desktopPopupTips = true
     }
-    // statusBarHeight 离顶部导航栏位置
-    set({ systemInfo: info, statusBarHeight, headerHeight, isIos, desktopPopupTips})
+    if(info.safeArea?.bottom){
+      bottomSafeHeight = info.screenHeight - info.safeArea?.bottom;
+    }
+    
+    
+    set({ systemInfo: info, statusBarHeight, headerHeight, isIos, desktopPopupTips, bottomSafeHeight})
     
       
   },
   fetchAppConfig: async ()=> {
-    // const res = await getAppConfig()
-    
-    // if(res?.code === 0 && res.data){
-    //   set(() => {
-    //     return {
-    //       appConfig: {...res.data},
-    //     }
-    //   })
-    //   return res.data
-    // }
+
     return null
   },
-  setVip:  (vip: TModelVipProduct)=> {
-    set({
-      vip,
-    })
-  }
+  
 }))
 
 export const useUserPhone = ()=> {

+ 27 - 15
src/types/visitor.ts

@@ -5,25 +5,37 @@
 
 
 
-
-
+export type TVisitorMessage = {
+  agentId: string,
+  visitorId: string,
+  content: string,
+  dislikeReason: string,
+  isDislike: false,
+  isLike: false,
+  isStreaming: false,
+  msgId: number,
+  msgTime: string,
+  msgUk: string,
+  originalAgentId: string,
+  role: string
+}
 
 
 
 
 
 export type TVisitorAgent = {
-  "agentId": string, // 访客智能体ID -- 如果客户的所有智能体都无效时,则可能为 null ,
-  "agentStatus": string, // agentStatus (string, optional): 访客智能体状态 -- normal 正常/ deleted 已删除 ,
-  "avatarUrl": string, // avatarUrl (string, optional): 访客头像地址 ,
-  "chatRound": number, // chatRound (integer, optional): 会话轮数 ,
-  "dislikeCnt": number,// dislikeCnt (integer, optional): 差评数 ,
-  "isEnt": false, // isEnt (boolean, optional): 是否企业认证联系人 ,
-  "lastChatTime": string,// lastChatTime (string, optional): 最新的对话时间 ,
-  "myAgentId": string, // myAgentId (string, optional): 访问我的智能体ID ,
-  "myAgentName": string,// myAgentName (string, optional): 访问我的智能体名称 ,
-  "name": string, // name (string, optional): 访客名称 -- 最后一次访问的快照信息 ,
-  "position": string,// position (string, optional): 访客职位 ,
-  "visitTimes": number,// visitTimes (integer, optional): 访问访问我的指定智能体次数 ,
-  "visitorId": number// visitorId (integer, optional): 访客ID
+  agentId: string, // 访客智能体ID -- 如果客户的所有智能体都无效时,则可能为 null ,
+  agentStatus: string, // agentStatus (string, optional): 访客智能体状态 -- normal 正常/ deleted 已删除 ,
+  avatarUrl: string, // avatarUrl (string, optional): 访客头像地址 ,
+  chatRound: number, // chatRound (integer, optional): 会话轮数 ,
+  dislikeCnt: number,// dislikeCnt (integer, optional): 差评数 ,
+  isEnt: false, // isEnt (boolean, optional): 是否企业认证联系人 ,
+  lastChatTime: string,// lastChatTime (string, optional): 最新的对话时间 ,
+  myAgentId: string, // myAgentId (string, optional): 访问我的智能体ID ,
+  myAgentName: string,// myAgentName (string, optional): 访问我的智能体名称 ,
+  name: string, // name (string, optional): 访客名称 -- 最后一次访问的快照信息 ,
+  position: string,// position (string, optional): 访客职位 ,
+  visitTimes: number,// visitTimes (integer, optional): 访问访问我的指定智能体次数 ,
+  visitorId: number// visitorId (integer, optional): 访客ID
 }