wujingjing
2024-07-18 185e11aaef26fe6691e9b3cfa4d300093332e96c
src/views/project/ch/home/component/waterRight/top.vue
@@ -4,71 +4,62 @@
      <p class="set-waterTitle"><strong>WI 水务智能专家</strong>智慧水务助手</p>
   </div>
   <div class="flex items-center pc-roleList">
      <div v-for="(item, index) in llmList" :key="item.logicId" class="flex items-center pl-6" @click="handleClick(item)">
      <!-- <div v-for="(item, index) in llmList" :key="item.logicId" class="flex items-center pl-6" @click="handleClick(item)">
         <div class="modelItem cursor-pointer flex items-center" :class="{ modelItemActive: item.logicId === activeLLMId }">
            <img :src="item.icon" alt="icon" class="set-icon box-border" />
            <span>{{ item.logicTitle }}</span>
         </div>
         <!-- <el-tooltip :content="item.Content" placement="top" effect="light" popper-class="my-pop">
            <div class="modelItem cursor-pointer flex items-center " :class="{ modelItemActive: item.ID === state.activeRole }">
               <img :src="item.Icon" alt="icon" class="set-icon box-border" />
               <span>{{ item.Title }}</span>
            </div>
         </el-tooltip> -->
      </div>
      <div class="flex items-center cursor-pointer pl-5">
         <div class="modelItem cursor-pointer flex items-center">
            <img src="/static/images/wave/More.png" alt="icon" class="set-icon-more box-border" />
            <span>更多</span>
         </div>
      </div>
      </div> -->
   </div>
   <PlayBar v-model="inputValue" @send-click="sendClick" />
</template>
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue';
import { GetLLMList, SetLLM } from '/@/api/ai/chat';
import { ElMessage } from 'element-plus';
import { onMounted, ref } from 'vue';
import { GetLLMList, setHistoryGroupTitle } from '/@/api/ai/chat';
import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue';
import router from '/@/router';
import { activeChatRoom } from '/@/stores/chatRoom';
import { activeChatRoom, activeLLMId, activeSectionAId } from '/@/stores/chatRoom';
import emitter from '/@/utils/mitt';
import { handleNormalAuth } from '/@/utils/request';
const emits = defineEmits(['sendClick']);
const inputValue = ref('');
const inputValue = ref('你是谁?');
const sendClick = () => {
const sendClick = async () => {
   if (!inputValue.value) return;
   if (!activeSectionAId.value) {
      ElMessage.warning('请选择应用场景');
      return;
   }
   if (!handleNormalAuth()) {
      return;
   }
   const res = await setHistoryGroupTitle({
      history_group_id: activeChatRoom.value.id,
      title: inputValue.value,
   });
   if (!res.json_ok) {
      return ElMessage.error('修改聊天室名称失败');
   }
   activeChatRoom.value.title = inputValue.value;
   activeChatRoom.value.isInitial = false;
   router.push({
      name: 'AskAnswer',
      query: {
         id: activeChatRoom.value.id,
      },
   });
};
let state = reactive({
   roleList: [
      {
         ID: 1,
         Icon: '/static/images/wave/Glm.jpg',
         Title: '水务GLM',
         Content: '使用最为广泛的知名AI模型,响应速度快,智能化程度高,擅长多领域问题解决,包括创作、翻译、多语种百科知识、数学问题等。',
      },
      {
         ID: 2,
         Icon: '/static/images/wave/Glm.jpg',
         Title: '水务-3.5',
         Content:
            '目前业界最强大的模型,在需要高级推理、深度指令理解和更具创造力的任务中,表现比其他模型更强,例如复杂的文本和逻辑分析、复杂的数学问题等。',
      },
      {
         ID: 3,
         Icon: '/static/images/wave/Glm.jpg',
         Title: '水务-4.0',
         Content:
            '目前业界最强大的模型,在需要高级推理、深度指令理解和更具创造力的任务中,表现比其他模型更强,例如复杂的文本和逻辑分析、复杂的数学问题等。',
      },
   ],
   activeRole: 0,
});
const activeLLMId = ref();
const llmList = ref([]);
const iconList = ['/static/images/wave/Glm.jpg', '/static/images/wave/Glm.jpg', '/static/images/wave/Glm.jpg'];
const getLLMList = async () => {
@@ -92,7 +83,6 @@
};
const setLLm = async (llmId: string) => {
   // const res = await SetLLM({
   //    llm: llmId,
   // });
@@ -105,7 +95,10 @@
};
onMounted(() => {
   getLLMList();
   // getLLMList();
   emitter.on('updateChatInput', (value) => {
      inputValue.value = value;
   });
});
</script>
<style scoped lang="scss">