mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 修复对话中禁止表单提交 (#1718)
This commit is contained in:
parent
5ebb88b6de
commit
f7588c0b28
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue