|
@@ -3,10 +3,10 @@
|
|
|
<div class="window-list-wrap">
|
|
|
<div class="window-title">
|
|
|
<div class="title-wrap">
|
|
|
- <p style="color: #333333;font-size: 20px;font-weight: 600;">HORIZON INSIGHTS</p>
|
|
|
- <span style="color: #666666;font-size: 16px;">弘则研究AI问答小助手</span>
|
|
|
+ <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/horizon.png" /></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">
|
|
@@ -28,10 +28,10 @@
|
|
|
<div class="content-header">
|
|
|
<div class="title-wrap">
|
|
|
<p>{{activeWindowId<=0?'新对话窗口':activeWindow.TopicName||''}}</p>
|
|
|
- <span>{{activeWindowId<=0?'弘则AI助手使用说明':`${historyList.length||0} messages`}}</span>
|
|
|
+ <span>{{activeWindowId<=0?'AI助手使用说明':`${historyList.length||0} messages`}}</span>
|
|
|
</div>
|
|
|
<div class="select-box">
|
|
|
- <el-select v-model="model" :class="{'hint':showHint}" :disabled="isTyping||(windowContentLoading&&windowContentLoading.visible)" ref="modelSelect"
|
|
|
+ <!-- <el-select v-model="model" :class="{'hint':showHint}" :disabled="isTyping||(windowContentLoading&&windowContentLoading.visible)" ref="modelSelect"
|
|
|
@click.native="selectClick"
|
|
|
@change="changeModel">
|
|
|
<el-option v-for="item in modelList" :key="item.label"
|
|
@@ -40,7 +40,7 @@
|
|
|
<span style="float:left">{{item.label}}</span>
|
|
|
<span style="float:right"><img :src="item.icon" style="margin-top:5px;width:24px;height:24px;"/></span>
|
|
|
</el-option>
|
|
|
- </el-select>
|
|
|
+ </el-select> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 仅这一部分滚动 -->
|
|
@@ -74,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() {
|
|
@@ -86,17 +87,25 @@ export default {
|
|
|
/* window-content*/
|
|
|
historyList:[],//当前窗口历史记录
|
|
|
inputText:'',
|
|
|
- model:'',//当前选择的模型
|
|
|
+ model:'GPT-4 Turbo',//当前选择的模型
|
|
|
modelOldValue:'',
|
|
|
modelList:[
|
|
|
{
|
|
|
- label:'gpt-3.5-turbo',
|
|
|
- icon:require('@/assets/img/icons/chat-gpt.png'),
|
|
|
+ label:'GPT-4 Turbo',
|
|
|
+ icon:require('@/assets/img/icons/gpt-4-turbo.png'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'GPT4',
|
|
|
+ icon:require('@/assets/img/icons/gpt-4.png'),
|
|
|
},
|
|
|
{
|
|
|
label:'gpt-3.5-turbo-16k',
|
|
|
icon:require('@/assets/img/icons/chat-gpt-16k.png'),
|
|
|
},
|
|
|
+ {
|
|
|
+ label:'gpt-3.5-turbo',
|
|
|
+ icon:require('@/assets/img/icons/chat-gpt.png'),
|
|
|
+ },
|
|
|
{
|
|
|
label:'eta',
|
|
|
icon:require('@/assets/img/icons/horizon.png'),
|
|
@@ -105,6 +114,8 @@ export default {
|
|
|
showHint:false,//选择模型提示
|
|
|
isTyping:false,//是否处于打字动画中
|
|
|
windowContentLoading:null,
|
|
|
+ answerLoading:false,//回答中
|
|
|
+ companyName:'',
|
|
|
};
|
|
|
},
|
|
|
watch:{
|
|
@@ -153,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')
|
|
@@ -199,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
|
|
|
},
|
|
@@ -285,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中
|
|
@@ -329,8 +341,9 @@ export default {
|
|
|
aiQAInterence.sendChatMsg({
|
|
|
AiChatTopicId:this.activeWindowId<=0?0:this.activeWindowId,
|
|
|
Ask:inputText,
|
|
|
- Model:this.model
|
|
|
+ // Model:this.model
|
|
|
}).then(res=>{
|
|
|
+ this.answerLoading=false
|
|
|
//在回答未获取前切换了新窗口
|
|
|
if(this.historyList.length===0){
|
|
|
this.getWindowList()
|
|
@@ -365,6 +378,8 @@ export default {
|
|
|
msg.Model = Model
|
|
|
msg.isPlay = true
|
|
|
this.historyList.splice(this.historyList.length-1,1,msg)
|
|
|
+ }).catch(()=>{
|
|
|
+ this.answerLoading=false
|
|
|
})
|
|
|
},
|
|
|
//获取窗口列表
|
|
@@ -378,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>
|
|
@@ -422,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;
|