Kaynağa Gözat

feat: 纠错记录接入删除与编辑功能

王晓东 1 hafta önce
ebeveyn
işleme
c1f2054a18

+ 1 - 1
project.private.config.json

@@ -80,7 +80,7 @@
         },
         {
           "name": "知识库编辑",
-          "pathName": "pages/knowledge-item-editor/index",
+          "pathName": "pages/editor-knowledge-item/index",
           "query": "",
           "launchMode": "default",
           "scene": null

+ 2 - 1
src/app.config.ts

@@ -12,7 +12,8 @@ export default defineAppConfig({
     'pages/contact/index',
     'pages/knowledge/index',
     'pages/knowledge-item/index',
-    'pages/knowledge-item-editor/index',
+    'pages/editor-knowledge-item/index',
+    'pages/editor-correction-item/index',
     'pages/agent/index',
     'pages/agent-avatars/index',
     'pages/editor-pages/editor-personality/index',

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

@@ -13,7 +13,7 @@ const Index = ({ className='', children }: IndexProps) => {
       <View className={style.blurBgContainer}>
         <View className={style.blurBg}></View>
       </View>
-      <View className="h-full relative z-10">
+      <View className="flex-1 h-full relative z-10 flex flex-col w-full">
         {children}
       </View>
     </View>

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

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

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

@@ -66,7 +66,7 @@ export default function Index({
   }
 
   return (
-    <View className="w-full">
+    <View className="w-full h-full">
       <View className={`flex items-center gap-8 ${className}`}>
         {list.map((item) => {
           return (

+ 2 - 1
src/pages/chat/components/input-bar/chatInput.ts

@@ -126,10 +126,11 @@ export const useChatInput = ({ agent, setShowWelcome, setDisabled, }: Props) =>
         }
         
         // 将智能体的回答保存至服务器
+        // currentRobotMessage.content 保存的是当前完整的智能体回复信息文本
         await saveMessageToServer({
           loginId,
           messages: [{
-            content: currentRobotMessage?.body?.content ?? currentRobotMessage.content,
+            content: currentRobotMessage.content ?? currentRobotMessage?.body?.content,
             contentType: currentRobotMessage?.body?.contentType ?? EContentType.TextPlain,
             isStreaming: false,
             role: currentRobotMessage.role,

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

@@ -174,7 +174,7 @@ const agent = useAgentStore((state) => {
       <NavBarNormal blur leftColumn={renderNavLeft}></NavBarNormal>
       {renderTopBg()}
       <View
-        className="flex flex-col w-full h-full relative z-10"
+        className="flex flex-col w-full h-full relative z-10 flex-1"
         style={{ marginTop: `${marginTopOffset}px` }}
       >
         <ScrollView

+ 5 - 5
src/pages/contact/components/contact-card/index.tsx

@@ -26,13 +26,13 @@ const Index = ({data, deleteable, className, refresh, fromContact}: Props)=> {
       <View className={style.avatar}>
         <AvatarMedia source={data.avatarUrl || ''} mode="aspectFill" className={style.avatar}></AvatarMedia>
       </View>
-      <View className={style.infoColumn}>
-        <View className={style.nameRow}>
-          <View className={style.nickName}>{data.name}</View>
+      <View className={`${style.infoColumn} truncate`}>
+        <View className={`${style.nameRow} truncate`}>
+          <View className={`${style.nickName} truncate`}>{data.name}</View>
           {data.isEnt && <IconCertificateColor></IconCertificateColor>}
         </View>
-        <View className='flex items-center w-full'>
-          <View className={`flex-1 ${style.subInfo}`}>{data.lastChatMsg}</View>
+        <View className='flex items-center w-full truncate'>
+          <View className={`flex-1 ${style.subInfo} truncate`}>{data.lastChatMsg}</View>
           {(!!data?.tipCnt) && <View className={style.tipCnt}>{data.tipCnt} </View>}
         </View>
         

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

@@ -65,7 +65,7 @@ export default function Index() {
     setSize((prevSize) => prevSize + 1);
   };
 
-  const handleHello = async (e: any) => {
+  const handleAction = async (e: any) => {
     const detail = e.detail as { type: string; id: string };
     console.log(detail);
     // 置顶与取消置顶
@@ -119,11 +119,11 @@ export default function Index() {
   const renderContent = () => {
     if (list?.length) {
       return list.map((item) => (
-        <View className={`rounded-12 overflow-hidden`}>
+        <View className={`rounded-12 overflow-hidden truncate`}>
           <slide-contact
             pid={item.contactId}
             pinned={item.isTop}
-            onAction={handleHello}
+            onAction={handleAction}
           >
             <View className={``}>
               <ContactCard
@@ -168,7 +168,7 @@ export default function Index() {
               height: "100%", // 高度自适应
             }}
           >
-            <View className={style.contactContent}>{renderContent()}</View>
+            <View className={`${style.contactContent}`}>{renderContent()}</View>
           </ScrollView>
         </BlurContainer>
       </View>

+ 3 - 3
src/pages/dislike-messages/index.tsx

@@ -132,9 +132,9 @@ export default function Index() {
 
   const createCardOptions = (item: TVisitorChat) => {
     return [
-      <View onClick={() => handleDeleteItem(item)}>删除</View>,
-      <View onClick={() => handleView(item)}>查看对话</View>,
-      <View onClick={() => handleEdit(item)}>编辑</View>,
+      <View className="flex-1 w-full h-full py-12 flex-center" onClick={() => handleDeleteItem(item)}>删除</View>,
+      <View className="flex-1 w-full h-full py-12 flex-center" onClick={() => handleView(item)}>查看对话</View>,
+      <View className="flex-1 w-full h-full py-12 flex-center" onClick={() => handleEdit(item)}>编辑</View>,
     ];
   };
 

+ 0 - 0
src/pages/knowledge-item-editor/index.config.ts → src/pages/editor-correction-item/index.config.ts


+ 259 - 0
src/pages/editor-correction-item/index.tsx

@@ -0,0 +1,259 @@
+/**
+ * 知识库项目编辑
+ */
+
+import { Text, View } from "@tarojs/components";
+
+import PageCustom from "@/components/page-custom/index";
+import NavBarNormal from "@/components/NavBarNormal/index";
+import BottomBar from "@/components/BottomBar";
+
+import IconQ from "@/components/icon/IconQ";
+import IconA from "@/components/icon/IconA";
+
+import IconPlusColor14 from "@/components/icon/IconPlusColor14";
+import IconALink from "@/components/icon/IconALink";
+import IconDeleteGray16 from "@/components/icon/IconDeleteGray16";
+import { useEffect, useState } from "react";
+import IconAImage from "@/components/icon/IconAImage";
+import WemetaTextarea from "@/components/wemeta-textarea";
+import WemetaInput from "@/components/wemeta-input";
+import UploaderGrid from '@/components/UploaderGrid'
+import type { TMediaType } from "@/types/index";
+
+import { uploadFile } from "@/utils/http";
+import { EUploadFileScene } from "@/consts/enum";
+
+import Taro, { useRouter } from "@tarojs/taro";
+import { getCorrectionDetail, editCorrection } from "@/service/correction";
+import { isSuccess } from "@/utils";
+
+type TFormdata = {q:string, a: string, links: string[], mediaList: TMediaType[]}
+
+
+export default function Index() {
+
+  const router = useRouter()
+  const { correctionId } = router.params
+  
+  const [formData, setFormData] = useState<TFormdata>(
+    {
+      q: '',
+      a: '',
+      links: [],
+      mediaList: [] //{fileType: 'image',url: 'https://cdn.wehome.cn/cmn/png/53/META-H8UKWHWU-2JNUAG2BARJF55VHU9QS3-YBQGHDAM-IW.png'}
+    }
+  );
+
+  const handleInput = (value: string) => {
+    setFormData({
+      ...formData,
+      q: value,
+    });
+  };
+  const handleValueAInput = (value: string) => {
+    setFormData({
+      ...formData,
+      a: value,
+    });
+  };
+
+  // 添加链接
+  const addLink = () => {
+    setFormData({
+      ...formData,
+      links: [...formData.links, ""],
+    });
+  };
+
+  // 删除链接
+  const removeLink = (e, index) => {
+    e.stopPropagation();
+    const newLinks = [...formData.links];
+    newLinks.splice(index, 1);
+    setFormData({
+      ...formData,
+      links: newLinks,
+    });
+  };
+
+  // 更新单个链接
+  const handleLinkChange = (index:number, value: string) => {
+    const newLinks = [...formData.links];
+    newLinks[index] = value;
+    setFormData({
+      ...formData,
+      links: newLinks,
+    });
+  };
+
+  const handleDeleteMedia = (index:number) => {
+    setFormData(prev => ({
+      ...prev,
+      mediaList: prev.mediaList.filter((_, i) => i !== index)
+    }));
+  };
+
+  const handleSubmit = async () => {
+    if(!correctionId){
+      return
+    }
+
+    if(formData.a.length <= 0){
+      Taro.showToast({title: '请输入回答', icon: 'none'})
+      return 
+    }
+    if(formData.q.length <= 0){
+      Taro.showToast({title: '请输入问题描述', icon: 'none'})
+      return 
+    }
+
+    const dataToSubmit = {
+      answer: formData.a,
+      questions: [formData.q],
+      id: correctionId,
+      links: formData.links.filter(link => link.trim() !== ''),
+      pics: formData.mediaList.map( item => item.url)
+    }
+    console.log(dataToSubmit)
+    const {status} = await editCorrection(correctionId, dataToSubmit)
+    if(isSuccess(status)){
+      Taro.showToast({title: '保存成功', icon: 'none'})
+      setTimeout(() => {
+        Taro.navigateBack()
+      }, 300)
+    }
+  }
+  const getQaDetail = async (correctionId: string|number)=> {
+    const {status, data} = await getCorrectionDetail(correctionId)
+    if(isSuccess(status)){
+      setFormData({
+        q: data.questions[0],
+        a: data.answer,
+        links: data.links,
+        mediaList: data.pics.map( pic => {
+          return {fileType: 'image', url: pic}
+        }),
+      })
+    }
+  }
+
+
+  const handleChooseMedia = ()=> {
+    Taro.chooseMedia({
+      count: 10,
+      mediaType: ["image"],
+      sourceType: ["album", "camera"],
+      async success(r) {
+        // const tempFiles = r.tempFiles;
+        for (const tempFile of r.tempFiles){
+          const result = await uploadFile(tempFile.tempFilePath, EUploadFileScene.OTHER)
+          if(result?.publicUrl){
+            setFormData(prev => {
+              return {...prev, mediaList: [{fileType:'image', url: result.publicUrl}, ...prev.mediaList]}
+            })
+          }
+        }
+      }
+    })
+  }
+
+  useEffect(()=> {
+    if(correctionId){
+        getQaDetail(correctionId)
+    }
+    
+  }, [correctionId])
+
+  
+
+  return (
+    <PageCustom>
+      <NavBarNormal scrollFadeIn backText={'纠错记录'}></NavBarNormal>
+      <View className="w-full pb-120">
+        <View className="p-16">
+          <View className="flex flex-col gap-16">
+            <View className="flex flex-col">
+              <View className="flex items-start gap-8 mb-6">
+                <View className="flex-center h-28">
+                  <IconQ />
+                </View>
+                <View className="flex-1 text-14 leading-28">问题描述</View>
+              </View>
+              <View className="">
+                <WemetaTextarea
+                  value={formData.q}
+                  onInput={handleInput}
+                  placeholder="请输入问题描述"
+                />
+              </View>
+            </View>
+
+            {/* 回答 */}
+            <View className="flex flex-col">
+              <View className="flex items-start gap-8 mb-6">
+                <View className="flex-center h-28">
+                  <IconA />
+                </View>
+                <View className="flex-1 text-14 leading-28">回答</View>
+              </View>
+              <View>
+                <WemetaTextarea
+                  value={formData.a}
+                  onInput={handleValueAInput}
+                  placeholder="请输入回答"
+                />
+              </View>
+            </View>
+
+            {/* 链接 */}
+            <View className="flex flex-col">
+              <View className="flex items-start gap-8 mb-6">
+                <View className="flex-center h-28">
+                  <IconALink />
+                </View>
+                <View className="flex-1 text-14 leading-28">链接</View>
+                <View className="flex-center px-8 gap-4" onClick={addLink}>
+                  <IconPlusColor14 />
+                  <View className="text-primary">新增</View>
+                </View>
+              </View>
+              <View className="flex flex-col gap-8">
+                {formData.links.map((link, index) => {
+                  return (
+                    <WemetaInput
+                      value={link}
+                      onInput={(value) => handleLinkChange(index, value)}
+                      suffix={() => (
+                        <View onClick={(e) => removeLink(e, index)}>
+                          <IconDeleteGray16 />
+                        </View>
+                      )}
+                      placeholder="请输入查看链接,支持长按粘贴..."
+                    />
+                  );
+                })}
+              </View>
+            </View>
+
+            {/* 图片 */}
+            <View className="flex flex-col">
+              <View className="flex items-start gap-8 mb-6">
+                <View className="flex-center h-28">
+                  <IconAImage />
+                </View>
+                <View className="flex-1 text-14 leading-28">图片</View>
+              </View>
+              <UploaderGrid onNewUpload={handleChooseMedia}  list = {formData.mediaList} onChange={()=> {}} onDelete={handleDeleteMedia} />
+            </View>
+            
+          </View>
+        </View>
+
+        <BottomBar>
+          <View className="button-rounded button-primary flex-1" onClick={handleSubmit}>保存</View>
+        </BottomBar>
+      </View>
+    </PageCustom>
+  );
+}

+ 5 - 0
src/pages/editor-knowledge-item/index.config.ts

@@ -0,0 +1,5 @@
+export default definePageConfig({
+  navigationBarTitleText: '知识库编辑',
+  "usingComponents": {},
+  navigationStyle: 'custom'
+})

+ 0 - 0
src/pages/knowledge-item-editor/index.tsx → src/pages/editor-knowledge-item/index.tsx


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

@@ -42,7 +42,7 @@ export default function Index() {
 
   const handleEdit = (qaId: number | string) => {
     Taro.navigateTo({
-      url: `/pages/knowledge-item-editor/index?knowledgeId=${knowledgeId}&qaId=${qaId}&knowledgeTitle=${detail?.title}`,
+      url: `/pages/editor-knowledge-item/index?knowledgeId=${knowledgeId}&qaId=${qaId}&knowledgeTitle=${detail?.title}`,
     });
   };
   

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

@@ -89,7 +89,7 @@ const Index = ({ entId, setTotalCount }: Iprops) => {
       ) : (
         <></>
       )}
-      <FigureList className="mx-16">
+      <FigureList className="mx-16 pb-[240px]">
         {list.map((item) => {
           return (
             <FigureListItem
@@ -98,8 +98,8 @@ const Index = ({ entId, setTotalCount }: Iprops) => {
               onClick={() => handleEdit(item)}
               rightRenderer={() => rightRenderer(item)}
             >
-              <View className="flex flex-col flex-1 gap-2 w-full">
-                <View className="text-14 leading-22">{item.title}</View>
+              <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}
                 </View>

+ 3 - 3
src/pages/knowledge/components/CompanyTab/components/ScrollListChat.tsx

@@ -81,7 +81,7 @@ const Index = ({ entId, assistantOnly, setTotalCount }: Iprops) => {
         height: "100%", // 高度自适应
       }}
     >
-      <View className="flex flex-col gap-20 pb-120 mx-16">
+      <View className="flex flex-col gap-20 pb-[240px] mx-16">
         {reversedList.length<=0 ? <View className="pt-46"><EmptyData type={'plane'}/></View> : <></>}
         {reversedList.map((group) => {
           // 渲染自己发送的消息
@@ -97,7 +97,7 @@ const Index = ({ entId, assistantOnly, setTotalCount }: Iprops) => {
                   <View className="flex items-center gap-12">
                     <KnowledgeIcon data={item} />
                     <View className="flex flex-col flex-1 gap-2">
-                      <View className="text-14 leading-22">{item.title}</View>
+                      <View className="text-14 leading-22 truncate">{item.title}</View>
                       <View className="text-12 leading-20 text-gray-45">
                         {item.createTime} | {item.fileSizeStr}
                       </View>
@@ -129,7 +129,7 @@ const Index = ({ entId, assistantOnly, setTotalCount }: Iprops) => {
                         })
                       }
                     >
-                      <View className="flex flex-col flex-1 gap-2 w-full truncate">
+                      <View className="flex flex-col flex-1 gap-2 w-full">
                         <View className="text-14 leading-22 truncate">{item.title}</View>
                         <View className="text-12 leading-20 text-gray-45">
                           {item.createTime} | {item.fileSizeStr}

+ 24 - 30
src/pages/knowledge/components/CorrectionTab/components/CorrectionList.tsx

@@ -6,14 +6,9 @@ import { useEffect, useState } from "react";
 import { TCorrectionItem } from "@/types/correction";
 import { getCorrectionList } from "@/service/correction";
 import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
-import IconError from '@/images/svgs/knowledge/IconError.svg'
-import IconCorrect from '@/images/svgs/knowledge/IconCorrect.svg'
-
-import IconA from "@/components/icon/IconA";
-import IconQ from "@/components/icon/IconQ";
-import CardEditable from "@/components/card/card-editable/index";
-
+import { deleteCorrection } from '@/service/correction'
 import { useModalStore } from "@/store/modalStore";
+import { isSuccess } from "@/utils";
 
 export interface Iprops {
   entId?: number|string
@@ -38,7 +33,7 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
     console.log('toUpper')
     loadMore()
   }
-  console.log('pageIndex', pageIndex, list)
+  
   useEffect(() => {
     if(pageIndex === 1){
       console.log('setData', entId)
@@ -57,36 +52,35 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
   }, [data, pageIndex]);
 
 
-  const handleEdit = (qaId: number | string) => {
-    // Taro.navigateTo({
-    //   url: `/pages/knowledge-item-editor/index?knowledgeId=${knowledgeId}&qaId=${qaId}&knowledgeTitle=${detail?.title}`,
-    // });
+  const handleEdit = (id: number|string) => {
+    Taro.navigateTo({
+      url: `/pages/editor-correction-item/index?correctionId=${id}`,
+    });
   };
   
+
   // 删除问答项
-  const handleDeleteItem = async (qaId: number | string) => {
+  const handleDeleteItem = async (id: number|string) => {
     
     showModal({
-      content: "确定删除该问答项吗?",
+      content: "确定删除吗?",
       onConfirm: async () => {
-        // const { status } = await deleteKnowledgeQa(detail.knowledgeId, qaId);
-        // if (isSuccess(status)) {
-        //   Taro.showToast({ title: "删除成功", icon: "success" });
-        //   getDetail(detail.knowledgeId);
-        // }
+        const { status } = await deleteCorrection(id);
+        if (isSuccess(status)) {
+          Taro.showToast({ title: "删除成功", icon: "success" });
+          mutate()
+        }
       },
     });
   };
 
-
-  const createCardOptions = (item: TCorrectionItem) => {
-    return [
-      // <View onClick={() => handleDeleteItem(item.id)}>
-      //   删除
-      // </View>,
-      // <View onClick={() => handleEdit(item.id)}>编辑</View>,
-    ]
+  const handleAction = (e:any)=> {
+    const detail = e.detail as { type: string; id: string };
+    if (detail.type === "delete") {
+      handleDeleteItem(detail.id);
+    } 
   }
+  
   return (
     <ScrollView
       scrollY
@@ -96,12 +90,12 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
         height: "100%", // 高度自适应
       }}
     >
-      <View className="flex flex-col gap-8 mx-16">
+      <View className="flex flex-col gap-8 mx-16 pb-[240px]">
         {list.map((item) => {
           return (
             <View className="rounded-12 overflow-hidden">
-              <slide-delete pid={item.id}>
-                <View className="bg-white p-16">
+              <slide-delete pid={item.id} onAction={handleAction}>
+                <View className="bg-white p-16" onClick={() => handleEdit(item.id)}>
                   <View className="text-14 leading-28 font-medium">{item.questions[0]}</View>
                 </View>
               </slide-delete>

+ 21 - 19
src/pages/knowledge/components/CorrectionTab/components/CorrectionListChat.tsx

@@ -10,8 +10,10 @@ import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
 import IconA from "@/components/icon/IconA";
 import IconQ from "@/components/icon/IconQ";
 import CardEditable from "@/components/card/card-editable/index";
+import { deleteCorrection } from '@/service/correction'
 
 import { useModalStore } from "@/store/modalStore";
+import { isSuccess } from "@/utils";
 
 export interface Iprops {
   entId?: number|string
@@ -55,23 +57,23 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
   }, [data, pageIndex]);
 
 
-  const handleEdit = (qaId: number | string) => {
-    // Taro.navigateTo({
-    //   url: `/pages/knowledge-item-editor/index?knowledgeId=${knowledgeId}&qaId=${qaId}&knowledgeTitle=${detail?.title}`,
-    // });
+  const handleEdit = (id: number|string) => {
+    Taro.navigateTo({
+      url: `/pages/editor-correction-item/index?correctionId=${id}`,
+    });
   };
   
   // 删除问答项
-  const handleDeleteItem = async (qaId: number | string) => {
+  const handleDeleteItem = async (id: number|string) => {
     
     showModal({
-      content: "确定删除该问答项吗?",
+      content: "确定删除吗?",
       onConfirm: async () => {
-        // const { status } = await deleteKnowledgeQa(detail.knowledgeId, qaId);
-        // if (isSuccess(status)) {
-        //   Taro.showToast({ title: "删除成功", icon: "success" });
-        //   getDetail(detail.knowledgeId);
-        // }
+        const { status } = await deleteCorrection(id);
+        if (isSuccess(status)) {
+          Taro.showToast({ title: "删除成功", icon: "success" });
+          mutate()
+        }
       },
     });
   };
@@ -79,10 +81,10 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
 
   const createCardOptions = (item: TCorrectionItem) => {
     return [
-      // <View onClick={() => handleDeleteItem(item.id)}>
-      //   删除
-      // </View>,
-      // <View onClick={() => handleEdit(item.id)}>编辑</View>,
+      <View className="flex-1 w-full h-full py-12 flex-center" onClick={() => handleDeleteItem(item.id)}>
+        删除
+      </View>,
+      <View className="flex-1 w-full h-full py-12 flex-center" onClick={() => handleEdit(item.id)}>编辑</View>,
     ]
   }
   return (
@@ -94,7 +96,7 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
         height: "100%", // 高度自适应
       }}
     >
-      <View className="mx-16">
+      <View className="mx-16 pb-[240px]">
       {list.map((item) => {
         return (
           <View className="flex flex-col gap-16 mb-16">
@@ -118,11 +120,11 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
                   <View className="truncate">{item.answer}</View>
 
                   {!!item.links.length && (
-                    <View className="pb-12">
+                    <View className="pb-12 truncate">
                       {item.links.map((link) => {
                         return (
-                          <View>
-                            查看链接 <Text>{link}</Text>
+                          <View className="truncate">
+                            链接: <Text className="truncate">{link}</Text>
                           </View>
                         );
                       })}

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

@@ -145,7 +145,7 @@ const Index = ({ types, setTotalCount }: IProps) => {
         <></>
       )}
       {/* <slide-delete> 如果被嵌套太深,会无法正常执行原生小程序逻辑 */}
-      <View className="flex flex-col gap-8 mx-16">
+      <View className="flex flex-col gap-8 pb-[240px] mx-16">
         {list.map((item) => {
           // @ts-ignore
           return (

+ 5 - 5
src/pages/knowledge/components/PersonalTab/components/ScrollListChat.tsx

@@ -147,7 +147,7 @@ const Index = ({assistantOnly, setTotalCount}: IProps) => {
         height: '100%', // 高度自适应
       }}
     >
-      <View className="flex flex-col gap-20 pb-80 px-16">
+      <View className="flex flex-col gap-20 pb-[240px] px-16">
         {/* 欢迎语 */}
         {(showAsistantGreeting) && <MessageRobotRich data={DEFAULT_AGENT}><WelcomeCard /></MessageRobotRich>}
 
@@ -164,8 +164,8 @@ const Index = ({assistantOnly, setTotalCount}: IProps) => {
                 }}>
                   <View className="flex items-start gap-12">
                     <View className="w-36 h-36 overflow-hidden pt-4"><KnowledgeIcon data={item} /></View>
-                    <View className="flex flex-col flex-1 gap-2">
-                      <View className="text-14 leading-22">{item.title}</View>
+                    <View className="flex flex-col flex-1 gap-2 truncate">
+                      <View className="text-14 leading-22 truncate">{item.title}</View>
                       <View className="text-12 leading-20 text-gray-45">
                         {item.createTime} | {item.fileSizeStr}
                       </View>
@@ -194,8 +194,8 @@ const Index = ({assistantOnly, setTotalCount}: IProps) => {
                       arrow={item.parseStatus === 'parsed'}
                       onClick={()=> handleEdit(item)}
                     >
-                      <View className="flex flex-col flex-1 gap-2 w-full">
-                        <View className="text-14 leading-22">{item.title}</View>
+                      <View className="flex flex-col flex-1 gap-2 truncate">
+                        <View className="text-14 leading-22 max-w-full min-w-0 inline-block truncate">{item.title}</View>
                         <View className="flex items-center text-12 leading-20 text-gray-45">
                           <View className="flex items-center gap-8">
                             <View>{item.createTime}</View> <View>|</View> { item.parseStatus === 'parsed' ? <View><Text className="text-primary">{`${item.answerCnt}`}</Text> 条问答</View> :  item.fileSizeStr}

+ 6 - 1
src/pages/knowledge/index.module.less

@@ -4,8 +4,13 @@ page {
 .container{
   padding-top: 8px;
   overflow: hidden;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  width: 100%;
 }
 .tabContent{
   margin-top: 12px;
-  height: calc(100vh - 160px);
+  height: 100%;
+  // height: calc(100vh - 160px);
 }

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

@@ -62,12 +62,12 @@ export default function Index() {
   
 
   return (
-    <PageCustom>
+    <PageCustom fullPage>
       <NavBarNormal
         scrollFadeIn
         leftColumn={() => <Text className="text-16 font-medium">知识库</Text>}
       ></NavBarNormal>
-      <View className="w-full">
+      <View className="w-full h-full">
         <View className={style.container}>
           <LoginMutationContext.Provider value={{ isMutate, setLoginShow }}>
             <WemetaTabs current="1" list={tabList} className="px-16"></WemetaTabs>

+ 4 - 1
src/pages/message-editor/index.tsx

@@ -121,6 +121,9 @@ export default function Index() {
     const {status} = await editVisitorDislikeAnswer(dataToSubmit)
     if(isSuccess(status)){
       Taro.showToast({title: '保存成功', icon: 'success'})
+      setTimeout(() => {
+        Taro.navigateBack()
+      }, 300)
     }
   }
   const getDetail = async () => {
@@ -194,7 +197,7 @@ export default function Index() {
 
   return (
     <PageCustom>
-      <NavBarNormal scrollFadeIn>{isDislike ? '纠错' : '编辑'}</NavBarNormal>
+      <NavBarNormal scrollFadeIn backText={isDislike ? '纠错记录' : '访问详情'}></NavBarNormal>
       <View className="w-full pb-120">
         <View className="p-16">
           {isDislike && <View className="text-gray-45 text-14 text-center py-8">修改后的问答将存入知识库,持续训练提升您的智能体</View>}

+ 11 - 2
src/service/correction.ts

@@ -23,8 +23,17 @@ export const getCorrectionList = (params: {
 }
 
 // 获取指定的纠错记录详情
-export const getCorrectionDetail = (id: string) => {
-  return request.get<{shortScene: string}>(`${bluebookAiAgent}api/v1/my/correction/${id}`)
+export const getCorrectionDetail = (id: string|number) => {
+  return request.get<TCorrectionItem>(`${bluebookAiAgent}api/v1/my/correction/${id}`)
+}
+// 编辑保存纠错记录信息
+export const editCorrection = (id: string|number, data: TCorrectionItem) => {
+  return request.put(`${bluebookAiAgent}api/v1/my/correction/${id}`, data)
+}
+
+// 删除纠错记录信息
+export const deleteCorrection = (id: string|number) => {
+  return request.delete(`${bluebookAiAgent}api/v1/my/correction/${id}`)
 }
 
 

+ 1 - 1
types/custom-components.d.ts

@@ -3,7 +3,7 @@ import React from "react";
 interface SlideDeleteProps {
   pid: string | number;
   pinned?: boolean;
-  onAction?: (e: any) => Promise<void>;
+  onAction?: (e: any) => void;
   children: React.ReactNode; // 建议用 React.ReactNode
 }
 declare global {