feat: add chat quick question

This commit is contained in:
wangdan-fit2cloud 2024-12-24 17:23:47 +08:00
parent af3266b979
commit f1cca66012

View File

@ -189,7 +189,7 @@ import { MsgWarning } from '@/utils/message'
const route = useRoute()
const {
query: { mode }
query: { mode, question }
} = route as any
const quickInputRef = ref()
const props = withDefaults(
@ -483,11 +483,11 @@ const handleTimeChange = () => {
}, 1000)
}
function sendChatHandle(event: any) {
if (!event.ctrlKey) {
function sendChatHandle(event?: any) {
if (!event?.ctrlKey) {
// ctrl
event.preventDefault()
if (!isDisabledChart.value && !props.loading && !event.isComposing) {
event?.preventDefault()
if (!isDisabledChart.value && !props.loading && !event?.isComposing) {
if (inputValue.value.trim()) {
props.sendMessage(inputValue.value, {
image_list: uploadImageList.value,
@ -530,6 +530,10 @@ function mouseleave() {
}
onMounted(() => {
if (question) {
inputValue.value = decodeURIComponent(question.trim())
sendChatHandle()
}
setTimeout(() => {
if (quickInputRef.value && mode === 'embed') {
quickInputRef.value.textarea.style.height = '0'