Pārlūkot izejas kodu

fix: 访问被删除后的智能体直接提示

王晓东 1 nedēļu atpakaļ
vecāks
revīzija
b7e9403904
35 mainītis faili ar 186 papildinājumiem un 263 dzēšanām
  1. 3 87
      project.private.config.json
  2. 21 6
      src/components/AgentPage/components/SummaryBar/index.tsx
  3. 3 2
      src/components/AvatarMedia/index.tsx
  4. 2 2
      src/components/CheckLoginPopup/index.tsx
  5. 1 1
      src/components/ContactIcon/index.module.less
  6. 2 2
      src/components/LoginPopup/index.tsx
  7. 1 1
      src/components/chat-message/Message.tsx
  8. 1 1
      src/components/chat-message/MessageRich.tsx
  9. 1 1
      src/components/chat-message/MessageRobotRich.tsx
  10. 1 1
      src/components/chat-message/index.module.less
  11. 1 1
      src/components/component-list/components/card-channels/index.module.less
  12. 2 2
      src/components/component-list/components/card-channels/index.tsx
  13. 14 2
      src/components/custom-share/index.tsx
  14. 1 0
      src/components/custom-share/shareUtils.ts
  15. 12 5
      src/components/popup/popup-sheets/index.tsx
  16. 1 1
      src/components/wemeta-textarea/index.tsx
  17. 5 2
      src/pages/agent-avatars/index.tsx
  18. 1 1
      src/pages/agent-gen/components/step/StepPick.tsx
  19. 16 5
      src/pages/chat-messages/index.tsx
  20. 0 2
      src/pages/chat/components/keyboard.ts
  21. 2 2
      src/pages/contact/index.tsx
  22. 2 2
      src/pages/dashboard/index.tsx
  23. 2 2
      src/pages/editor-pages/editor-channels/index.tsx
  24. 5 5
      src/pages/knowledge-item/index.tsx
  25. 1 1
      src/pages/knowledge/components/CompanyTab/components/ScrollList.tsx
  26. 4 2
      src/pages/knowledge/components/CompanyTab/index.tsx
  27. 2 2
      src/pages/knowledge/index.tsx
  28. 5 0
      src/pages/privacy/index.tsx
  29. 63 17
      src/pages/profile/index.tsx
  30. 1 1
      src/pages/visiteor-detail/components/VisitorSummary/index.tsx
  31. 6 7
      src/pages/visiteor-detail/index.tsx
  32. 1 1
      src/service/visitor.ts
  33. 1 1
      src/store/agentStore.ts
  34. 0 94
      src/utils/loadMore.ts
  35. 2 1
      src/utils/loadMoreInfinite.ts

+ 3 - 87
project.private.config.json

@@ -9,19 +9,12 @@
     "miniprogram": {
       "list": [
         {
-          "name": "pages/knowledge/index",
-          "pathName": "pages/knowledge/index",
-          "query": "",
+          "name": "pages/profile/index",
+          "pathName": "pages/profile/index",
+          "query": "agentId=p_8e726e825bagi5Ki-agent_1001",
           "scene": null,
           "launchMode": "default"
         },
-        {
-          "name": "pages/dashboard/index",
-          "pathName": "pages/dashboard/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        },
         {
           "name": "pages/contact/index",
           "pathName": "pages/contact/index",
@@ -35,83 +28,6 @@
           "query": "",
           "launchMode": "default",
           "scene": null
-        },
-        {
-          "name": "pages/agent/index",
-          "pathName": "pages/agent/index",
-          "query": "agentId=p_2e73c9d7efaYfDo2-agent_1009",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/index/index",
-          "pathName": "pages/index/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/visiteor-detail/index",
-          "pathName": "pages/visiteor-detail/index",
-          "query": "visitorId=1391",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/profile/index",
-          "pathName": "pages/profile/index",
-          "query": "agentId=p_2e73c9d7efaYfDo2-agent_991&shareKey=2%241%24AAAAwk3hSyfsx%20gEW1O0DrSt1JVBfT%20ATDQqwqvPP9Ebv6cgWG8%20mN0D7uu4of0o4RNPzsEXDTBD4jez44UKaARoVEkHXE2a6KiIH42aeIJSgot%2F",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/profile/index",
-          "pathName": "pages/profile/index",
-          "query": "agentId=e_d2201c7B73ac-B7d578aYKwLu-agent_213",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "login",
-          "pathName": "pages/login/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "知识库编辑",
-          "pathName": "pages/editor-knowledge-item/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/editor-pages/editor-greeting-questions/index",
-          "pathName": "pages/editor-pages/editor-greeting-questions/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/chat/index",
-          "pathName": "pages/chat/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/agent-gen/index",
-          "pathName": "pages/agent-gen/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "pages/editor-pages/editor-qrcode/index",
-          "pathName": "pages/editor-pages/editor-qrcode/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
         }
       ]
     }

+ 21 - 6
src/components/AgentPage/components/SummaryBar/index.tsx

@@ -10,7 +10,7 @@ import IconEditBlack from "@/components/icon/icon-edit-black";
 import IconMoreBlack from "@/components/icon/IconMoreBlack";
 
 import ContactIcon from '@/components/ContactIcon'
-import { useAppStore } from "@/store/appStore";
+import { useIsLogin } from "@/xiaolanbenlib/hooks/data/useAuth";
 import AgentSwap from "../AgentSwap/index";
 import AgentQRCode from "../AgentQRcode/index";
 import SharePopup from "@/components/custom-share/SharePopup";
@@ -20,22 +20,29 @@ import PopupSheets from "@/components/popup/popup-sheets";
 import { useModalStore } from "@/store/modalStore";
 import { TAgentDetail } from "@/types/agent";
 import { useAgentStore } from "@/store/agentStore";
+import LoginPopup from "@/components/LoginPopup";
+
 interface IProps {
   agent: TAgentDetail,
   isVisitor: boolean, // 是否是访问他人智能体
 }
 export default ({agent, isVisitor}: IProps) => {
-  const headerHeight = useAppStore((state) => state.headerHeight);
+  
   const [showAgentSwap, setShowAgentSwap] = useState(false);
   const [showAgentQRcode, setShowAgentQRcode] = useState(false);
   const [showPopup, setShowPopup] = useState(false);
   const [showShare, setShowShare] = useState(false);
+  const [showLogin, setShowLogin] = useState(false);
   const { deleteAgent } = useAgentStore()
   
 
   const {showModal,} = useModalStore()
-
+  const isLogin = useIsLogin();
   const handleClick = ()=> {
+    // 如果是未登录状态下想要去聊天, 则弹窗登录
+    if(!isLogin){
+      return setShowLogin(true);
+    }
     
     // 如果是已经下线的智能体,显示提示信息
     if(agent.status === 'deleted'){
@@ -63,7 +70,7 @@ export default ({agent, isVisitor}: IProps) => {
     }
   }
 
-  const renderValue = (value?:string)=> {
+  const renderValue = (value?: string | null)=> {
     return value?.length ? value :  '--'
   }
 
@@ -73,8 +80,6 @@ export default ({agent, isVisitor}: IProps) => {
   const enableQrcode = !isVisitor || !!agent?.qrCodeUrl?.length
 
 
-
-
   return (
     <View className="relative w-full">
       <View className={style.topBarContainer}>
@@ -176,13 +181,20 @@ export default ({agent, isVisitor}: IProps) => {
         </View>
       </View>
 
+      {/* 切换智能体弹窗 */}
       {!isVisitor && <AgentSwap show={showAgentSwap} setShow={setShowAgentSwap}></AgentSwap>}
+
+      {/* 二维码弹窗 */}
       <AgentQRCode isVisitor={isVisitor} show={showAgentQRcode} setShow={setShowAgentQRcode} />
+
+      {/* 分享弹窗 */}
       {agent && <SharePopup
         show={showShare}
         setShow={setShowShare}
         agent={agent}
       ></SharePopup>}
+
+      {/* 删除弹层 */}
       <PopupSheets 
           setShow={setShowPopup} 
           show={showPopup}
@@ -208,6 +220,9 @@ export default ({agent, isVisitor}: IProps) => {
           ]}
         >
         </PopupSheets>
+        
+        {/* 登录弹窗 */}
+        <LoginPopup showPopup={showLogin} setShowPopup={setShowLogin}></LoginPopup>
     </View>
   );
 };

+ 3 - 2
src/components/AvatarMedia/index.tsx

@@ -7,9 +7,10 @@ interface Props {
   source?: string;
   className: string;
   mode?: keyof ImageProps.Mode | undefined
+  roundedFull?: boolean
 }
 
-export const AvatarMedia = ({ source, className, mode = 'widthFix' }: Props) => {
+export const AvatarMedia = ({ source, className, roundedFull = true, mode = 'widthFix' }: Props) => {
   
   const videoRef = useRef<React.ComponentType<VideoProps>|null>(null);
   const videoContext = useRef<Taro.VideoContext|null>(null);
@@ -58,7 +59,7 @@ export const AvatarMedia = ({ source, className, mode = 'widthFix' }: Props) =>
 
   const _source = source?.length ? source : DEFAULT_AVATAR
   return (
-    <View className={`overflow-hidden rounded-full ${className}`}>
+    <View className={`overflow-hidden ${roundedFull ? 'rounded-full': ''} ${className}`}>
       <Image
         mode={mode}
         className={`${className}`}

+ 2 - 2
src/components/TabPageCheckLogin/index.tsx → src/components/CheckLoginPopup/index.tsx

@@ -7,7 +7,7 @@ interface IProps {
   onEnd: ()=>void
 }
 
-const TabPageCheckLogin = forwardRef(({ onEnd }: IProps, ref) => {
+const CheckLoginPopup = forwardRef(({ onEnd }: IProps, ref) => {
   const [showLogin, setShowLogin] = useState(false);
   const isLogin = useIsLogin()
 
@@ -37,4 +37,4 @@ const TabPageCheckLogin = forwardRef(({ onEnd }: IProps, ref) => {
   return  <LoginPopup showPopup={showLogin} setShowPopup={setShowLogin} onEnd={onLoginEnd}></LoginPopup>
 });
 
-export default TabPageCheckLogin;
+export default CheckLoginPopup;

+ 1 - 1
src/components/ContactIcon/index.module.less

@@ -5,7 +5,7 @@
   width: 24px;
   height: 24px;
   border-radius: 100%;
-  background-color: rgba(#317CFA, .1);
+  background-color: rgba(#F3F3F3, 1);
 }
 .iconActive{
   .icon();

+ 2 - 2
src/components/LoginPopup/index.tsx

@@ -13,7 +13,7 @@ import { isSuccess } from "@/utils";
 interface IProps {
   showPopup: boolean
   setShowPopup: (b: boolean)=> void
-  onEnd: ()=>void
+  onEnd?: ()=>void
 }
 
 export default function Index({showPopup, setShowPopup, onEnd}:IProps) {
@@ -21,7 +21,7 @@ export default function Index({showPopup, setShowPopup, onEnd}:IProps) {
     onSuccess: () => {
       console.log('yes')
       setShowPopup(false)
-      onEnd()
+      onEnd?.()
     },
   })
   const [checked, setChecked] = useState(false);

+ 1 - 1
src/components/chat-message/Message.tsx

@@ -7,7 +7,7 @@ interface Props {
 export default ({text}:Props) => {
   return <View className="flex justify-end">
     <View className={`${style.message } ${style.messageMe}`}>
-      <View className={style.messageContent}>
+      <View className={`${style.messageContent}`}>
         {text.length === 0 && <ThinkAnimation></ThinkAnimation>}
         <Text>{text}</Text>
       </View>

+ 1 - 1
src/components/chat-message/MessageRich.tsx

@@ -12,7 +12,7 @@ interface Props {
 export default ({ loading, children, data }: Props) => {
   return (
     <View className="flex gap-8 items-start justify-end">
-      <View className="flex justify-end">
+      <View className="flex justify-end truncate">
         <View className={`${style.message}  ${style.messageMeRich}`}>
           <View className={style.messageContent}>
             {loading && <ThinkAnimation></ThinkAnimation>}

+ 1 - 1
src/components/chat-message/MessageRobotRich.tsx

@@ -24,7 +24,7 @@ export default ({
       <View className={style.avatarContainer}>
         {data && <Image className={style.avatar} src={data?.avatar}></Image>}
       </View>
-      <View className="flex flex-1 flex-col gap-8">
+      <View className="flex flex-1 flex-col gap-8 truncate">
         <View className="font-medium text-14 leading-22">
           {data && data.name}
         </View>

+ 1 - 1
src/components/chat-message/index.module.less

@@ -47,7 +47,7 @@
   line-height: 28px;
   color: #111A34;
   word-break: break-all;
-  max-width: 280px;
+  // max-width: 280px;
 }
 .deepThinkContainer{
   margin-bottom: 16px;

+ 1 - 1
src/components/component-list/components/card-channels/index.module.less

@@ -2,7 +2,7 @@
 .iconVideo{
   width: 24px;
   height: 24px;
-  background: url(@shipingUrl) center center no-repeat;
+  background: url(@shipingVideoUrl) center center no-repeat;
   border-radius: 4px;
   background-size: 24px 24px;
   background-color: var(--color-bg-primary);

+ 2 - 2
src/components/component-list/components/card-channels/index.tsx

@@ -78,7 +78,7 @@ export default ({
         <View className="px-16 py-18">
           <View className="flex items-center gap-8">
             <View className={style.iconVideo}></View>
-            <View className="text-16 font-medium">
+            <View className="font-medium">
               {component.data?.value?.desc ?? "视频名称"}
             </View>
           </View>
@@ -114,7 +114,7 @@ export default ({
         <View className="px-16">
           <View className="flex items-center gap-8">
             <View className="social-media-shipingVideo"></View>
-            <View className="text-16 font-medium">
+            <View className="font-medium">
               {component.data?.value?.desc ?? "视频名称"}
             </View>
           </View>

+ 14 - 2
src/components/custom-share/index.tsx

@@ -16,6 +16,7 @@ import { getSharePromise } from "./shareUtils";
 import Stage from "@/libs/duducanvas/Stage";
 import { TAgent, TAgentDetail } from "@/types/agent";
 import { DEFAULT_AVATAR } from "@/config";
+import { useIsLogin } from "@/xiaolanbenlib/hooks/data/useAuth";
 
 const getCanvasSize = () => {
   // 根据屏幕宽度计算 canvas 宽度
@@ -73,6 +74,7 @@ interface Props {
 
 export default (props: Props) => {
   const { canvasWidth, canvasHeight, ratio } = getCanvasSize();
+  const {isLogin} = useIsLogin()
   let stage: Stage|null;
 
   // character = useCurrentCharacter
@@ -193,23 +195,33 @@ export default (props: Props) => {
   // });
 
   const shareTitle = '快和我的智能体聊聊吧' // '想了解我?快和我的AI聊聊吧',
+  
   useShareAppMessage(async () => {
     const agentId = agent?.agentId;
+    const path = `/pages/profile/index?agentId=${agentId}`
     console.log(agent)
     if(!agentId){
       return {
         title: shareTitle,
-        path: `/pages/profile/index?agentId=${agentId}`,
+        path,
       }
     }
     Taro.showLoading()
     await initCanvas();
+    Taro.hideLoading()
     let tmpImage = ''
     if(stage){
       tmpImage = await getCanvasTempPath(stage.canvas, "myShareCanvas");
     }
+    if(!isLogin){
+      return {
+        title: shareTitle,
+        imageUrl: tmpImage,
+        path
+      }
+    }
     const reponse = await getSharePromise(agentId, shareTitle, tmpImage)
-    Taro.hideLoading()
+    
     return reponse;
   });
 

+ 1 - 0
src/components/custom-share/shareUtils.ts

@@ -13,6 +13,7 @@ export const getAvatarImageSrc = (avatarImg: string)=> {
 // 生成分享信息
 export const getSharePromise = async (agentId:string, shareTitle: string, tmpImage: string) => {
   const response = await getAgentShareInfo(agentId);
+  console.log('share:', response)
   if( isSuccess(response.status) ){
     const o = {
       title: shareTitle,

+ 12 - 5
src/components/popup/popup-sheets/index.tsx

@@ -11,13 +11,17 @@ interface Props {
   content: { item: string | JSX.Element; type?: Ttype, onClick?: ()=> void}[];
   header?: JSX.Element | JSX.Element[];
   bottom?: JSX.Element[];
+  maskClosable?: boolean
 }
-export default ({ content, show, setShow }: Props) => {
+export default ({ content, show, setShow, maskClosable = true }: Props) => {
   const [slideUp, setSlideUp] = useState(false);
-  const handleClose = () => {
+  const handleMaskClick = () => {
+    maskClosable && handleClose(false)
+  }
+  const handleClose = (b: boolean) => {
     setSlideUp(false);
     setTimeout(() => {
-      setShow(false);
+      setShow(b);
       Taro.showTabBar();
     }, 100);
     
@@ -51,8 +55,11 @@ export default ({ content, show, setShow }: Props) => {
        <RootPortal>
         <View
           className={`taro-portal-container ${style.popup}`}
+          onClick={handleMaskClick}
           >
-          <View className={`${style.container} ${slideUp ? style.show : ""}`}>
+          <View className={`${style.container} ${slideUp ? style.show : ""}`} onClick={(e)=> {
+            e.stopPropagation()
+          }}>
             <View className={style.content}>
               {content.map((data, index) => {
                 return (
@@ -69,7 +76,7 @@ export default ({ content, show, setShow }: Props) => {
                 );
               })}
             </View>
-            <View className={style.bottomContainer} onClick={handleClose}>
+            <View className={style.bottomContainer} onClick={()=> handleClose(false)}>
               <View className={style.bottomButton}>取消</View>
             </View>
           </View>

+ 1 - 1
src/components/wemeta-textarea/index.tsx

@@ -82,7 +82,7 @@ const index = ({
           style={extraStyle}
           onInput={(e: any) => handleInput(e.target.value)}
           placeholder={placeholder}
-          placeholderStyle="rgba(0,0,0,.05)"
+          placeholderStyle="rgba(0,0,0,.25)"
           className={`${style.textInput} ${extraClass}`}
           onFocus={handleFocus}
           onBlur={handleBlur}

+ 5 - 2
src/pages/agent-avatars/index.tsx

@@ -14,10 +14,9 @@ import style from "./index.module.less";
 import { TAvatarItem } from "@/service/storage";
 import { useAgentStore } from "@/store/agentStore";
 
-import Taro from "@tarojs/taro";
+import Taro, { useDidShow } from "@tarojs/taro";
 import { isSuccess } from "@/utils";
 import IconDeleteGray16 from "@/components/icon/IconDeleteGray16";
-import EmptyData from "@/components/empty-data";
 import { useModalStore } from "@/store/modalStore";
 import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
 
@@ -76,6 +75,10 @@ export default function Index() {
     });
   };
 
+  useDidShow(()=> {
+    mutate()
+  })
+
   const renderMedia = (avatar: TAvatarItem) => {
     if (avatar.isVideo) {
       return <>

+ 1 - 1
src/pages/agent-gen/components/step/StepPick.tsx

@@ -159,7 +159,7 @@ export default React.memo(function Index({ prev, next, taskId, avatars, videos,
           {avatarsList.map(avatar => {
             return <SwiperItem>
               <View className={style.swiperItem}>
-                <AvatarMedia source={avatar.avatarUrl} className="w-full h-full" />
+                <AvatarMedia roundedFull={false} source={avatar.avatarUrl} className="w-full h-full" />
                 {/* <Image
                   mode="widthFix"
                   src={avatar.avatarUrl}

+ 16 - 5
src/pages/chat-messages/index.tsx

@@ -1,5 +1,5 @@
 import { View, Image, Text } from "@tarojs/components";
-import Taro, { useReachBottom, useRouter } from "@tarojs/taro";
+import Taro, { useRouter } from "@tarojs/taro";
 import NavBarNormal from "@/components/NavBarNormal/index";
 import PageCustom from "@/components/page-custom/index";
 import { useEffect, useState } from "react";
@@ -9,9 +9,6 @@ import VisitorSummary from "./components/VisitorSummary";
 
 import { getVisitorMessagesByMsgId } from "@/service/visitor";
 import { TVisitorAgent, TVisitorChat } from "@/types/visitor";
-import IconEditButtonBlue from "@/images/svgs/dashboard/IconEditButtonBlue.svg";
-import style from "./index.module.less";
-import { EComponentType } from "@/consts/enum";
 import { EContentType, TMessageBodyContent } from "@/types/bot";
 
 export default () => {
@@ -51,7 +48,21 @@ export default () => {
         }
         return item
       })
-      setList(data)
+      // 提取提问与回答,返回的原数据数组回答排在了提问前面,还需要过虑掉没有回答的提问
+      const result:TVisitorChat[] = []
+      for(let i=0; i< data.length;){
+        console.log(data[i])
+        if(data[i] && data[i].role === 'assistant'){
+          if(data[i+1] && data[i+1].role === 'user'){
+            result.push(data[i+1])
+            result.push(data[i])
+            i+=2
+            continue
+          }
+        }
+        i++;
+      }
+      setList(result)
     }
   };
 

+ 0 - 2
src/pages/chat/components/keyboard.ts

@@ -46,7 +46,6 @@ export const useKeyboard = (scrollViewRef: React.MutableRefObject<any>, messageL
         .select(contentId)
         .boundingClientRect((rect: any) => {
           if (rect) {
-            console.log(rect.height,11)
             setContentHeight(rect.height);
           }
         })
@@ -56,7 +55,6 @@ export const useKeyboard = (scrollViewRef: React.MutableRefObject<any>, messageL
         .select(scrollViewId)
         .boundingClientRect((rect: any) => {
           if (rect) {
-            console.log(rect.height,22)
             setScrollViewHeight(rect.height);
           }
         })

+ 2 - 2
src/pages/contact/index.tsx

@@ -12,7 +12,7 @@ import PageCustom from "@/components/page-custom/index";
 import { TContactItem } from "@/types/contact";
 import { isSuccess } from "@/utils";
 import { delContact } from "@/service/contact";
-import TabPageCheckLogin from "@/components/TabPageCheckLogin";
+import CheckLoginPopup from "@/components/CheckLoginPopup";
 import BlurContainer from "@/components/BlurContainer";
 import SliderAction from "@/components/SliderAction";
 
@@ -181,7 +181,7 @@ export default function Index() {
           </ScrollView>
         </BlurContainer>
       </View>
-      <TabPageCheckLogin onEnd={onLoginEnd}></TabPageCheckLogin>
+      <CheckLoginPopup onEnd={onLoginEnd}></CheckLoginPopup>
     </PageCustom>
   );
 }

+ 2 - 2
src/pages/dashboard/index.tsx

@@ -15,7 +15,7 @@ import { TAgent } from "@/types/agent";
 import { TVisitorAgent } from "@/types/visitor";
 import { getVisitorList } from "@/service/visitor";
 import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
-import TabPageCheckLogin from '@/components/TabPageCheckLogin'
+import CheckLoginPopup from '@/components/CheckLoginPopup'
 export default () => {
   
   const {agents, fetchAgents} = useAgentStore()
@@ -124,7 +124,7 @@ export default () => {
         
         <AgentList show={show} setShow={setShow} currentAgent={currentAgent} setCurrentAgent={setCurrentAgent}></AgentList>
 
-        <TabPageCheckLogin onEnd={onLoginEnd}></TabPageCheckLogin>
+        <CheckLoginPopup onEnd={onLoginEnd}></CheckLoginPopup>
       </View>
       
     </PageCustom>

+ 2 - 2
src/pages/editor-pages/editor-channels/index.tsx

@@ -167,7 +167,7 @@ export default function Index() {
             <View className={editorStyle.formItem}>
               <View className={editorStyle.formItemLabel}>
                 <View className="flex-1">视频号ID</View>
-                <View className="text-green" onClick={showTips(1)}>
+                <View className="text-primary" onClick={showTips(1)}>
                   如何获取?
                 </View>
               </View>
@@ -180,7 +180,7 @@ export default function Index() {
             <View className={editorStyle.formItem}>
               <View className={editorStyle.formItemLabel}>
                 <View className="flex-1">视频号视频ID</View>
-                <View className="text-green" onClick={showTips(2)}>
+                <View className="text-primary" onClick={showTips(2)}>
                   如何获取?
                 </View>
               </View>

+ 5 - 5
src/pages/knowledge-item/index.tsx

@@ -131,11 +131,11 @@ export default function Index() {
               figure={() => {
                 return <KnowledgeIcon data={detail}/>
               }}
-              rightRenderer={() => (
-                !isEnt ? <View>
-                  <IconEye />
-                </View> : <></>
-              )}
+              // rightRenderer={() => (
+              //   !isEnt ? <View>
+              //     <IconEye />
+              //   </View> : <></>
+              // )}
             >
               <View className="text-14 leading-22 truncate">
                 {detail?.title}

+ 1 - 1
src/pages/knowledge/components/CompanyTab/components/ScrollList.tsx

@@ -101,7 +101,7 @@ const Index = ({ entId, setTotalCount }: Iprops) => {
               <View className="flex flex-col flex-1 gap-2 w-full truncate">
                 <View className="text-14 leading-22 truncate">{item.title}</View>
                 <View className="text-12 leading-20 text-gray-45">
-                  {item.createTime} | {item.fileSize}
+                  {item.createTime} | {item.fileSizeStr}
                 </View>
               </View>
             </FigureListItem>

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

@@ -8,6 +8,7 @@ import ScrollList from "./components/ScrollList";
 import CompanyList from '../CompanyList'
 import { TEntItem } from "@/types/user";
 import StyleFilter, {TListStyle} from '../StyleFilter'
+import { useUserStore } from "@/store/userStore";
 
 
 const Index = () => {
@@ -15,6 +16,7 @@ const Index = () => {
   const [ent, setEnt] = useState<TEntItem|null>(null)
   const [assistantOnly, setAssistantOnly] = useState(false);
   const [totalCount, setTotalCount] = useState<number>(0);  
+  const {entList } = useUserStore();
 
   const renderScrollList = () => {
     if (!ent?.entId) {
@@ -32,11 +34,11 @@ const Index = () => {
         <View className="px-16">
           <CompanyList setCurrentEnt={setEnt} currentEnt={ent}></CompanyList>
         </View>
-        <StyleFilter checked={assistantOnly} setChecked={setAssistantOnly} listStyle={listStyle} setListStyle={setListStyle}>
+        {entList.length > 0 && <StyleFilter checked={assistantOnly} setChecked={setAssistantOnly} listStyle={listStyle} setListStyle={setListStyle}>
           <View className="flex-1 text-12 leading-20 text-gray-45">
             共 {totalCount ?? 0} 个文件
           </View>
-        </StyleFilter>
+        </StyleFilter>}
         
       </View>
       

+ 2 - 2
src/pages/knowledge/index.tsx

@@ -10,7 +10,7 @@ import BlurContainer from "@/components/BlurContainer";
 import PersonalTab from "./components/PersonalTab";
 import CompanyTab from "./components/CompanyTab";
 import CorrectionTab from "./components/CorrectionTab";
-import TabPageCheckLogin from '@/components/TabPageCheckLogin'
+import CheckLoginPopup from '@/components/CheckLoginPopup'
 import style from "./index.module.less";
 import { useRef, useState } from "react";
 import Taro, { useDidShow } from "@tarojs/taro";
@@ -74,7 +74,7 @@ export default function Index() {
           </LoginMutationContext.Provider>
         </View>
       </View>
-      <TabPageCheckLogin onEnd={onLoginEnd} ref={loginRef}></TabPageCheckLogin>
+      <CheckLoginPopup onEnd={onLoginEnd} ref={loginRef}></CheckLoginPopup>
     </PageCustom>
   );
 }

+ 5 - 0
src/pages/privacy/index.tsx

@@ -11,6 +11,8 @@ import WemetaSwitch from "@/components/WemetaSwitch";
 import { useUserStore } from "@/store/userStore";
 
 import { setMyPrivacy } from "@/service/user";
+import { useEffect } from "react";
+import { useDidShow } from "@tarojs/taro";
 
 export default function Index() {
   const { fetchMyPrivacy, privacy } = useUserStore();
@@ -21,6 +23,9 @@ export default function Index() {
     });
     fetchMyPrivacy();
   };
+  useDidShow(()=> {
+    fetchMyPrivacy()
+  })
   return (
     <PageCustom>
       <NavBarNormal backText="隐私设置"></NavBarNormal>

+ 63 - 17
src/pages/profile/index.tsx

@@ -17,7 +17,7 @@ import { postLog } from "./profile";
 import { useIsLogin } from "@/xiaolanbenlib/hooks/data/useAuth";
 
 export default function Profile() {
-  const { agentProfile, fetchAgentProfile } = useAgentStore();
+  const { agentProfile, fetchAgentProfile, createAgent } = useAgentStore();
   const params = useRouter().params;
   const isLogin = useIsLogin();
 
@@ -31,8 +31,11 @@ export default function Profile() {
           agentId?: string;
         };
         if (originalScene.agentId) {
-          console.log(originalScene, 111);
-          fetchAgentProfile(originalScene.agentId);
+          console.log("originalScene:", originalScene);
+          fetchAgentProfile(
+            originalScene.agentId,
+            originalScene.shareKey ?? ""
+          );
           postLog(originalScene.agentId, originalScene.shareKey ?? "");
         }
       } catch (e) {
@@ -57,7 +60,7 @@ export default function Profile() {
   // 正常分享出来的页面
   useEffect(() => {
     if (params.agentId) {
-      fetchAgentProfile(params.agentId);
+      fetchAgentProfile(params.agentId, params.shareKey ?? "");
       isLogin && postLog(params.agentId, params.shareKey);
     }
   }, [params.agentId]);
@@ -66,7 +69,8 @@ export default function Profile() {
     const pages = getCurrentPages();
     console.log(pages, "当前页面");
     // 有后退页,则不显示 home 按钮
-    if (pages.length > 1) {
+
+    if (pages.length > 1 && pages[0].route !== "pages/profile/index") {
       return (
         <View className={style.navButtons}>
           <View
@@ -124,22 +128,64 @@ export default function Profile() {
     // );
   };
 
+  const handleCreate = async () => {
+    try {
+      const agentDetail = await createAgent();
+      if (agentDetail) {
+        if (agentDetail) {
+          Taro.navigateTo({
+            url: `/pages/agent/index?agentId=${agentDetail.agentId}`,
+          });
+        }
+        // Taro.navigateTo({
+        //   url: `/pages/agent/index?agentId=${agentDetail.agentId}`
+        // })
+      }
+    } catch (e) {}
+  };
+
+  const renderButton = ()=> {
+    // 如果智能体交接了,则可以跳去新智能体
+    if(agentProfile?.toAgentId){
+      return <View className="button-rounded-big" onClick={()=> {
+        Taro.navigateTo({
+          url: `/pages/profile/index?agentId=${agentProfile?.toAgentId}`
+        });
+      }}>前往访问</View>
+    }
+    // 下线了
+    return <View className="button-rounded-big">知道了</View>
+  }
+
+   // 如果智能体被删除或其它异常情况
+   if (agentProfile?.status === "deleted" || agentProfile?.deletedTip?.length) {
+    return (
+      <PageCustom fullPage>
+        <View className="w-full h-full">
+          <NavBarNormal leftColumn={renderNavBarLeft}></NavBarNormal>
+        <View className="w-full h-full flex flex-col items-center justify-center">
+          <View className="max-w-[280px]">
+            <View className="mb-12">{agentProfile?.deletedTip}</View>
+            {renderButton()}
+          </View>
+        </View>
+      </View>
+      </PageCustom>
+    );
+  }
+
   return (
     <PageCustom styleBg={agentProfile?.avatarUrl}>
       <View className="w-full">
         <NavBarNormal leftColumn={renderNavBarLeft}></NavBarNormal>
-        <View className="blur-rounded-container">
-          {agentProfile && (
-            <>
-              <SummaryBar isVisitor agent={agentProfile}></SummaryBar>
-              <View className="flex flex-col w-full p-16 gap-12">
-                <ComponentList
-                  components={agentProfile.components ?? []}
-                ></ComponentList>
-              </View>
-            </>
-          )}
-        </View>
+        {agentProfile && <View className="blur-rounded-container">
+          <SummaryBar isVisitor agent={agentProfile}></SummaryBar>
+          <View className="flex flex-col w-full p-16 gap-12">
+            <ComponentList
+              components={agentProfile.components ?? []}
+            ></ComponentList>
+          </View>
+        </View>}
       </View>
     </PageCustom>
   );

+ 1 - 1
src/pages/visiteor-detail/components/VisitorSummary/index.tsx

@@ -30,7 +30,7 @@ const VisitorSummary = ({ data }: IndexProps) => {
                 <View className="text-12 leading-20">{data.position ?? ""}</View>
               </View>
               <View className="flex items-center gap-2">
-                {/* <View className="text-12 leading-20 truncate max-w-[188px]">{data.}</View> */}
+                <View className="text-12 leading-20 truncate max-w-[188px]">{data?.entName || ''}</View>
                 {data.isEnt && <TagCertificated />}
               </View>
             </View>

+ 6 - 7
src/pages/visiteor-detail/index.tsx

@@ -25,8 +25,7 @@ export default () => {
   }
 
   const [visitor, setVisitor] = useState<TVisitorAgent>();
-  
-  const [totalCount, setTotalCount] = useState(1);
+
 
   const fetchData = async () => {
     if (visitorId) {
@@ -37,19 +36,19 @@ export default () => {
     }
   };
 
-  const fetcher = async ([_url, {nextId, pageSize, pageIndex}]) => {
+  const fetcher = async ([_url, {nextId, pageSize}]) => {
     const res = await getVisitorSessions({
       startId: nextId,
       pageSize,
       visitorId,
     });
-    const _totalCount = res.data.totalCount || 0;
+    const _totalCount = res.data.totalCount;
     
     if (_totalCount && res.data.data) {
-      // setTotalCount(_totalCount);
+      // 添加 visitTimes 第几轮访问
       const data = res.data;
       data.data = data.data.map((item: TSessionItem) => {
-        let  turns = _totalCount - pageIndex
+        let  turns = _totalCount - (pageIndex-1)
         turns = turns <= 0 ? 1 : turns;
         return { ...item, visitTimes: turns };
       });
@@ -98,7 +97,7 @@ export default () => {
           }}
         >
           <View>
-            <View className="flex flex-col gap-16 px-16 w-full">
+            <View className="flex flex-col gap-16 px-16 w-full pb-100">
               {list.length <= 0 && <View className="pt-100"><EmptyData type={'chat'} /></View>}
               {list.map((item) => {
                 return (

+ 1 - 1
src/service/visitor.ts

@@ -69,7 +69,7 @@ export type TVisotorInfoResponse = {
   visitorId: number;
 };
 export const getVisitorInfo = (visitorId: number | string) => {
-  return request.get<TVisotorInfoResponse>(
+  return request.get<TVisitorAgent>(
     `${bluebookAiAgent}api/v1/my/visitor/info`,
     { params: { visitorId } }
   );

+ 1 - 1
src/store/agentStore.ts

@@ -37,7 +37,7 @@ export interface AgentStoreState {
   // 请求智能体数据登录状态
   fetchAgent: (agentId: string) => Promise<TAgentDetail | null>;
   // 请求智能体数据非登录状态
-  fetchAgentProfile: (agentId: string) => Promise<TAgentDetail | null>;
+  fetchAgentProfile: (agentId: string, shareKey?: string) => Promise<TAgentDetail | null>;
   createAgent: () => Promise<TAgentDetail | null>;
   setDefaultAgent: (agentId: string) => Promise<TAgentDetail | null>;
   editAgentCharacter: (

+ 0 - 94
src/utils/loadMore.ts

@@ -1,94 +0,0 @@
-import { useState } from "react";
-import useSWR from "swr";
-
-type TResponseData<T> = {
-  data:T
-  nextId?: string
-  totalCount?: null|number
-  pageIndex?: number
-  pageSize?: number
-}
-
-export const useLoadMore = <T>({url, fetcher, startId, pageIndex=1,  pageSize = 10, params = [], } : {
-  url: string,
-  fetcher: any,
-  startId?: number, // nextId
-  pageIndex?: number,
-  pageSize?: number,
-  params?: any[]
-
-}) => {
-  const [page, setPage]  = useState(pageIndex)
-  const [nextId, setNextId]  = useState(startId)
-  console.log(url, nextId, page, pageSize)
-  // 使用 useSWR
-  const { data, error, isLoading, mutate } = useSWR<TResponseData<T>>(
-    // key 数组,当这些值变化时会重新请求
-    [url, nextId, page, pageSize, ...params],
-    fetcher,
-    {
-      onErrorRetry(err, key, config, revalidate, revalidateOpts) {
-        if(err.status === 404) return 
-        if(err.status === 401) return
-        if(revalidateOpts.retryCount >=3 )return
-      },
-    }
-  )
-
-  
-  // 多页加载 可能返回的数据结构
-  // nextId?: string
-  // totalCount?: null|number
-  // pageIndex?: number
-  // pageSize?: number
-  const hasNextPage = ()=> {
-    if(data?.totalCount  === null || data?.totalCount === undefined){
-      return false
-    }
-    if(data?.totalCount <= 0){
-      return false
-    }
-    // 如果返回的是 nextId 则没有 pageIndex 和 pageSize
-    if(data?.pageIndex === undefined){
-      return false
-    }
-    if(data?.pageSize === undefined){
-      return false
-    }
-    if(data.totalCount > (data.pageSize * data.pageIndex)){
-      return true
-    }
-  }
-  
-  // 加载更多数据
-  const loadMore = () => {
-    // console.log(data?.nextId, data?.totalCount, data.pageSize * data.pageIndex)
-    // data.totalCount 可能为 null , 
-    // data.pageIndex 可能为 undefined
-    // null > NaN === false
-    
-    if (data?.nextId || hasNextPage()) {
-      //@ts-ignore
-      setNextId(data.nextId);
-      setPage(prev => prev + 1);
-      // 这里可以选择是否立即 mutate,通常 setPage/setNextId 后 useSWR 会自动请求
-    }
-  }
-
-  const refetch = async () => {
-    setPage(1);
-    setNextId(undefined)
-    mutate(undefined, true); // 重新请求数据
-  }
-
-  return {
-    page,
-    setPage,
-    data,
-    error,
-    isLoading,
-    mutate,
-    loadMore,
-    refetch,
-  }
-}

+ 2 - 1
src/utils/loadMoreInfinite.ts

@@ -18,7 +18,8 @@ export const createKey = (query: string, pageSize: number = 10, extra: Record<st
         { nextId: undefined, pageSize, pageIndex: pageIndex + 1 },
         extra,
       ];
-      // 如果是以 pageIndex 作为分页依据
+      // 如果是以 pageIndex 作为分页依据, 即有pageIndex 且 没有 nextId
+      // 
     if (previousPageData && previousPageData.pageIndex && !previousPageData.nextId) {
       return [
         query,