feat: 对接AI对话接口

This commit is contained in:
2026-02-11 16:32:38 +08:00
parent 0d13d69339
commit 7656250d9a
7 changed files with 637 additions and 95 deletions

View File

@@ -22,6 +22,7 @@
:placeholder="$t('Input.placeholder')"
@input="handleEditorInput"
@paste="handleEditorPaste"
@keypress="handleKeyPress"
>
<!-- <Tag v-if="showReportTag" /> -->
<div
@@ -188,7 +189,7 @@
}
)
const emits = defineEmits(['send'])
const emits = defineEmits(['send'])
const { t } = useI18n()
@@ -295,14 +296,23 @@
}
}
const handleSendAgent=()=>{
emits('send', inputValue.value)
// 发送后清空输入框
if(editorRef.value){
editorRef.value.innerHTML = ''
}
inputValue.value = ''
}
const handleKeyPress = (e) => {
// 检测回车
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
handleSendAgent()
}
}
const handleSendAgent = () => {
if (!inputValue.value.trim()) return
emits('send', { text: inputValue.value.trim(), images: uploadedImages.value })
// 发送后清空输入框
if (editorRef.value) {
editorRef.value.innerHTML = ''
}
inputValue.value = ''
}
// 监听 inputValue 外部变化
watch(inputValue, () => {
nextTick(() => {
@@ -314,7 +324,6 @@
onMounted(() => {
autoResizeEditor()
})
const typeValue = ref<string>('')
const areaValue = ref<string>('')
@@ -598,7 +607,7 @@
.agent {
padding: 1.2rem;
box-shadow: none;
border-radius: 1.5rem;
border-radius: 1.5rem;
border: 0.1rem solid #0000001a;
.scroll-content {
padding: 0;
@@ -611,7 +620,7 @@
min-height: initial;
max-height: initial;
padding: 0;
height: 100%;
height: 100%;
}
}
.operate {