Skip to content

Commit f7588c0

Browse files
authored
fix: 修复对话中禁止表单提交 (#1718)
1 parent 5ebb88b commit f7588c0

File tree

7 files changed

+26
-13
lines changed

7 files changed

+26
-13
lines changed

apps/application/flow/workflow_manage.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,12 @@ def hand_event_node_result(self, current_node, node_result_future):
460460
self.params['chat_record_id'],
461461
current_node.id,
462462
current_node.up_node_id_list,
463-
str(e), False, 0, 0, {'node_is_end': True})
463+
str(e), False, 0, 0,
464+
{'node_is_end': True, 'node_type': current_node.type,
465+
'view_type': current_node.view_type})
464466
if not self.node_chunk_manage.contains(node_chunk):
465467
self.node_chunk_manage.add_node_chunk(node_chunk)
466-
node_chunk.add_chunk(chunk)
467-
node_chunk.end()
468+
node_chunk.end(chunk)
468469
current_node.get_write_error_context(e)
469470
self.status = 500
470471

ui/src/api/type/application.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ export class ChatManagement {
293293
*/
294294
static write(chatRecordId: string) {
295295
const chatRecord = this.chatMessageContainer[chatRecordId]
296-
console.log('chatRecord', chatRecordId, this.chatMessageContainer, chatRecord)
297296
if (chatRecord) {
298297
chatRecord.write()
299298
}

ui/src/components/ai-chat/ExecutionDetailDialog.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@
341341
<div class="p-8-12 border-t-dashed lighter">
342342
<div v-for="(f, i) in item.form_field_list" :key="i" class="mb-8">
343343
<span class="color-secondary">{{ f.label.label }}:</span>
344-
{{ item.form_data[f.field] }}
344+
{{ (item.form_data?item.form_data:{})[f.field] }}
345345
</div>
346346
</div>
347347
</div>
@@ -467,7 +467,6 @@ watch(dialogVisible, (bool) => {
467467
468468
const open = (data: any) => {
469469
detail.value = cloneDeep(data)
470-
console.log(detail.value)
471470
dialogVisible.value = true
472471
}
473472
onBeforeUnmount(() => {

ui/src/components/ai-chat/component/answer-content/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
source=" 抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。"
1515
></MdRenderer>
1616
<MdRenderer
17+
:loading="loading"
1718
v-else-if="answer_text"
1819
:source="answer_text"
1920
:send-message="chatMessage"
@@ -60,13 +61,16 @@ const props = defineProps<{
6061
6162
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
6263
if (type === 'old') {
63-
props.chatRecord.answer_text_list.push('')
64+
add_answer_text_list( props.chatRecord.answer_text_list)
6465
props.sendMessage(question, other_params_data, props.chatRecord)
6566
props.chatManagement.write(props.chatRecord.id)
6667
} else {
6768
props.sendMessage(question, other_params_data)
6869
}
6970
}
71+
const add_answer_text_list=(answer_text_list:Array<string>)=>{
72+
answer_text_list.push('')
73+
}
7074
7175
function showSource(row: any) {
7276
if (props.type === 'log') {

ui/src/components/ai-chat/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ const errorWrite = (chat: any, message?: string) => {
273273
274274
function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_params_data?: any) {
275275
loading.value = true
276-
console.log(chat)
277276
if (!chat) {
278277
chat = reactive({
279278
id: randomId(),

ui/src/components/markdown/FormRander.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@
1010
v-model="form_data"
1111
:model="form_data"
1212
></DynamicsForm>
13-
<el-button :type="is_submit ? 'info' : 'primary'" :disabled="is_submit" @click="submit"
13+
<el-button :type="is_submit ? 'info' : 'primary'" :disabled="is_submit||loading" @click="submit"
1414
>提交</el-button
1515
>
1616
</div>
1717
</template>
1818
<script setup lang="ts">
1919
import { computed, ref } from 'vue'
2020
import DynamicsForm from '@/components/dynamics-form/index.vue'
21-
const props = defineProps<{
21+
const props = withDefaults(defineProps<{
2222
form_setting: string
23+
loading?:boolean
2324
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
24-
}>()
25+
}>(),{
26+
loading:false
27+
})
2528
const form_setting_data = computed(() => {
2629
if (props.form_setting) {
2730
return JSON.parse(props.form_setting)

ui/src/components/markdown/MdRenderer.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
class="problem-button ellipsis-2 mb-8"
77
:class="sendMessage ? 'cursor' : 'disabled'"
88
>
9-
<el-icon><EditPen /></el-icon>
9+
<el-icon>
10+
<EditPen />
11+
</el-icon>
1012
{{ item.content }}
1113
</div>
1214
<HtmlRander v-else-if="item.type === 'html_rander'" :source="item.content"></HtmlRander>
@@ -15,6 +17,7 @@
1517
:option="item.content"
1618
></EchartsRander>
1719
<FormRander
20+
:loading="loading"
1821
:send-message="sendMessage"
1922
v-else-if="item.type === 'form_rander'"
2023
:form_setting="item.content"
@@ -61,9 +64,11 @@ const props = withDefaults(
6164
source?: string
6265
inner_suffix?: boolean
6366
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
67+
loading?: boolean
6468
}>(),
6569
{
66-
source: ''
70+
source: '',
71+
loading: false
6772
}
6873
)
6974
const editorRef = ref()
@@ -225,14 +230,17 @@ const split_form_rander_ = (source: string, type: string) => {
225230
color: var(--el-text-color-regular);
226231
-webkit-line-clamp: 1;
227232
word-break: break-all;
233+
228234
&:hover {
229235
background: var(--el-color-primary-light-9);
230236
}
237+
231238
&.disabled {
232239
&:hover {
233240
background: var(--app-layout-bg-color);
234241
}
235242
}
243+
236244
:deep(.el-icon) {
237245
color: var(--el-color-primary);
238246
}

0 commit comments

Comments
 (0)