yuanhao
2025-06-04 35dab133f3085a6bce2f045d2d28605aa64e8e61
pages/aiQuestions/aiQuestions.vue
@@ -2,7 +2,7 @@
   <view class="content">
      <view class="head" :class="{'isOn':showSet||showHistory}">
         <view class="box">
            <image class="back-img" @click='toBack' src="/static/back.png" mode=""></image>
            <!--  <image class="back-img" @click='toBack' src="/static/back.png" mode=""></image> -->
            <image v-if='details.appImg' class="logo" :src="baseUrl+details.appImg" mode="aspectFill" alt="">
            </image>
            <image v-else class="logo" src="/static/question/logo.png" mode="aspectFill" alt=""></image>
@@ -11,18 +11,19 @@
                  {{ details.appName }}
               </view>
               <view class="f">
                  问答
                  财政AI助手
               </view>
            </view>
         </view>
         <view class="box-right">
            <image src="/static/question/mute.png" mode=""></image>
            <image style="width:40rpx;height:40rpx;" @click="showHistory=!showHistory;showSet=false"
            <!--  <image src="/static/question/mute.png" mode=""></image> -->
            <image style="width:40rpx;height:40rpx;" @click="getTalkList();showHistory=!showHistory;showSet=false; "
               src="/static/time.png" mode=""></image>
            <image @click="showSet=!showSet;showHistory=false" src="/static/question/set.png" mode=""></image>
               <!-- <image @click="" src="/static/icons/add.svg" mode=""></image> -->
            <!-- <image @click="showSet=!showSet;showHistory=false" src="/static/question/set.png" mode=""></image>-->
         </view>
      </view>
      <scroll-view class="ltbox" scroll-y="true" :scroll-into-view="intoView" v-if="msgList">
      <scroll-view class="ltbox" scroll-y="true" :scroll-into-view="intoView" v-if="msgList.length">
         <block v-if="details.appId">
            <view v-if="msgList&&msgList.length===0" class="wbox">
               <image src="/static/exam/bg02.png" mode="widthFix" class="bg2" alt=""></image>
@@ -53,14 +54,14 @@
                     <u-loading mode="circle" v-if="!item.aiLog" size="40" color="#0079FE"
                        class="u-m-r-10"></u-loading>
                     <u-collapse-item :open='true' :title="item.aiLog ? 'AI思考完成' : 'AI思考中...'">
                        <view v-html="markdown.render(item.thinkLog)"></view>
                        <view style="font-size: 26rpx;"  v-html="markdown.render(item.thinkLog)"></view>
                     </u-collapse-item>
                  </u-collapse>
                  <view v-else-if="!item.aiLog" class="u-flex" style="color: #0079FE;">
                     <u-loading mode="circle" size="40" color="#0079FE" class="u-m-r-10"></u-loading>
                     AI思考中···
                  </view>
                  <view v-html="markdown.render(item.aiLog)"></view>
                  <view style="font-size: 26rpx;"  v-html="markdown.render(item.aiLog)"></view>
                  <view class="file-list" v-if="item.docInfo.length&&item.isEnd">
                     <view class="one-file" v-for="(file,findex) in item.docInfo" :key='findex'>
                        <image :src="getImg(file.docFormat)" mode=""></image>
@@ -72,16 +73,9 @@
                        <view class="copy" @click='clickCopy(item.aiLog)'>
                           <image src="/static/question/copy.png" mode=""></image>
                        </view>
                        <view class="copy" @click="clickPlay(item)">
                           <image src="/static/question/sount1.png" v-if="item.isPlay==0"></image>
                           <u-loading v-if="item.isPlay==1" mode="flower" size="34"></u-loading>
                           <image src="/static/question/sount2.png" v-if="item.isPlay==2"></image>
                           <!-- <u-icon v-if="item.isPlay==0" name="volume" size="34"></u-icon>
                           <u-loading v-if="item.isPlay==1" mode="flower" size="34"></u-loading>
                           <u-icon v-if="item.isPlay==2" name="pause-circle" size="34"></u-icon> -->
                        </view>
                     </view>
                     <view class="function-right">
                     <!--
                        <view class="function-right">
                        <u-icon name="thumb-up-fill" @click='clickLikes(item)' v-if="item.isLike"
                           color="#2468F2" size="40"></u-icon>
                        <u-icon name="thumb-up" @click='clickLikes(item)' v-else color="#98a1b2"
@@ -90,7 +84,8 @@
                           color="#2468F2" size="40"></u-icon>
                        <u-icon name="thumb-down" @click="clickDislikes(item)" v-else color="#98a1b2"
                           size="40"></u-icon>
                     </view>
                     </view>
                     -->
                  </view>
               </view>
            </view>
@@ -102,20 +97,24 @@
         </view>
         <view id="bot"></view>
      </scroll-view>
      <view v-else class="tips">
         我是财政AI助手,很高兴见到你!我可以回答项目文档中的各种问题,输入问题快来体验吧!
      </view>
      <audio id="audio" src=""></audio>
      <view class="btmbox" :class="{'isOn':showKnow}">
         <view v-if="!voiceFlg" class="know-btn" :class="{'active-btn':showKnow}" @click="showKnow=true">
         <!--  <view v-if="!voiceFlg" class="know-btn" :class="{'active-btn':showKnow}" @click="showKnow=true">
            <view class="btn-box">
               <image v-if="showKnow" src="/static/wd/book-open.png" mode=""></image>
               <image v-else src="/static/wd/book.png" mode=""></image>
            </view>
         </view>
         </view> -->
         <view :class="['btm-btn',{'voice-btn':recording},{'voice-cancel-btn': voiceStop}]">
            <block v-if="!recording">
               <image v-if="voiceFlg" src="/static/wd/i03.png" mode="widthFix" class="btnimg2" @click="clickType"
                  alt=""></image>
               <image v-else src="/static/wd/i04.png" mode="widthFix" class="btnimg2" @click="clickType" alt="">
               </image>
               <!--  <image v-else src="/static/wd/i04.png" mode="widthFix" class="btnimg2" @click="clickType" alt="">
               </image> -->
            </block>
            <view @touchstart="touchstartVoice" @touchmove.stop.prevent="touchmoveVoice" @touchend="touchendVoice"
               @touchcancel="touchcancelVoice" class="u-flex-1 u-text-center tap-btn" v-if="voiceFlg">
@@ -199,12 +198,12 @@
      <u-popup v-model="showKnow" mode='bottom' border-radius="20">
         <view class="know-box">
            <view class="title">
               <view>选择知识库 </view>
               <view>选择项目 </view>
               <image @click='showKnow=false;'  src="/static/wd/close.png"></image>
            </view>
            <view class="sbox">
               <u-search @search="search" @custom="toSearch" height="80" bg-color="#F9FAFB" @clear="search"
                  v-model="keyword" :show-action="true" shape="round" placeholder="搜索知识库">
                  v-model="keyword" :show-action="true" shape="round" placeholder="搜索项目">
               </u-search>
            </view>
            <view class='all-know'>
@@ -383,8 +382,16 @@
         }
      },
      onLoad(options) {
         this.appId = options.id
         this.toCheck(this.appId)
         this.appId = options.id || 1
         this.userId = options.userId || 1
         // this.toCheck(this.appId)
         console.log(options)
         if(options.knowId) {
            this.knowIds = options.knowId.split(',')
         }
         this.openRecord();
         this.getDetails()
         this.getTalkList();
      },
      onReady() {
         this.con = document.getElementById('bot');
@@ -502,10 +509,11 @@
            })
         },
         getDetails() {
            getInfo(this.appId).then(val => {
               this.details = val.data
               this.knowIds = this.details.knowIds;
               getAppKnowList(this.appId).then(res => {
            // getInfo(this.appId).then(val => {
            //    this.details = val.data
            //    this.knowIds = this.details.knowIds;
            // })
            getAppKnowList(this.appId).then(res => {
                  this.knowList = res.data;
                  this.knowList.forEach(item => {
                     if (this.knowIds.some(e => e == item.knowId)) {
@@ -515,7 +523,6 @@
                     }
                  })
               })
            })
         },
         clickType() {
            if (this.isDisabled) return
@@ -540,7 +547,7 @@
               // 会话 ID
               sessionId: log.sessionId,
               // 当前用户的 ID
               userId: this.userInfo.userId
               userId: this.userId || 1
            }
            // 调用 qaFeedBack 接口提交点赞反馈
            updSessionLogFeedBack({
@@ -559,7 +566,7 @@
               isOverall: 0,
               sessionLogId: log.sessionLogId,
               sessionId: log.sessionId,
               userId: this.userInfo.userId
               userId: this.userId
            }
            updSessionLogFeedBack({
               sessionLogId: log.sessionLogId,
@@ -653,7 +660,7 @@
               let addTalkInfor = await addTalk({
                  "appId": this.appId,
                  "sessionName": this.msg,
                  "userId": this.userInfo.userId
                  "userId": this.userId
               })
               this.sessionId = addTalkInfor.data.sessionId
            }
@@ -662,7 +669,7 @@
            let item = {
               sessionLogId: '',
               sessionId: this.sessionId,
               userId: this.userInfo.userId,
               userId: this.userId,
               userLog: this.msg,
               userSound: '',
               docInfo: [],
@@ -701,7 +708,7 @@
                     "question": item.userLog,
                     "llm_name": this.chooseLlm.value,
                     "app_id": this.appId,
                     "user_id": this.userInfo.userId,
                     "user_id": this.userId,
                     "session_id": item.sessionId,
                     "session_log_id": item.sessionLogId,
                     "param_key": "know_id",
@@ -1125,6 +1132,7 @@
   }
</style>
<style lang="scss" scoped>
   // 设置弹窗
   .set-box {
      padding: 0 34rpx;
@@ -1158,7 +1166,7 @@
               }
               text {
                  font-size: 32rpx;
                  font-size: 26rpx;
                  color: #000000;
                  font-weight: 400;
               }
@@ -1175,7 +1183,7 @@
               }
               text {
                  font-size: 32rpx;
                  font-size: 26rpx;
                  color: #000000;
                  font-weight: 400;
               }
@@ -1198,7 +1206,7 @@
         display: flex;
         align-items: center;
         justify-content: space-between;
         font-size: 34rpx;
         font-size: 30rpx;
         color: #000000;
         font-weight: 700;
         line-height: 50rpx;
@@ -1240,7 +1248,7 @@
               .details {
                  .know-name {
                     font-size: 32rpx;
                     font-size: 28rpx;
                     color: #000000;
                     line-height: 50rpx;
                     font-weight: 500;
@@ -1255,6 +1263,7 @@
                     display: inline-block;
                     line-height: 42rpx;
                     border-radius: 8rpx;
                     font-size: 28rpx;
                  }
               }
            }
@@ -1440,7 +1449,7 @@
      border-radius: 10rpx;
      background: #0AAFB0;
      padding: 10rpx 18rpx;
      font-size: 30rpx;
      font-size: 28rpx;
      color: white;
      text-align: center;
   }
@@ -1450,7 +1459,7 @@
      flex-direction: row;
      justify-content: flex-end;
      width: 100%;
      font-size: 26rpx;
      .div {
         background: linear-gradient(273deg, #2F7AFA 0.22%, #226FF4 99.8%);
         color: #fff;
@@ -1459,6 +1468,7 @@
         max-width: 100%;
         padding: 12px 16px;
         white-space: pre-wrap;
         font-size: 26rpx;
      }
   }
@@ -1494,14 +1504,20 @@
      box-sizing: border-box;
      padding: 20rpx 20rpx 0;
   }
   .tips{
      padding: 48rpx;
      background: #fff;
      border-radius: 24rpx;
      margin: 40rpx;
      font-size: 26rpx;
   }
   .msgbox1 {
      margin-bottom: 20rpx;
      .function-box {
         display: flex;
         align-items: center;
         justify-content: space-between;
         justify-content: flex-end;
         margin-top: 24rpx;
         .function-left {
@@ -1708,7 +1724,7 @@
         position: relative;
         z-index: 2;
         padding-top: 70rpx;
         font-size: 32rpx;
         font-size: 28rpx;
         text-indent: 4em;
      }
@@ -1735,7 +1751,7 @@
            .top {
               color: #000000;
               font-size: 32rpx;
               font-size: 28rpx;
               font-weight: bold;
               span {