feat: add chat quick question
This commit is contained in:
parent
af3266b979
commit
f1cca66012
@ -189,7 +189,7 @@ import { MsgWarning } from '@/utils/message'
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
query: { mode }
|
query: { mode, question }
|
||||||
} = route as any
|
} = route as any
|
||||||
const quickInputRef = ref()
|
const quickInputRef = ref()
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
@ -483,11 +483,11 @@ const handleTimeChange = () => {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendChatHandle(event: any) {
|
function sendChatHandle(event?: any) {
|
||||||
if (!event.ctrlKey) {
|
if (!event?.ctrlKey) {
|
||||||
// 如果没有按下组合键ctrl,则会阻止默认事件
|
// 如果没有按下组合键ctrl,则会阻止默认事件
|
||||||
event.preventDefault()
|
event?.preventDefault()
|
||||||
if (!isDisabledChart.value && !props.loading && !event.isComposing) {
|
if (!isDisabledChart.value && !props.loading && !event?.isComposing) {
|
||||||
if (inputValue.value.trim()) {
|
if (inputValue.value.trim()) {
|
||||||
props.sendMessage(inputValue.value, {
|
props.sendMessage(inputValue.value, {
|
||||||
image_list: uploadImageList.value,
|
image_list: uploadImageList.value,
|
||||||
@ -530,6 +530,10 @@ function mouseleave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (question) {
|
||||||
|
inputValue.value = decodeURIComponent(question.trim())
|
||||||
|
sendChatHandle()
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (quickInputRef.value && mode === 'embed') {
|
if (quickInputRef.value && mode === 'embed') {
|
||||||
quickInputRef.value.textarea.style.height = '0'
|
quickInputRef.value.textarea.style.height = '0'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user