diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue
index 5d1755e1e..1cb1a74ae 100644
--- a/ui/src/components/ai-chat/index.vue
+++ b/ui/src/components/ai-chat/index.vue
@@ -35,7 +35,7 @@
-
+
@@ -51,8 +51,9 @@
ref="dynamicsFormRef"
/>
([])
const inputFieldList = ref([])
const apiInputFieldList = ref([])
const form_data = ref({})
+const api_form_data = ref({})
const isDisabledChart = computed(
() => !(inputValue.value.trim() && (props.appId || props.data?.name))
@@ -431,12 +437,8 @@ function showSource(row: any) {
}
function quickProblemHandle(val: string) {
- // 检查inputFieldList是否有未填写的字段
- for (let i = 0; i < inputFieldList.value.length; i++) {
- if (inputFieldList.value[i].required && !form_data.value[inputFieldList.value[i].field]) {
- MsgWarning('请填写所有必填字段')
- return
- }
+ if (!checkInputParam()) {
+ return
}
if (!loading.value && props.data?.name) {
handleDebounceClick(val)
@@ -447,14 +449,40 @@ const handleDebounceClick = debounce((val) => {
chatMessage(null, val)
}, 200)
-function sendChatHandle(event: any) {
+function checkInputParam() {
// 检查inputFieldList是否有未填写的字段
for (let i = 0; i < inputFieldList.value.length; i++) {
if (inputFieldList.value[i].required && !form_data.value[inputFieldList.value[i].field]) {
MsgWarning('请填写所有必填字段')
- return
+ return false
}
}
+ // 浏览器query参数找到接口传参
+ let msg = []
+ for (let f of apiInputFieldList.value) {
+ if (!props.debug) {
+ if (f.required && !route.query[f.field]) {
+ msg.push(f.field)
+ }
+ api_form_data.value[f.field] = route.query[f.field]
+ } else {
+ if (f.required && !api_form_data.value[f.field]) {
+ MsgWarning('请填写所有必填字段')
+ return false
+ }
+ }
+ }
+ if (msg.length > 0) {
+ MsgWarning(`请在URL中填写参数 ${msg.join('、')}的值`)
+ return false
+ }
+ return true
+}
+
+function sendChatHandle(event: any) {
+ if (!checkInputParam()) {
+ return
+ }
if (!event.ctrlKey) {
// 如果没有按下组合键ctrl,则会阻止默认事件
event.preventDefault()
@@ -616,18 +644,6 @@ const errorWrite = (chat: any, message?: string) => {
}
function chatMessage(chat?: any, problem?: string, re_chat?: boolean) {
- // 浏览器query参数找到接口传参
- let msg = []
- for (let f of apiInputFieldList.value) {
- if (f.required && !route.query[f.field]) {
- msg.push(f.field)
- }
- form_data.value[f.field] = route.query[f.field]
- }
- if (msg.length > 0) {
- MsgWarning(`请在URL中填写参数 ${msg.join('、')}的值`)
- return
- }
loading.value = true
if (!chat) {
chat = reactive({
@@ -658,7 +674,7 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean) {
const obj = {
message: chat.problem_text,
re_chat: re_chat || false,
- form_data: form_data.value
+ form_data: {...form_data.value, ...api_form_data.value}
}
// 对话
applicationApi
diff --git a/ui/src/views/application-workflow/index.vue b/ui/src/views/application-workflow/index.vue
index c3f3f6377..f9ba4a4cc 100644
--- a/ui/src/views/application-workflow/index.vue
+++ b/ui/src/views/application-workflow/index.vue
@@ -138,7 +138,7 @@
diff --git a/ui/src/views/chat/pc/index.vue b/ui/src/views/chat/pc/index.vue
index 3ed0c7a30..701cbfdae 100644
--- a/ui/src/views/chat/pc/index.vue
+++ b/ui/src/views/chat/pc/index.vue
@@ -108,6 +108,7 @@
:appId="applicationDetail?.id"
:record="currentRecordList"
:chatId="currentChatId"
+ :debug="true"
@refresh="refresh"
@scroll="handleScroll"
>