Commit 84b868d3 authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

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

See merge request !113
parents 36405c96 11d2fe5f
......@@ -66,6 +66,7 @@ watchEffect(() => {
.article-container {
// letter-spacing: 0.1ch;
font-family: 'Microsoft YaHei UI';
word-break: break-all;
background-color: unset;
}
</style>
......@@ -79,6 +79,13 @@ function messageItemFactory() {
} as MessageItemInterface
}
function handleInputMessageEnter(event: KeyboardEvent) {
if (event.key === 'Enter') {
event.preventDefault()
handleQuestionSubmit()
}
}
function handleQuestionSubmit() {
if (isQuestionSubmitDisabled.value || props.isAnswerResponseWait || isInputMessageDisabled.value) return
......@@ -294,13 +301,15 @@ function handleSelectFile(cb: () => void) {
<div class="relative">
<n-input
v-model:value="questionContent"
type="textarea"
:autosize="{ minRows: 1, maxRows: 5 }"
:placeholder="t('common_module.dialogue_module.question_input_placeholder')"
:disabled="isInputMessageDisabled"
class="rounded-theme! w-[725px]! border-[#9EA3FF]! border py-[10px] pl-3 pr-[44px]"
@keydown.enter="handleQuestionSubmit"
@keydown="handleInputMessageEnter"
/>
<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="
isQuestionSubmitDisabled || isAnswerResponseWait || isInputMessageDisabled
? 'text-hover-theme-color cursor-not-allowed'
......
......@@ -125,6 +125,13 @@ function messageItemFactory(): ConversationMessageItem {
}
}
function handleInputMessageEnter(event: KeyboardEvent) {
if (event.key === 'Enter') {
event.preventDefault()
handleMessageSend()
}
}
function handleMessageSend() {
if (!inputMessageContent.value.trim() || isInputMessageDisabled.value) {
return
......@@ -449,10 +456,12 @@ defineExpose({
<div class="relative flex-1">
<n-input
v-model:value="inputMessageContent"
type="textarea"
:autosize="{ minRows: 1, maxRows: 5 }"
:placeholder="t('common_module.dialogue_module.question_input_placeholder')"
: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]"
@keydown.enter="handleMessageSend"
@keydown="handleInputMessageEnter"
/>
<div
......
......@@ -127,6 +127,13 @@ function messageItemFactory(): ConversationMessageItem {
}
}
function handleInputMessageEnter(event: KeyboardEvent) {
if (event.key === 'Enter') {
event.preventDefault()
handleMessageSend()
}
}
function handleMessageSend() {
if (!isLogin.value) {
window.$message.warning(t('common_module.not_login_text'))
......@@ -434,10 +441,12 @@ defineExpose({
<div class="relative flex-1">
<n-input
v-model:value="inputMessageContent"
type="textarea"
:autosize="{ minRows: 1, maxRows: 5 }"
:placeholder="inputPlaceholder"
: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]"
@keydown.enter="handleMessageSend"
@keydown="handleInputMessageEnter"
/>
<div
class="bg-px-send-png absolute bottom-2 right-[20px] h-[24px] w-[24px]"
......
......@@ -54,6 +54,14 @@ const isShowWebVoiceLoading = computed(() => {
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() {
if (!isPlayableAudio.value) {
return
......@@ -109,12 +117,7 @@ function handleAudioControl() {
/>
</p>
<div
v-show="
role === 'assistant' && (messageItem.isAnswerResponseLoading || (isMobile && messageItem.isVoiceLoading))
"
class="mb-[5px] mt-4 px-4"
>
<div v-show="isShowMobileLoading" class="mb-[5px] mt-4 px-4">
<CustomLoading />
</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