fix: 修复对话中禁止表单提交 (#1718)
This commit is contained in:
parent
5ebb88b6de
commit
f7588c0b28
@ -460,11 +460,12 @@ class WorkflowManage:
|
|||||||
self.params['chat_record_id'],
|
self.params['chat_record_id'],
|
||||||
current_node.id,
|
current_node.id,
|
||||||
current_node.up_node_id_list,
|
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):
|
if not self.node_chunk_manage.contains(node_chunk):
|
||||||
self.node_chunk_manage.add_node_chunk(node_chunk)
|
self.node_chunk_manage.add_node_chunk(node_chunk)
|
||||||
node_chunk.add_chunk(chunk)
|
node_chunk.end(chunk)
|
||||||
node_chunk.end()
|
|
||||||
current_node.get_write_error_context(e)
|
current_node.get_write_error_context(e)
|
||||||
self.status = 500
|
self.status = 500
|
||||||
|
|
||||||
|
|||||||
@ -293,7 +293,6 @@ export class ChatManagement {
|
|||||||
*/
|
*/
|
||||||
static write(chatRecordId: string) {
|
static write(chatRecordId: string) {
|
||||||
const chatRecord = this.chatMessageContainer[chatRecordId]
|
const chatRecord = this.chatMessageContainer[chatRecordId]
|
||||||
console.log('chatRecord', chatRecordId, this.chatMessageContainer, chatRecord)
|
|
||||||
if (chatRecord) {
|
if (chatRecord) {
|
||||||
chatRecord.write()
|
chatRecord.write()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -341,7 +341,7 @@
|
|||||||
<div class="p-8-12 border-t-dashed lighter">
|
<div class="p-8-12 border-t-dashed lighter">
|
||||||
<div v-for="(f, i) in item.form_field_list" :key="i" class="mb-8">
|
<div v-for="(f, i) in item.form_field_list" :key="i" class="mb-8">
|
||||||
<span class="color-secondary">{{ f.label.label }}:</span>
|
<span class="color-secondary">{{ f.label.label }}:</span>
|
||||||
{{ item.form_data[f.field] }}
|
{{ (item.form_data?item.form_data:{})[f.field] }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -467,7 +467,6 @@ watch(dialogVisible, (bool) => {
|
|||||||
|
|
||||||
const open = (data: any) => {
|
const open = (data: any) => {
|
||||||
detail.value = cloneDeep(data)
|
detail.value = cloneDeep(data)
|
||||||
console.log(detail.value)
|
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
source=" 抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。"
|
source=" 抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。"
|
||||||
></MdRenderer>
|
></MdRenderer>
|
||||||
<MdRenderer
|
<MdRenderer
|
||||||
|
:loading="loading"
|
||||||
v-else-if="answer_text"
|
v-else-if="answer_text"
|
||||||
:source="answer_text"
|
:source="answer_text"
|
||||||
:send-message="chatMessage"
|
:send-message="chatMessage"
|
||||||
@ -60,13 +61,16 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
|
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
|
||||||
if (type === 'old') {
|
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.sendMessage(question, other_params_data, props.chatRecord)
|
||||||
props.chatManagement.write(props.chatRecord.id)
|
props.chatManagement.write(props.chatRecord.id)
|
||||||
} else {
|
} else {
|
||||||
props.sendMessage(question, other_params_data)
|
props.sendMessage(question, other_params_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const add_answer_text_list=(answer_text_list:Array<string>)=>{
|
||||||
|
answer_text_list.push('')
|
||||||
|
}
|
||||||
|
|
||||||
function showSource(row: any) {
|
function showSource(row: any) {
|
||||||
if (props.type === 'log') {
|
if (props.type === 'log') {
|
||||||
|
|||||||
@ -273,7 +273,6 @@ const errorWrite = (chat: any, message?: string) => {
|
|||||||
|
|
||||||
function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_params_data?: any) {
|
function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_params_data?: any) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
console.log(chat)
|
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
chat = reactive({
|
chat = reactive({
|
||||||
id: randomId(),
|
id: randomId(),
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
v-model="form_data"
|
v-model="form_data"
|
||||||
:model="form_data"
|
:model="form_data"
|
||||||
></DynamicsForm>
|
></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
|
>提交</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -18,10 +18,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||||
const props = defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
form_setting: string
|
form_setting: string
|
||||||
|
loading?:boolean
|
||||||
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
|
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
|
||||||
}>()
|
}>(),{
|
||||||
|
loading:false
|
||||||
|
})
|
||||||
const form_setting_data = computed(() => {
|
const form_setting_data = computed(() => {
|
||||||
if (props.form_setting) {
|
if (props.form_setting) {
|
||||||
return JSON.parse(props.form_setting)
|
return JSON.parse(props.form_setting)
|
||||||
|
|||||||
@ -6,7 +6,9 @@
|
|||||||
class="problem-button ellipsis-2 mb-8"
|
class="problem-button ellipsis-2 mb-8"
|
||||||
:class="sendMessage ? 'cursor' : 'disabled'"
|
:class="sendMessage ? 'cursor' : 'disabled'"
|
||||||
>
|
>
|
||||||
<el-icon><EditPen /></el-icon>
|
<el-icon>
|
||||||
|
<EditPen />
|
||||||
|
</el-icon>
|
||||||
{{ item.content }}
|
{{ item.content }}
|
||||||
</div>
|
</div>
|
||||||
<HtmlRander v-else-if="item.type === 'html_rander'" :source="item.content"></HtmlRander>
|
<HtmlRander v-else-if="item.type === 'html_rander'" :source="item.content"></HtmlRander>
|
||||||
@ -15,6 +17,7 @@
|
|||||||
:option="item.content"
|
:option="item.content"
|
||||||
></EchartsRander>
|
></EchartsRander>
|
||||||
<FormRander
|
<FormRander
|
||||||
|
:loading="loading"
|
||||||
:send-message="sendMessage"
|
:send-message="sendMessage"
|
||||||
v-else-if="item.type === 'form_rander'"
|
v-else-if="item.type === 'form_rander'"
|
||||||
:form_setting="item.content"
|
:form_setting="item.content"
|
||||||
@ -61,9 +64,11 @@ const props = withDefaults(
|
|||||||
source?: string
|
source?: string
|
||||||
inner_suffix?: boolean
|
inner_suffix?: boolean
|
||||||
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
|
sendMessage?: (question: string, type: 'old' | 'new', other_params_data?: any) => void
|
||||||
|
loading?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
source: ''
|
source: '',
|
||||||
|
loading: false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
const editorRef = ref()
|
const editorRef = ref()
|
||||||
@ -225,14 +230,17 @@ const split_form_rander_ = (source: string, type: string) => {
|
|||||||
color: var(--el-text-color-regular);
|
color: var(--el-text-color-regular);
|
||||||
-webkit-line-clamp: 1;
|
-webkit-line-clamp: 1;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: var(--el-color-primary-light-9);
|
background: var(--el-color-primary-light-9);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.disabled {
|
&.disabled {
|
||||||
&:hover {
|
&:hover {
|
||||||
background: var(--app-layout-bg-color);
|
background: var(--app-layout-bg-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-icon) {
|
:deep(.el-icon) {
|
||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user