yuanhao
2025-06-04 a9d82ee818e96249634927847060177aa7dafe6a
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>
@@ -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,6 +97,10 @@
         </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">
@@ -114,8 +113,8 @@
            <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,12 @@
         }
      },
      onLoad(options) {
         this.appId = options.id
         this.toCheck(this.appId)
         this.appId = options.id || 1
         this.userId = options.userId || 1
         // this.toCheck(this.appId)
         this.openRecord();
         this.getDetails()
         this.getTalkList();
      },
      onReady() {
         this.con = document.getElementById('bot');
@@ -502,10 +505,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 +519,6 @@
                     }
                  })
               })
            })
         },
         clickType() {
            if (this.isDisabled) return
@@ -540,7 +543,7 @@
               // 会话 ID
               sessionId: log.sessionId,
               // 当前用户的 ID
               userId: this.userInfo.userId
               userId: this.userId || 1
            }
            // 调用 qaFeedBack 接口提交点赞反馈
            updSessionLogFeedBack({
@@ -559,7 +562,7 @@
               isOverall: 0,
               sessionLogId: log.sessionLogId,
               sessionId: log.sessionId,
               userId: this.userInfo.userId
               userId: this.userId
            }
            updSessionLogFeedBack({
               sessionLogId: log.sessionLogId,
@@ -653,7 +656,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 +665,7 @@
            let item = {
               sessionLogId: '',
               sessionId: this.sessionId,
               userId: this.userInfo.userId,
               userId: this.userId,
               userLog: this.msg,
               userSound: '',
               docInfo: [],
@@ -701,7 +704,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",
@@ -1494,14 +1497,19 @@
      box-sizing: border-box;
      padding: 20rpx 20rpx 0;
   }
   .tips{
      padding: 48rpx;
      background: #fff;
      border-radius: 24rpx;
      margin: 40rpx;
   }
   .msgbox1 {
      margin-bottom: 20rpx;
      .function-box {
         display: flex;
         align-items: center;
         justify-content: space-between;
         justify-content: flex-end;
         margin-top: 24rpx;
         .function-left {