fix: 修复对话中禁止表单提交 (#1718)

This commit is contained in:
shaohuzhang1 2024-11-30 23:33:28 +08:00 committed by GitHub
parent 5ebb88b6de
commit f7588c0b28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 26 additions and 13 deletions

View File

@ -460,11 +460,12 @@ class WorkflowManage:
self.params['chat_record_id'],
current_node.id,
current_node.up_node_id_list,
str(e), False, 0, 0, {'node_is_end': True})
str(e), False, 0, 0,
{'node_is_end': True, 'node_type': current_node.type,
'view_type': current_node.view_type})
if not self.node_chunk_manage.contains(node_chunk):
self.node_chunk_manage.add_node_chunk(node_chunk)
node_chunk.add_chunk(chunk)
node_chunk.end()
node_chunk.end(chunk)
current_node.get_write_error_context(e)
self.status = 500

View File

@ -293,7 +293,6 @@ export class ChatManagement {
*/
static write(chatRecordId: string) {
const chatRecord = this.chatMessageContainer[chatRecordId]
console.log('chatRecord', chatRecordId, this.chatMessageContainer, chatRecord)
if (chatRecord) {
chatRecord.write()
}

View File

@ -341,7 +341,7 @@
<div class="p-8-12 border-t-dashed lighter">
<div v-for="(f, i) in item.form_field_list" :key="i" class="mb-8">
<span class="color-secondary">{{ f.label.label }}:</span>
{{ item.form_data[f.field] }}
{{ (item.form_data?item.form_data:{})[f.field] }}
</div>
</div>
</div>
@ -467,7 +467,6 @@ watch(dialogVisible, (bool) => {
const open = (data: any) => {
detail.value = cloneDeep(data)
console.log(detail.value)
dialogVisible.value = true
}
onBeforeUnmount(() => {

View File

@ -14,6 +14,7 @@
source=" 抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。"
></MdRenderer>
<MdRenderer
:loading="loading"
v-else-if="answer_text"
:source="answer_text"
:send-message="chatMessage"
@ -60,13 +61,16 @@ const props = defineProps<{
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
if (type === 'old') {
props.chatRecord.answer_text_list.push('')
add_answer_text_list( props.chatRecord.answer_text_list)
props.sendMessage(question, other_params_data, props.chatRecord)
props.chatManagement.write(props.chatRecord.id)
} else {
props.sendMessage(question, other_params_data)
}
}
const add_answer_text_list=(answer_text_list:Array<string>)=>{
answer_text_list.push('')
}
function showSource(row: any) {
if (props.type === 'log') {

View File

@ -273,7 +273,6 @@ const errorWrite = (chat: any, message?: string) => {
function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_params_data?: any) {
loading.value = true
console.log(chat)
if (!chat) {
chat = reactive({
id: randomId(),

View File

@ -10,7 +10,7 @@
v-model="form_data"
:model="form_data"
></DynamicsForm>
<el-button :type="is_submit ? 'info' : 'primary'" :disabled="is_submit" @click="submit"
<el-button :type="is_submit ? 'info' : 'primary'" :disabled="is_submit||loading" @click="submit"
>提交</el-button
>
</div>
@ -18,10 +18,13 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import DynamicsForm from '@/components/dynamics-form/index.vue'
const props = defineProps<{
const props = withDefaults(defineProps<{
form_setting: string
loading?:boolean
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
}>()
}>(),{
loading:false
})
const form_setting_data = computed(() => {
if (props.form_setting) {
return JSON.parse(props.form_setting)

View File

@ -6,7 +6,9 @@
class="problem-button ellipsis-2 mb-8"
:class="sendMessage ? 'cursor' : 'disabled'"
>
<el-icon><EditPen /></el-icon>
<el-icon>
<EditPen />
</el-icon>
{{ item.content }}
</div>
<HtmlRander v-else-if="item.type === 'html_rander'" :source="item.content"></HtmlRander>
@ -15,6 +17,7 @@
:option="item.content"
></EchartsRander>
<FormRander
:loading="loading"
:send-message="sendMessage"
v-else-if="item.type === 'form_rander'"
:form_setting="item.content"
@ -61,9 +64,11 @@ const props = withDefaults(
source?: string
inner_suffix?: boolean
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
loading?: boolean
}>(),
{
source: ''
source: '',
loading: false
}
)
const editorRef = ref()
@ -225,14 +230,17 @@ const split_form_rander_ = (source: string, type: string) => {
color: var(--el-text-color-regular);
-webkit-line-clamp: 1;
word-break: break-all;
&:hover {
background: var(--el-color-primary-light-9);
}
&.disabled {
&:hover {
background: var(--app-layout-bg-color);
}
}
:deep(.el-icon) {
color: var(--el-color-primary);
}