Commit 11d2fe5f authored by nick zheng's avatar nick zheng

fix: 输入框提问内容超出换行

parent 36405c96
...@@ -66,6 +66,7 @@ watchEffect(() => { ...@@ -66,6 +66,7 @@ watchEffect(() => {
.article-container { .article-container {
// letter-spacing: 0.1ch; // letter-spacing: 0.1ch;
font-family: 'Microsoft YaHei UI'; font-family: 'Microsoft YaHei UI';
word-break: break-all;
background-color: unset; background-color: unset;
} }
</style> </style>
...@@ -79,6 +79,13 @@ function messageItemFactory() { ...@@ -79,6 +79,13 @@ function messageItemFactory() {
} as MessageItemInterface } as MessageItemInterface
} }
function handleInputMessageEnter(event: KeyboardEvent) {
if (event.key === 'Enter') {
event.preventDefault()
handleQuestionSubmit()
}
}
function handleQuestionSubmit() { function handleQuestionSubmit() {
if (isQuestionSubmitDisabled.value || props.isAnswerResponseWait || isInputMessageDisabled.value) return if (isQuestionSubmitDisabled.value || props.isAnswerResponseWait || isInputMessageDisabled.value) return
...@@ -294,13 +301,15 @@ function handleSelectFile(cb: () => void) { ...@@ -294,13 +301,15 @@ function handleSelectFile(cb: () => void) {
<div class="relative"> <div class="relative">
<n-input <n-input
v-model:value="questionContent" v-model:value="questionContent"
type="textarea"
:autosize="{ minRows: 1, maxRows: 5 }"
:placeholder="t('common_module.dialogue_module.question_input_placeholder')" :placeholder="t('common_module.dialogue_module.question_input_placeholder')"
:disabled="isInputMessageDisabled" :disabled="isInputMessageDisabled"
class="rounded-theme! w-[725px]! border-[#9EA3FF]! border py-[10px] pl-3 pr-[44px]" class="rounded-theme! w-[725px]! border-[#9EA3FF]! border py-[10px] pl-3 pr-[44px]"
@keydown.enter="handleQuestionSubmit" @keydown="handleInputMessageEnter"
/> />
<i <i
class="iconfont icon-send-icon absolute right-6 top-[18px] text-xl leading-none" class="iconfont icon-send-icon absolute bottom-[17px] right-6 text-xl leading-none"
:class=" :class="
isQuestionSubmitDisabled || isAnswerResponseWait || isInputMessageDisabled isQuestionSubmitDisabled || isAnswerResponseWait || isInputMessageDisabled
? 'text-hover-theme-color cursor-not-allowed' ? 'text-hover-theme-color cursor-not-allowed'
......
...@@ -125,6 +125,13 @@ function messageItemFactory(): ConversationMessageItem { ...@@ -125,6 +125,13 @@ function messageItemFactory(): ConversationMessageItem {
} }
} }
function handleInputMessageEnter(event: KeyboardEvent) {
if (event.key === 'Enter') {
event.preventDefault()
handleMessageSend()
}
}
function handleMessageSend() { function handleMessageSend() {
if (!inputMessageContent.value.trim() || isInputMessageDisabled.value) { if (!inputMessageContent.value.trim() || isInputMessageDisabled.value) {
return return
...@@ -449,10 +456,12 @@ defineExpose({ ...@@ -449,10 +456,12 @@ defineExpose({
<div class="relative flex-1"> <div class="relative flex-1">
<n-input <n-input
v-model:value="inputMessageContent" v-model:value="inputMessageContent"
type="textarea"
:autosize="{ minRows: 1, maxRows: 5 }"
:placeholder="t('common_module.dialogue_module.question_input_placeholder')" :placeholder="t('common_module.dialogue_module.question_input_placeholder')"
:disabled="isInputMessageDisabled" :disabled="isInputMessageDisabled"
class="rounded-xl! shadow-[0_1px_#09122105,0_1px_1px_#09122105,0_3px_3px_#09122103,0_9px_9px_#09122103]! py-[4px] pr-[50px]" class="rounded-xl! shadow-[0_1px_#09122105,0_1px_1px_#09122105,0_3px_3px_#09122103,0_9px_9px_#09122103]! py-[4px] pr-[50px]"
@keydown.enter="handleMessageSend" @keydown="handleInputMessageEnter"
/> />
<div <div
......
...@@ -127,6 +127,13 @@ function messageItemFactory(): ConversationMessageItem { ...@@ -127,6 +127,13 @@ function messageItemFactory(): ConversationMessageItem {
} }
} }
function handleInputMessageEnter(event: KeyboardEvent) {
if (event.key === 'Enter') {
event.preventDefault()
handleMessageSend()
}
}
function handleMessageSend() { function handleMessageSend() {
if (!isLogin.value) { if (!isLogin.value) {
window.$message.warning(t('common_module.not_login_text')) window.$message.warning(t('common_module.not_login_text'))
...@@ -434,10 +441,12 @@ defineExpose({ ...@@ -434,10 +441,12 @@ defineExpose({
<div class="relative flex-1"> <div class="relative flex-1">
<n-input <n-input
v-model:value="inputMessageContent" v-model:value="inputMessageContent"
type="textarea"
:autosize="{ minRows: 1, maxRows: 5 }"
:placeholder="inputPlaceholder" :placeholder="inputPlaceholder"
:disabled="!isLogin || isInputMessageDisabled" :disabled="!isLogin || isInputMessageDisabled"
class="rounded-xl! shadow-[0_1px_#09122105,0_1px_1px_#09122105,0_3px_3px_#09122103,0_9px_9px_#09122103]! py-[4px] pr-[50px]" class="rounded-xl! shadow-[0_1px_#09122105,0_1px_1px_#09122105,0_3px_3px_#09122103,0_9px_9px_#09122103]! py-[4px] pr-[50px]"
@keydown.enter="handleMessageSend" @keydown="handleInputMessageEnter"
/> />
<div <div
class="bg-px-send-png absolute bottom-2 right-[20px] h-[24px] w-[24px]" class="bg-px-send-png absolute bottom-2 right-[20px] h-[24px] w-[24px]"
......
...@@ -54,6 +54,14 @@ const isShowWebVoiceLoading = computed(() => { ...@@ -54,6 +54,14 @@ const isShowWebVoiceLoading = computed(() => {
return props.role === 'assistant' && !isMobile.value && props.messageItem.isVoiceLoading && timbreEnabled.value return props.role === 'assistant' && !isMobile.value && props.messageItem.isVoiceLoading && timbreEnabled.value
}) })
const isShowMobileLoading = computed(() => {
return (
props.role === 'assistant' &&
(props.messageItem.isAnswerResponseLoading ||
(isMobile.value && props.messageItem.isVoiceLoading && timbreEnabled.value))
)
})
function handleAudioControl() { function handleAudioControl() {
if (!isPlayableAudio.value) { if (!isPlayableAudio.value) {
return return
...@@ -109,12 +117,7 @@ function handleAudioControl() { ...@@ -109,12 +117,7 @@ function handleAudioControl() {
/> />
</p> </p>
<div <div v-show="isShowMobileLoading" class="mb-[5px] mt-4 px-4">
v-show="
role === 'assistant' && (messageItem.isAnswerResponseLoading || (isMobile && messageItem.isVoiceLoading))
"
class="mb-[5px] mt-4 px-4"
>
<CustomLoading /> <CustomLoading />
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment