Merge branch 'dev' into hugo-shipping-notice
This commit is contained in:
commit
ca32191c77
30 files changed
+1181
-79
No files matched your search
@@ -3,7 +3,7 @@
|
||||
* 聊天输入栏:文本框、附件、语音、知识库选择与发送按钮。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import {
|
||||
Check,
|
||||
@@ -60,6 +60,7 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
const filePickerRef = ref<HTMLInputElement | null>(null);
|
||||
const textareaRef = ref<HTMLTextAreaElement | null>(null);
|
||||
const attachmentMenuRef = ref<HTMLElement | null>(null);
|
||||
const kbMenuRef = ref<HTMLElement | null>(null);
|
||||
const attachmentUrlInputRef = ref<HTMLInputElement | null>(null);
|
||||
@@ -67,7 +68,6 @@ const showAttachmentMenu = ref(false);
|
||||
const showAttachmentUrlPanel = ref(false);
|
||||
const showKbDropdown = ref(false);
|
||||
const attachmentUrlInput = ref('');
|
||||
|
||||
const closeAttachmentMenu = () => {
|
||||
showAttachmentMenu.value = false;
|
||||
showAttachmentUrlPanel.value = false;
|
||||
@@ -151,6 +151,26 @@ onBeforeUnmount(() => {
|
||||
document.removeEventListener('mousedown', handleDocumentPointerDown);
|
||||
document.removeEventListener('touchstart', handleDocumentPointerDown);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.isThinking,
|
||||
async (thinking, prevThinking) => {
|
||||
if (thinking || !prevThinking || props.isVoiceTranscribing) return;
|
||||
await nextTick();
|
||||
textareaRef.value?.focus();
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => inputValue.value,
|
||||
async (value) => {
|
||||
if (value) return;
|
||||
await nextTick();
|
||||
if (textareaRef.value && textareaRef.value.value !== '') {
|
||||
textareaRef.value.value = '';
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -174,12 +194,13 @@ onBeforeUnmount(() => {
|
||||
</button>
|
||||
</div>
|
||||
<textarea
|
||||
ref="textareaRef"
|
||||
v-model="inputValue"
|
||||
rows="1"
|
||||
:placeholder="isVoiceTranscribing ? $t('chat.voiceTranscribing') : isVoiceRecording ? $t('chat.voiceListening') : shippingFocusTaskNo ? $t('chat.shippingNoticeUi.focusInputPlaceholder', { taskId: shippingFocusTaskNo }) : $t('chat.askAnything')"
|
||||
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-primary placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-0"
|
||||
style="min-height: 44px; max-height: 220px;"
|
||||
:disabled="isThinking || isVoiceTranscribing"
|
||||
:disabled="isVoiceTranscribing"
|
||||
spellcheck="false"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
@@ -349,13 +370,14 @@ onBeforeUnmount(() => {
|
||||
: 'border-brand-500 bg-brand-500 text-white shadow-[0_0_0_4px_rgba(59,130,246,0.18)] hover:scale-105 hover:bg-brand-600 hover:shadow-[0_0_0_6px_rgba(59,130,246,0.24)] active:scale-95'"
|
||||
@click="emit('send')"
|
||||
>
|
||||
<Loader2 v-if="isUploadingAttachments" class="h-4 w-4 animate-spin" />
|
||||
<Loader2 v-if="isUploadingAttachments || isThinking" class="h-4 w-4 animate-spin" />
|
||||
<Send v-else class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 text-center text-[11px] text-muted">
|
||||
{{ $t('chat.disclaimer') }}
|
||||
<span v-if="isThinking">{{ $t('chat.thinking') }}</span>
|
||||
<span v-else>{{ $t('chat.disclaimer') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Reference in new issue
Block a user