| | |
| | | <script setup lang="ts"> |
| | | import type { InputInstance } from 'element-plus'; |
| | | import getCaretCoordinates from 'textarea-caret'; |
| | | import { nextTick, ref } from 'vue'; |
| | | import { computed, nextTick, ref } from 'vue'; |
| | | import InputTip from './inputTip/index.vue'; |
| | | import CommonPhrases from './phrase/CommonPhrases.vue'; |
| | | import SceneSwitch from './SceneSwitch.vue'; |
| | | import VoicePage from './voicePage/VoicePage.vue'; |
| | | import { useCompRef } from '/@/utils/types'; |
| | | const emits = defineEmits(['sendClick', 'showUpChatClick', 'showDownChatClick', 'stopGenClick']); |
| | | import { usePickHistory } from './hook/usePickHistory'; |
| | | const emits = defineEmits(['sendClick', 'stopGenClick']); |
| | | const props = defineProps({ |
| | | isTalking: Boolean, |
| | | isHome: Boolean, |
| | | |
| | | msgList: Array, |
| | | }); |
| | | |
| | | const voicePageIsShow = defineModel('voicePageIsShow', { |
| | |
| | | const updateInputValue = (val) => { |
| | | inputValue.value = val; |
| | | }; |
| | | |
| | | const { setUpQuestion, setDownQuestion } = usePickHistory({ |
| | | msgList: computed(() => props.msgList), |
| | | inputValue: inputValue, |
| | | }); |
| | | const keydownInput = (e) => { |
| | | if (props.isTalking) return; |
| | | const isEnterInput = !e.shiftKey && e.key == 'Enter'; |
| | |
| | | const num = Number(e.code.replace('Digit', '')); |
| | | inputTipRef.value.applyIndexItem(num - 1); |
| | | } else if (arrowUp) { |
| | | emits('showUpChatClick'); |
| | | setUpQuestion(); |
| | | } else if (arrowDown) { |
| | | emits('showDownChatClick'); |
| | | setDownQuestion(); |
| | | } |
| | | } |
| | | }; |