jwyu 11 månader sedan
förälder
incheckning
fc2fc829f2

BIN
src/assets/img/icons/ai_Company.png


BIN
src/assets/img/icons/ai_avatar.png


BIN
src/assets/img/icons/gpt-4-turbo.png


+ 38 - 11
src/views/operation_manage/AIQA/AIQA.vue

@@ -3,8 +3,10 @@
         <div class="window-list-wrap">
             <div class="window-title">
                 <div class="title-wrap">
+                    <p class="text-ellipsis" style="color: #333333;font-size: 20px;font-weight: 600;">{{companyName}}</p>
                     <span style="color: #666666;font-size: 16px;">研究AI问答小助手</span>
                 </div>
+                <div class="icon"><img src="~@/assets/img/icons/ai_company.png"/></div>
             </div>
             <div class="add-btn" @click="handleAddNewWindow"><i class="el-icon-circle-plus-outline"></i>新建对话窗口</div>
             <div class="list-wrap hidden-scrollbar">
@@ -72,6 +74,7 @@ import NewWindowHint from './components/newWindowHint.vue';
 import WindowListItem from './components/windowListItem';
 /* api */
 import {aiQAInterence} from '@/api/modules/aiApi.js'; 
+import {etaBaseConfigInterence} from '@/api/modules/etaBaseConfigApi.js';
 export default {
     components: { WindowListItem,NewWindowHint, MessageItem },
     data() {
@@ -111,6 +114,8 @@ export default {
             showHint:false,//选择模型提示
             isTyping:false,//是否处于打字动画中
             windowContentLoading:null,
+            answerLoading:false,//回答中
+            companyName:'',
         };
     },
     watch:{
@@ -159,7 +164,7 @@ export default {
                 this.historyList = List||[]
                 this.windowContentLoading&&this.windowContentLoading.close()
                 //使用模型
-                this.model = this.historyList.length?this.historyList[this.historyList.length-1].Model:''
+                this.model = this.historyList.length?this.historyList[this.historyList.length-1].Model:'GPT-4 Turbo'
                 //如果有历史记录,则滚动到底部
                 this.$nextTick(()=>{
                     const windowContentWrap = document.querySelector('.window-content-wrap')
@@ -205,7 +210,7 @@ export default {
             this.activeWindowId=0
             this.activeWindow=null
             this.historyList=[]
-            this.model=''
+            this.model='GPT-4 Turbo'
             //this.inputText=''
             this.isTyping = false
         },
@@ -291,23 +296,24 @@ export default {
                 this.inputText+='\n'
                 return
             }
-            if(this.isTyping){
+            if(this.isTyping||this.answerLoading){
                 this.$message.warning('请等待回答完成')
                 return
             }
             //新建窗口,未选择模型
-            if(this.activeWindowId===0&&this.model===''){
-                this.showHint = true
-                this.$message.error('请选择模型')
-                this.$nextTick(()=>{
-                    this.$refs.modelSelect.focus()
-                })
-                return
-            }
+            // if(this.activeWindowId===0&&this.model===''){
+            //     this.showHint = true
+            //     this.$message.error('请选择模型')
+            //     this.$nextTick(()=>{
+            //         this.$refs.modelSelect.focus()
+            //     })
+            //     return
+            // }
             if(this.inputText.length===0){
                 this.$message.warning('请输入提问')
                 return
             }
+            this.answerLoading=true
             this.activeWindowId===0&&(this.activeWindowId = -1)
             //this.activeWindowId!==0&&this.getWindowDetail()
             //mock 加入到historyList中
@@ -337,6 +343,7 @@ export default {
                 Ask:inputText,
                 // Model:this.model
             }).then(res=>{
+                this.answerLoading=false
                 //在回答未获取前切换了新窗口
                 if(this.historyList.length===0){
                     this.getWindowList()
@@ -371,6 +378,8 @@ export default {
                 msg.Model = Model
                 msg.isPlay = true
                 this.historyList.splice(this.historyList.length-1,1,msg)
+            }).catch(()=>{
+                this.answerLoading=false
             })
         },
         //获取窗口列表
@@ -384,10 +393,19 @@ export default {
                 this.windowList = res.Data.List||[]
                 this.listWrapLoading&&this.listWrapLoading.close()
             })
+        },
+
+        getBaseConfig(){
+            etaBaseConfigInterence.getBaseConfig().then(res=>{
+                if(res.Ret===200){
+                    this.companyName=res.Data.CompanyName||''
+                }
+            })
         }
     },
     mounted(){
         this.getWindowList()
+        this.getBaseConfig()
     }
 };
 </script>
@@ -428,10 +446,19 @@ $border-color:#3D52A1;
             display: flex;
             justify-content: space-between;
             align-items: center;
+            // overflow: hidden;
             .icon img{
                 width:58px;
                 height:58px;
             }
+            .title-wrap{
+                overflow: hidden;
+            }
+            .text-ellipsis{
+                overflow: hidden;
+                white-space: nowrap;
+                text-overflow: ellipsis;
+            }
         }
         .add-btn{
             border:2px dashed $border-color;

+ 2 - 2
src/views/operation_manage/AIQA/components/messageItem.vue

@@ -28,7 +28,7 @@ export default {
     data() {
         return {
             iconMap:{
-                'user':require('@/assets/img/set_m/user_img.png'),
+                'user':require('@/assets/img/icons/ai_avatar.png'),
                 'gpt-3.5-turbo':require('@/assets/img/icons/chat-gpt.png'),
                 'gpt-3.5-turbo-16k':require('@/assets/img/icons/chat-gpt-16k.png'),
                 'eta':require('@/assets/img/icons/horizon.png'),
@@ -53,7 +53,7 @@ export default {
     computed:{
         IconSrc(){
             const {messageType,modelName} = this.messageInfo
-            const iconType = messageType==='question'?'user':modelName
+            const iconType = messageType==='question'?'user':'GPT-4 Turbo'
             return this.iconMap[iconType]||''
         }
     },