Эх сурвалжийг харах

【增加】对话 modal 拉取

cherishsince 1 жил өмнө
parent
commit
27569a746e
1 өөрчлөгдсөн 27 нэмэгдсэн , 10 устгасан
  1. 27 10
      src/views/ai/chat/index.vue

+ 27 - 10
src/views/ai/chat/index.vue

@@ -67,9 +67,19 @@
           标题......
         </div>
         <div>
-          <el-button>3.5-turbo-0125
-            <Icon icon="ep:setting"/>
-          </el-button>
+<!--          <el-button>3.5-turbo-0125-->
+<!--            <Icon icon="ep:setting"/>-->
+<!--          </el-button>-->
+          <el-dropdown style="margin-right: 12px;" @command="modalClick" >
+            <el-button type="primary">
+              GPT3.5 <Icon icon="ep:setting" style="margin-left: 10px;"/>
+            </el-button>
+            <template #dropdown>
+              <el-dropdown-menu v-for="(item, index) in modalList" :key="index" >
+                <el-dropdown-item :command="item.model" >{{item.model}}</el-dropdown-item>
+              </el-dropdown-menu>
+            </template>
+          </el-dropdown>
           <el-button>
             <Icon icon="ep:user"/>
           </el-button>
@@ -166,6 +176,7 @@
 
 <script setup lang="ts">
 import {ChatMessageApi, ChatMessageSendVO, ChatMessageVO} from "@/api/ai/chat/message"
+import {ChatModelApi, ChatModelVO } from "@/api/ai/model/chatModel"
 import {formatDate} from "@/utils/formatTime"
 import {useClipboard} from "@vueuse/core";
 // 转换 markdown
@@ -219,6 +230,8 @@ const isScrolling = ref(false)//用于判断用户是否在滚动
 /** chat message 列表 */
 // defineOptions({ name: 'chatMessageList' })
 const list = ref<ChatMessageVO[]>([]) // 列表的数据
+const modalList = ref<ChatModelVO[]>([]) // 列表的数据
+
 
 const changeConversation = (conversation) => {
   console.log(conversation)
@@ -392,8 +405,19 @@ const stopStream = async () => {
   conversationInProgress.value = false
 }
 
+const modalClick = async (command) => {
+  console.log('22', command)
+}
+
+const getModalList = async () => {
+  // 获取模型  as unknown as ChatModelVO
+  modalList.value = await ChatModelApi.getChatModelSimpleList(0) as unknown as ChatModelVO[]
+}
+
 /** 初始化 **/
 onMounted(async () => {
+  // 获取模型
+  getModalList();
   // 获取列表数据
   messageList();
   // scrollToBottom();
@@ -411,13 +435,6 @@ onMounted(async () => {
       })
     }
   })
-  // marked.use({
-  //   async: false,
-  //   pedantic: false,
-  //   gfm: true,
-  //   tokenizer: new Tokenizer(),
-  //   renderer: renderer,
-  // });
 })