<template>
|
<div class="playInput hl_input rounded-[22px] input-border input-shadow">
|
<!-- 主场景 -->
|
<SceneSwitch :isHome="isHome" @change="groupTypeChange" />
|
|
<div class="assembly flex">
|
<el-button
|
title="输入常用语标题,可快捷调用常用语"
|
class="label flex items-center cursor-pointer"
|
link
|
@click="commonPhrasesClick"
|
>
|
<img src="/static/images/wave/PlugIn.png" width="34" height="34" class="set-icon box-border" />
|
</el-button>
|
</div>
|
|
<div class="set-input">
|
<!-- @input="inputText" -->
|
<el-input
|
ref="inputRef"
|
class="question-input relative align-bottom set-inputAnswer"
|
type="textarea"
|
resize="none"
|
maxlength="1024"
|
:autosize="{ minRows: 1, maxRows: 8 }"
|
v-elInputFocus
|
show-word-limit
|
@keydown="keydownInput"
|
@input="inputText"
|
v-model="inputValue"
|
placeholder="在这里输入您的问题开始和AI对话"
|
clearable
|
>
|
</el-input>
|
<InputTip ref="inputTipRef" :inputValue="inputValue" @updateInputValue="updateInputValue" :isHome="isHome" />
|
</div>
|
<div class="h100 flex items-center">
|
<div class="upload_img space-y">
|
<div class="imgbox cursor-pointer flex items-center">
|
<el-button
|
title="清除"
|
class="cursor-pointer !text-gray-500"
|
link
|
style="margin-left: unset; margin-right: 0px"
|
@click="clearTextarea"
|
icon="ele-Close"
|
v-if="inputValue"
|
>
|
</el-button>
|
<el-tooltip placement="top" content="停止生成" v-if="isTalking">
|
<div class="cursor-pointer !ml-0 size-[38px] bg-[#1d86ff] relative !z-10 rounded-full flex-center" link>
|
<div
|
class="size-[38px] bg-black text-white stop-breathe box-content rounded-full flex-center"
|
@click="emits('stopGenClick')"
|
>
|
<span class="ywifont ywicon-jieshu"></span>
|
</div>
|
</div>
|
</el-tooltip>
|
<el-tooltip v-else placement="top" content="发送">
|
<div class="size-[38px] rounded-full bg-black flex-center" @click="emits('sendClick')">
|
<img src="/static/images/wave/QueryImg.png" />
|
</div>
|
</el-tooltip>
|
</div>
|
</div>
|
</div>
|
<VoicePage
|
v-model:isShow="voicePageIsShow"
|
v-show="voicePageIsShow"
|
@submit="(cb) => emits('sendClick', cb)"
|
@updateInputValue="updateInputValue"
|
:isHome="isHome"
|
/>
|
<CommonPhrases
|
v-model:isShow="isShowPhrase"
|
v-show="isShowPhrase"
|
:isHome="isHome"
|
ref="commonPhraseRef"
|
@updateInput="updateInputValue"
|
/>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import type { InputInstance } from 'element-plus';
|
import { 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';
|
import { useInputEvent } from './hook/useInputEvent';
|
const emits = defineEmits(['sendClick', 'stopGenClick']);
|
const props = defineProps({
|
isTalking: Boolean,
|
isHome: Boolean,
|
msgList: Array,
|
});
|
|
const voicePageIsShow = defineModel('voicePageIsShow', {
|
type: Boolean,
|
default: false,
|
});
|
|
const isShowPhrase = ref(false);
|
const inputValue = defineModel({
|
type: String,
|
});
|
const inputRef = ref<InputInstance>(null);
|
|
const updateInputValue = (val) => {
|
inputValue.value = val;
|
};
|
|
const { keydownInput, inputText, inputTipRef } = useInputEvent({
|
props: props,
|
emit: emits,
|
inputValue: inputValue,
|
inputRef: inputRef,
|
});
|
|
const clearTextarea = () => {
|
inputValue.value = '';
|
};
|
|
const groupTypeChange = () => {
|
inputRef.value.focus();
|
commonPhraseRef.value.updatePhrase();
|
};
|
|
//#region ====================== 常用语功能 ======================
|
const commonPhraseRef = useCompRef(CommonPhrases);
|
// 常用语功能点击
|
const commonPhrasesClick = () => {
|
isShowPhrase.value = true;
|
};
|
|
const addPhrase = (val) => {
|
commonPhraseRef.value.addPhrase(val);
|
};
|
|
defineExpose({ addPhrase });
|
//#endregion
|
</script>
|
<style scoped lang="scss">
|
@use './index.scss';
|
</style>
|