| | |
| | | <div class="playInput hl_input rounded-[22px] input-border input-shadow"> |
| | | <!-- 应用场景 --> |
| | | <div class="application-scenarios absolute bottom-[114%] left-4"> |
| | | <div class="flex-items-center space-x-2"> |
| | | <div class="flex-items-center space-x-2" :class="isHome ? 'set-next-group-type' : ''"> |
| | | <div |
| | | class="border border-gray-400 border-solid h-8 flex-items-center px-3 py-2 rounded-2xl cursor-pointer space-x-1 hover:bg-[#cae3ff]" |
| | | :class="{ 'bg-[#c5e0ff]': activeGroupType === item, '!text-[#1c86ff]': activeGroupType === item }" |
| | |
| | | <!-- <el-button title="AI语音对话" class="cursor-pointer" link style="margin-left: unset" @click="audioChangeWord"> |
| | | <img src="/static/images/wave/HeadImg.png" class="set-img-icon box-border" /> |
| | | </el-button> --> |
| | | <el-button |
| | | title="清除" |
| | | class="cursor-pointer" |
| | | link |
| | | style="margin-left: unset" |
| | | @click="clearTextarea" |
| | | icon="ele-Close" |
| | | v-if="inputValue" |
| | | > |
| | | </el-button> |
| | | <el-button class="cursor-pointer" link > |
| | | <el-tooltip v-if="isTalking" placement="top" content="停止生成"> |
| | | <div class="size-[36px] rounded-full flex-center border-2 border-solid border-black text-black" @click="emits('stopGenClick')"> |
| | | <span class="ywifont ywicon-jieshu"></span> |
| | | </div> |
| | | </el-tooltip> |
| | | |
| | | <el-button title="发送" :disabled="isTalking" class="cursor-pointer" link @click="emits('sendClick')"> |
| | | <div class="send"> |
| | | <img src="/static/images/wave/QueryImg.png" /> |
| | | </div> |
| | | <el-tooltip v-else placement="top" content="发送"> |
| | | <div class="size-[36px] rounded-full bg-black flex-center" @click="emits('sendClick')"> |
| | | <img src="/static/images/wave/QueryImg.png" /> |
| | | </div> |
| | | </el-tooltip> |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | |
| | | import { onClickOutside } from '@vueuse/core'; |
| | | import type { InputInstance } from 'element-plus'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import _ from 'lodash'; |
| | | import { sortBy } from 'lodash-es'; |
| | | import getCaretCoordinates from 'textarea-caret'; |
| | | import { computed, nextTick, ref } from 'vue'; |
| | | import { computed, nextTick, ref, toRefs, watch } from 'vue'; |
| | | import InfoDetail from './InfoDetail.vue'; |
| | | import CommonPhrases from './phrase/CommonPhrases.vue'; |
| | | import VoicePage from './voicePage/VoicePage.vue'; |
| | | import { getMetricsNames, querySimilarityHistory } from '/@/api/ai/chat'; |
| | | import { activeGroupType, groupTypeList, groupTypeMapIcon } from '/@/stores/chatRoom'; |
| | | const emits = defineEmits(['sendClick', 'showUpChatClick', 'showDownChatClick']); |
| | | const props = defineProps(['isTalking', 'isHome']); |
| | | const emits = defineEmits(['sendClick', 'showUpChatClick', 'showDownChatClick','stopGenClick']); |
| | | const props = defineProps({ |
| | | isTalking: Boolean, |
| | | isHome: Boolean, |
| | | setCommonQuestionInfo: { |
| | | type: Object, |
| | | default: {}, |
| | | }, |
| | | }); |
| | | |
| | | const { setCommonQuestionInfo } = toRefs(props); |
| | | const voicePageIsShow = defineModel('voicePageIsShow', { |
| | | type: Boolean, |
| | | default: false, |
| | |
| | | type: String, |
| | | }); |
| | | |
| | | const tipIsShow = computed(() => !!inputValue.value.trim() && similarList.value?.length > 0 && triggerShow.value); |
| | | const tipIsShow = computed(() => !!inputValue.value?.trim() && similarList.value?.length > 0 && triggerShow.value); |
| | | const triggerShow = ref(false); |
| | | const inputRef = ref<InputInstance>(null); |
| | | |
| | |
| | | onClickOutside(tipEleRef, () => { |
| | | triggerShow.value = false; |
| | | }); |
| | | const clearTextarea = () => { |
| | | inputValue.value = ''; |
| | | }; |
| | | const inputText = (text) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | |
| | | }; |
| | | |
| | | // 按 startIndex 排序,消除彼此之间重合元素 |
| | | sentenceMatchList = _.sortBy(sentenceMatchList, (item) => item.startIndex).filter((value, index, array) => { |
| | | sentenceMatchList = sortBy(sentenceMatchList, (item) => item.startIndex).filter((value, index, array) => { |
| | | if (nextIsMerge) { |
| | | checkNextIsMerge(value, index, array); |
| | | return false; |
| | |
| | | |
| | | //#region ====================== 当前应用场景 ====================== |
| | | const currentGroupTypeIsShow = computed(() => !!activeGroupType.value); |
| | | |
| | | const groupTypeClick = (item) => { |
| | | activeGroupType.value = item; |
| | | |
| | | inputRef.value.focus(); |
| | | commonPhrasesRef.value.getCommonPhrases(); |
| | | }; |
| | | |
| | | // 关闭当前 groupType 面板 |
| | |
| | | |
| | | //#region ====================== 常用语功能 ====================== |
| | | const commonPhrasesRef = ref(null); |
| | | // 常用语功能点击 |
| | | const commonPhrasesClick = () => { |
| | | isShowPhrase.value = true; |
| | | }; |
| | | // 区域关闭常用语功能面板 |
| | | onClickOutside( |
| | | commonPhrasesRef, |
| | | () => { |
| | | isShowPhrase.value = false; |
| | | }, |
| | | { |
| | | ignore: ['.el-message-box'], |
| | | } |
| | | ); |
| | | // 常用语功能输入框更新 |
| | | const updateCommonChatInput = (val) => { |
| | | inputValue.value = val; |
| | | isShowPhrase.value = false; |
| | | }; |
| | | |
| | | watch(setCommonQuestionInfo, (val) => { |
| | | if (!props.isHome) { |
| | | let obj = { |
| | | id: val?.historyId, |
| | | question: val?.content.values, |
| | | }; |
| | | commonPhrasesRef.value.commonChatByUser(obj); |
| | | isShowPhrase.value = true; |
| | | } |
| | | }); |
| | | //#endregion |
| | | </script> |
| | | <style scoped lang="scss"> |