1.7.0前端

feat(Ai):完成AI自动生成报表功能
fix(AI):完善AI智能填充form功能
master
xs 3 weeks ago
parent 4510f3440e
commit 718559e91d

@ -0,0 +1,90 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {AskVO} from "@/api/ai/skill/aiChat/types";
// AI报表分析生成SQL语句API
export const generateReportSql = (query?: AskVO): AxiosPromise<AskVO[]> => {
return request({
url: '/ai/aiReport/generateReportSql',
method: 'post',
params: query,
timeout: 1000000
});
};
// AI报表分析API
export function generateReport(data) {
return request({
url: '/ai/aiReport/generateReport',
method: 'post',
data
})
}
// 获取最新AI生成报表信息
export function getRecentReports() {
return request({
url: '/ai/aiReport/getRecentReports',
method: 'get'
})
}
/**
* sessionidmessagedetailtypeAI
* @param query
* @returns {*}
*/
export function getRecentReportInfo (query) {
return request({
url: '/ai/aiReport/getRecentReportInfo',
method: 'get',
params: query
});
};
// 测试报表分析API
export function generateTestReport(data) {
return request({
url: '/ai/aiReport/generateTestReport',
method: 'post',
data
})
}
// 获取快速体验示例
export function getQuickExamples() {
return request({
url: '/ai/aiReport/examples',
method: 'get'
})
}
// 生成SQL测试用
export function generateSQL(prompt) {
return request({
url: '/ai/aiReport/generate-sql',
method: 'post',
params: { prompt }
})
}
// 生成HTML测试用
export function generateHTML(prompt) {
return request({
url: '/ai/aiReport/generate-html',
method: 'post',
params: { prompt }
})
}
// 健康检查
export function healthCheck() {
return request({
url: '/ai/aiReport/health',
method: 'get'
})
}

@ -355,6 +355,10 @@ const selectForm = async (aiFormSetting: AiFormSettingVO) => {
const resetAiAssistant = () =>{
chatList.value = [];
selectLists.value = [];
type1Elements.value = [];
type2Elements.value = [];
selectedType2Elements.value = [];
}
// function selectForm(aiFormSetting: AiFormSettingVO) {
@ -440,12 +444,130 @@ function onModelChange() {
}
}
watch(state, (newVal) => {
if (newVal.isShowSearch) {
loadForms()
getAiModelList();
//
const resetAllState = () => {
//
selectedFormSettingId.value = null
selectedForm.value = null
//
chatList.value = []
selectLists.value = []
type1Elements.value = []
type2Elements.value = []
selectedType2Elements.value = []
//
inputValue.value = ''
aiThinking.value = false
aiLoading.value = false
//
isRecording.value = false
audioAsrLoading.value = false
recognitionResult.value = ''
uploadProgress.value = 0
isUploading.value = false
//
selectDialog.value = false
selectDialogList.value = null
selectDialogListIndex.value = undefined
selectDialogFilterText.value = ''
selectedOption.value = ''
//
windowPosition.value = { x: 'auto', y: 0 }
windowSize.value = { width: '24%', height: '100vh' }
isCustomPosition.value = false
//
currentComponent.value = null
currentProps.value = {}
isShowLeft.value = false
currentSize.value = "menu"
//
showMore.value = false
moreFilterText.value = ''
// sendForm
sendForm.value = {}
//
if (microphoneStream) {
microphoneStream.getTracks().forEach(track => track.stop())
microphoneStream = null
}
});
if (mediaRecorder && mediaRecorder.state !== 'inactive') {
mediaRecorder.stop()
mediaRecorder = null
}
audioChunks = []
// URL
recordings.value.forEach(recording => {
URL.revokeObjectURL(recording.url)
})
recordings.value = []
}
//
const cleanupOnClose = () => {
//
if (isRecording.value) {
stopRecording()
}
//
if (microphoneStream) {
microphoneStream.getTracks().forEach(track => track.stop())
microphoneStream = null
}
if (mediaRecorder && mediaRecorder.state !== 'inactive') {
mediaRecorder.stop()
mediaRecorder = null
}
audioChunks = []
//
resetAllState()
}
//
watch(() => state.isShowSearch, async (newVal) => {
if (newVal) {
console.log('AI窗口打开重置状态并重新加载')
//
resetAllState()
try {
//
await Promise.all([
loadForms(),
getAiModelList()
])
//
initFormPageMap()
//
sharedStore.updateDynamicValue({
message: null,
timestamp: null
})
} catch (error) {
console.error('重新加载数据失败:', error)
ElMessage.error('加载数据失败,请重试')
}
}
}, { immediate: true })
const selectLists = ref([]);
@ -494,6 +616,7 @@ const sendForm = ref({});
const handleSend = async (selectedText?: string) => {
if ((!canSend.value || aiThinking.value) && !selectedText) return
const userMsg = selectedText || inputValue.value
selectLists.value = [];
chatList.value.push({text: userMsg, from: 'user', type: 'text'})
scrollToBottom()
aiThinking.value = true
@ -1077,8 +1200,9 @@ onMounted(() => {
// processData(testData1);
})
//
onBeforeUnmount(() => {
cleanupOnClose()
})
//
@ -1158,6 +1282,7 @@ function onInputKeydown(e: KeyboardEvent) {
}
function close() {
cleanupOnClose()
state.isShowSearch = false
}

@ -530,7 +530,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
path: '/ai/skill/knowledgeBaseQA',
component: Layout,
hidden: true,
permissions: ['ai:aiKnowledgeBaseDocs:qa'],
permissions: ['ai:aiKnowledgeBase:qa'],
children: [
{
path: 'index/:knowledgeBaseId/:embeddingModelId/:retrieveLimit',

File diff suppressed because it is too large Load Diff

@ -710,8 +710,8 @@ const sharedData = computed(() => sharedStore.dynamicValue)
watch(
() => sharedStore.dynamicValue,
(newValue, oldValue) => {
if (newValue !== oldValue) {
ElMessage.info('收到新数据更新')
if (newValue!=null && newValue.message!=null && newValue !== oldValue) {
// ElMessage.info('')
console.log('数据更新:', newValue)
//
// handleDataUpdate(newValue)

Loading…
Cancel
Save