浏览代码

Merge branch 'xqc_186_AI'

jwyu 6 月之前
父节点
当前提交
f9594b5eaa
共有 2 个文件被更改,包括 44 次插入26 次删除
  1. 6 2
      src/lang/modules/ToolBox/AIQuestion.js
  2. 38 24
      src/views/operation_manage/AIQA/AIQA.vue

+ 6 - 2
src/lang/modules/ToolBox/AIQuestion.js

@@ -12,7 +12,9 @@ export const AIQuestionEn = {
     send_btn:'Send',
     use_intro_title:'Instructions',
     use_intro01:'Maximum 500 Q&A per account per day.',
-    use_intro02:'History Q&A default named with the first question in the dialogue window, can be modified.'
+    use_intro02:'History Q&A default named with the first question in the dialogue window, can be modified.',
+    operation_tips:'Operation Tip',
+    operation_des:'Switching models will create a new dialogue window without context continuity. Confirm switch?',
 
 };
   
@@ -26,7 +28,9 @@ export const AIQuestionZh = {
     send_btn:'发送',
     use_intro_title:'使用说明',
     use_intro01:'每账号每天最高500次问答。',
-    use_intro02:'历史问答默认用该对话窗口内第一个提问命名,可修改。'
+    use_intro02:'历史问答默认用该对话窗口内第一个提问命名,可修改。',
+    operation_tips:'操作提示',
+    operation_des:'切换后的模型无法联系上下文进行回答,会新建对话窗口,确认切换吗?',
 };
   
 /**

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

@@ -31,16 +31,16 @@
                     <span>{{activeWindowId<=0?$t('ToolBox.AIQuestion.AI_use_intro'):`${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"
                             :label="item.label"
-                            :value="item.label">
+                            :value="item.key">
                             <span style="float:left">{{item.label}}</span>
-                            <span style="float:right"><img :src="item.icon" style="margin-top:5px;width:24px;height:24px;"/></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>
             <!-- 仅这一部分滚动 -->
@@ -100,29 +100,35 @@ export default {
             /* window-content*/
             historyList:[],//当前窗口历史记录
             inputText:'',
-            model:'GPT-4 Turbo',//当前选择的模型
+            model:'Kimi',//当前选择的模型
             modelOldValue:'',
             modelList:[
                 {
-                    label:'GPT-4 Turbo',
+                    label:'GPT',
+                    key:'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'),
+                    label:'Kimi',
+                    key:'Kimi',
+                    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'),
+                // },
             ],//模型列表
             showHint:false,//选择模型提示
             isTyping:false,//是否处于打字动画中
@@ -184,7 +190,7 @@ export default {
 
                 this.windowContentLoading&&this.windowContentLoading.close()
                 //使用模型
-                this.model = this.historyList.length?this.historyList[this.historyList.length-1].Model:'GPT-4 Turbo'
+                this.model = this.historyList.length?this.historyList[this.historyList.length-1].Model:'Kimi'
                 //如果有历史记录,则滚动到底部
                 this.windowContentToBottom()
             })
@@ -236,7 +242,7 @@ export default {
             this.activeWindowId=0
             this.activeWindow=null
             this.historyList=[]
-            this.model='GPT-4 Turbo'
+            this.model='Kimi'
             this.aiFileIds=[]
             //this.inputText=''
             this.isTyping = false
@@ -294,9 +300,16 @@ export default {
             //非新建窗口时,模型之间切换需弹窗提示
             if(this.activeWindowId!==0&&value!==''){
                 //弹窗提示:切换模型
-                this.$confirm("切换回答模型,则切换后的模型无法联系上下文进行回答,确认切换吗?", "提示", {
+                this.$confirm(this.$t('ToolBox.AIQuestion.operation_des'), this.$t('ToolBox.AIQuestion.operation_tips'), {
                     type: "warning"
                 }).then(()=>{
+                    //将相关值置空
+                    this.activeWindowId=0
+                    this.activeWindow=null
+                    this.historyList=[]
+                    this.aiFileIds=[]
+                    //this.inputText=''
+                    this.isTyping = false
                     this.$message.success('切换模型成功')
                 }).catch(()=>{
                     //this.$message.success('已取消切换模型')
@@ -364,7 +377,7 @@ export default {
             let params={
                 AiChatTopicId:this.activeWindowId<=0?0:this.activeWindowId,
                 Ask:inputText,
-                // Model:this.model
+                Model:this.model
             }
             if(this.aiFileIds && this.aiFileIds.length>0){
                 // 文件检索功能
@@ -496,6 +509,7 @@ export default {
             let formData = new FormData()
             formData.append('File',file)
             formData.append('AiChatTopicId',this.activeWindowId)
+            formData.append('Model',this.model)
             this.windowSet.add(this.activeWindowId)
             aiQAInterence.fileUpload(formData).then(res=>{
                 downloadHint.close()