mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
Merge branch 'main' of https://github.com/maxkb-dev/maxkb
This commit is contained in:
commit
dea8c73cdd
|
|
@ -17,6 +17,7 @@ MaxKB = Max Knowledge Base, it is a chatbot based on Large Language Models (LLM)
|
|||
- **Flexible Orchestration**: Equipped with a powerful workflow engine and function library, enabling the orchestration of AI processes to meet the needs of complex business scenarios.
|
||||
- **Seamless Integration**: Facilitates zero-coding rapid integration into third-party business systems, quickly equipping existing systems with intelligent Q&A capabilities to enhance user satisfaction.
|
||||
- **Model-Agnostic**: Supports various large models, including private models (such as DeepSeek, Llama, Qwen, etc.) and public models (like OpenAI, Claude, Gemini, etc.).
|
||||
- **Multi Modal**: Native support for input and output text, image, audio and video.
|
||||
|
||||
## Quick start
|
||||
|
||||
|
|
|
|||
|
|
@ -307,7 +307,11 @@ class BaseChatStep(IChatStep):
|
|||
return manage.get_base_to_response().to_block_response(str(chat_id), str(chat_record_id),
|
||||
content, True,
|
||||
request_token, response_token,
|
||||
{'reasoning_content': reasoning_content})
|
||||
{'reasoning_content': reasoning_content,
|
||||
'answer_list': [{
|
||||
'content': content,
|
||||
'reasoning_content': reasoning_content
|
||||
}]})
|
||||
except Exception as e:
|
||||
all_text = 'Exception:' + str(e)
|
||||
write_context(self, manage, 0, 0, all_text)
|
||||
|
|
|
|||
|
|
@ -337,13 +337,15 @@ class WorkflowManage:
|
|||
answer_text = '\n\n'.join(
|
||||
'\n\n'.join([a.get('content') for a in answer]) for answer in
|
||||
answer_text_list)
|
||||
answer_list = reduce(lambda pre, _n: [*pre, *_n], answer_text_list, [])
|
||||
self.work_flow_post_handler.handler(self.params['chat_id'], self.params['chat_record_id'],
|
||||
answer_text,
|
||||
self)
|
||||
return self.base_to_response.to_block_response(self.params['chat_id'],
|
||||
self.params['chat_record_id'], answer_text, True
|
||||
, message_tokens, answer_tokens,
|
||||
_status=status.HTTP_200_OK if self.status == 200 else status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
_status=status.HTTP_200_OK if self.status == 200 else status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
other_params={'answer_list': answer_list})
|
||||
|
||||
def run_stream(self, current_node, node_result_future, language='zh'):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from django.core import signing
|
|||
from django.core.cache import cache
|
||||
|
||||
# alg使用的算法
|
||||
HEADER = {'typ': 'JWP', 'alg': 'default'}
|
||||
HEADER = {'type': 'JWP', 'alg': 'default'}
|
||||
TOKEN_KEY = 'solomon_world_token'
|
||||
TOKEN_SALT = 'solomonwanc@gmail.com'
|
||||
TIME_OUT = 30 * 60
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ class FunctionLibSerializer(serializers.Serializer):
|
|||
mk_instance = FlibInstance(application_dict, 'v1')
|
||||
application_pickle = pickle.dumps(mk_instance)
|
||||
response = HttpResponse(content_type='text/plain', content=application_pickle)
|
||||
response['Content-Disposition'] = f'attachment; filename="{function_lib.name}.flib"'
|
||||
response['Content-Disposition'] = f'attachment; filename="{function_lib.name}.fx"'
|
||||
return response
|
||||
except Exception as e:
|
||||
return result.error(str(e), response_status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ const exportFunctionLib = (
|
|||
loading?: Ref<boolean>
|
||||
) => {
|
||||
return exportFile(
|
||||
name + '.flib',
|
||||
name + '.fx',
|
||||
`${prefix}/${id}/export`,
|
||||
undefined,
|
||||
loading
|
||||
|
|
|
|||
|
|
@ -1,16 +1,50 @@
|
|||
<template>
|
||||
<Codemirror
|
||||
v-bind="$attrs"
|
||||
ref="cmRef"
|
||||
:extensions="extensions"
|
||||
:style="codemirrorStyle"
|
||||
:tab-size="4"
|
||||
:autofocus="true"
|
||||
/>
|
||||
<div class="codemirror-editor w-full">
|
||||
<Codemirror
|
||||
v-model="data"
|
||||
ref="cmRef"
|
||||
:extensions="extensions"
|
||||
:style="codemirrorStyle"
|
||||
:tab-size="4"
|
||||
:autofocus="true"
|
||||
v-bind="$attrs"
|
||||
/>
|
||||
|
||||
<div class="codemirror-editor__footer">
|
||||
<el-button text type="info" @click="openCodemirrorDialog" class="magnify">
|
||||
<AppIcon iconName="app-magnify" style="font-size: 16px"></AppIcon>
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- Codemirror 弹出层 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="$t('views.functionLib.functionForm.form.param.code')"
|
||||
append-to-body
|
||||
fullscreen
|
||||
>
|
||||
<Codemirror
|
||||
v-model="cloneContent"
|
||||
:extensions="extensions"
|
||||
:style="codemirrorStyle"
|
||||
:tab-size="4"
|
||||
:autofocus="true"
|
||||
style="
|
||||
height: calc(100vh - 160px) !important;
|
||||
border: 1px solid #bbbfc4;
|
||||
border-radius: 4px;
|
||||
"
|
||||
/>
|
||||
<template #footer>
|
||||
<div class="dialog-footer mt-24">
|
||||
<el-button type="primary" @click="submitDialog"> {{ $t('common.confirm') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { Codemirror } from 'vue-codemirror'
|
||||
import { python } from '@codemirror/lang-python'
|
||||
import { oneDark } from '@codemirror/theme-one-dark'
|
||||
|
|
@ -19,6 +53,19 @@ import FunctionApi from '@/api/function-lib'
|
|||
|
||||
defineOptions({ name: 'CodemirrorEditor' })
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: any
|
||||
}>()
|
||||
const emit = defineEmits(['update:modelValue', 'submitDialog'])
|
||||
const data = computed({
|
||||
set: (value) => {
|
||||
emit('update:modelValue', value)
|
||||
},
|
||||
get: () => {
|
||||
return props.modelValue
|
||||
}
|
||||
})
|
||||
|
||||
function getRangeFromLineAndColumn(state: any, line: number, column: number, end_column?: number) {
|
||||
const l = state.doc.line(line)
|
||||
const form = l.from + column
|
||||
|
|
@ -52,9 +99,39 @@ const regexpLinter = linter(async (view) => {
|
|||
})
|
||||
const extensions = [python(), regexpLinter, oneDark]
|
||||
const codemirrorStyle = {
|
||||
height: '210px!important'
|
||||
height: '210px!important',
|
||||
width: '100%'
|
||||
}
|
||||
const cmRef = ref<InstanceType<typeof Codemirror>>()
|
||||
// 弹出框相关代码
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
||||
const cloneContent = ref<string>('')
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
emit('submitDialog', cloneContent.value)
|
||||
}
|
||||
})
|
||||
|
||||
const openCodemirrorDialog = () => {
|
||||
cloneContent.value = props.modelValue
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function submitDialog() {
|
||||
emit('submitDialog', cloneContent.value)
|
||||
dialogVisible.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
<style lang="scss" scoped>
|
||||
.codemirror-editor {
|
||||
position: relative;
|
||||
&__footer {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@
|
|||
<SyncWebDialog ref="SyncWebDialogRef" @refresh="refresh" />
|
||||
<!-- 选择知识库 -->
|
||||
<SelectDatasetDialog ref="SelectDatasetDialogRef" @refresh="refreshMigrate" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="getList" />
|
||||
</div>
|
||||
<div class="mul-operation w-full flex" v-if="multipleSelection.length !== 0">
|
||||
<el-button :disabled="multipleSelection.length === 0" @click="cancelTaskHandle(1)">
|
||||
|
|
|
|||
|
|
@ -133,13 +133,8 @@
|
|||
</el-text>
|
||||
</h4>
|
||||
|
||||
<div class="function-CodemirrorEditor mb-8" v-if="showEditor">
|
||||
<CodemirrorEditor v-model="form.code" />
|
||||
<div class="function-CodemirrorEditor__footer">
|
||||
<el-button text type="info" @click="openCodemirrorDialog" class="magnify">
|
||||
<AppIcon iconName="app-magnify" style="font-size: 16px"></AppIcon>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="mb-8" v-if="showEditor">
|
||||
<CodemirrorEditor v-model="form.code" @submitDialog="submitCodemirrorEditor" />
|
||||
</div>
|
||||
<h4 class="title-decoration-1 mb-16 mt-16">
|
||||
{{ $t('common.param.outputParam') }}
|
||||
|
|
@ -162,27 +157,6 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Codemirror 弹出层 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="$t('views.functionLib.functionForm.form.param.code')"
|
||||
append-to-body
|
||||
fullscreen
|
||||
>
|
||||
<CodemirrorEditor
|
||||
v-model="cloneContent"
|
||||
style="
|
||||
height: calc(100vh - 160px) !important;
|
||||
border: 1px solid #bbbfc4;
|
||||
border-radius: 4px;
|
||||
"
|
||||
/>
|
||||
<template #footer>
|
||||
<div class="dialog-footer mt-24">
|
||||
<el-button type="primary" @click="submitDialog"> {{ $t('common.confirm') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<FunctionDebugDrawer ref="FunctionDebugDrawerRef" />
|
||||
<FieldFormDialog ref="FieldFormDialogRef" @refresh="refreshFieldList" />
|
||||
</el-drawer>
|
||||
|
|
@ -223,9 +197,6 @@ const form = ref<functionLibData>({
|
|||
permission_type: 'PRIVATE'
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const cloneContent = ref<any>('')
|
||||
|
||||
watch(visible, (bool) => {
|
||||
if (!bool) {
|
||||
isEdit.value = false
|
||||
|
|
@ -259,14 +230,8 @@ const rules = reactive({
|
|||
]
|
||||
})
|
||||
|
||||
function openCodemirrorDialog() {
|
||||
cloneContent.value = form.value.code
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function submitDialog() {
|
||||
form.value.code = cloneContent.value
|
||||
dialogVisible.value = false
|
||||
function submitCodemirrorEditor(val: string) {
|
||||
form.value.code = val
|
||||
}
|
||||
|
||||
function close() {
|
||||
|
|
@ -353,13 +318,4 @@ defineExpose({
|
|||
open
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.function-CodemirrorEditor__footer {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
.function-CodemirrorEditor {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<AppAvatar shape="square">
|
||||
<AppAvatar shape="square" class="avatar-blue">
|
||||
<img src="@/assets/icon_assigner.svg" style="width: 65%" alt="" />
|
||||
</AppAvatar>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="flex-between mb-16">
|
||||
<h5 class="lighter">{{ $t('chat.userInput') }}</h5>
|
||||
<h5 class="lighter">{{ inputFieldConfig.title }}</h5>
|
||||
<div>
|
||||
<el-button type="primary" link @click="openChangeTitleDialog">
|
||||
<el-icon>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
:prop="'input_field_list.' + index + '.value'"
|
||||
:rules="{
|
||||
required: item.is_required,
|
||||
message: item.source === 'reference'
|
||||
message:
|
||||
item.source === 'reference'
|
||||
? $t('views.functionLib.functionForm.form.param.selectPlaceholder')
|
||||
: $t('views.functionLib.functionForm.form.param.inputPlaceholder'),
|
||||
trigger: 'blur'
|
||||
|
|
@ -76,17 +77,13 @@
|
|||
<h5 class="lighter mb-8">
|
||||
{{ $t('views.functionLib.functionForm.form.param.code') }}
|
||||
</h5>
|
||||
<div class="function-CodemirrorEditor mb-8" v-if="showEditor">
|
||||
<div class="mb-8" v-if="showEditor">
|
||||
<CodemirrorEditor
|
||||
v-model="chat_data.code"
|
||||
@wheel="wheel"
|
||||
style="height: 130px !important"
|
||||
@submitDialog="submitCodemirrorEditor"
|
||||
/>
|
||||
<div class="function-CodemirrorEditor__footer">
|
||||
<el-button text type="info" @click="openCodemirrorDialog" class="magnify">
|
||||
<AppIcon iconName="app-magnify" style="font-size: 16px"></AppIcon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-form-item
|
||||
|
|
@ -113,27 +110,6 @@
|
|||
</el-form-item>
|
||||
</el-form>
|
||||
<FieldFormDialog ref="FieldFormDialogRef" @refresh="refreshFieldList" />
|
||||
<!-- Codemirror 弹出层 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="$t('views.functionLib.functionForm.form.param.code')"
|
||||
append-to-body
|
||||
fullscreen
|
||||
>
|
||||
<CodemirrorEditor
|
||||
v-model="cloneContent"
|
||||
style="
|
||||
height: calc(100vh - 160px) !important;
|
||||
border: 1px solid #bbbfc4;
|
||||
border-radius: 4px;
|
||||
"
|
||||
/>
|
||||
<template #footer>
|
||||
<div class="dialog-footer mt-24">
|
||||
<el-button type="primary" @click="submitDialog"> {{ $t('common.confirm') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</NodeContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -190,17 +166,8 @@ const validate = () => {
|
|||
})
|
||||
}
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const cloneContent = ref('')
|
||||
|
||||
function openCodemirrorDialog() {
|
||||
cloneContent.value = chat_data.value.code
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function submitDialog() {
|
||||
set(props.nodeModel.properties.node_data, 'code', cloneContent.value)
|
||||
dialogVisible.value = false
|
||||
function submitCodemirrorEditor(val: string) {
|
||||
set(props.nodeModel.properties.node_data, 'code', val)
|
||||
}
|
||||
|
||||
function openAddDialog(data?: any, index?: any) {
|
||||
|
|
@ -244,13 +211,4 @@ onMounted(() => {
|
|||
}, 100)
|
||||
})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.function-CodemirrorEditor__footer {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
.function-CodemirrorEditor {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss"></style>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
require-asterisk-position="right"
|
||||
label-width="auto"
|
||||
ref="replyNodeFormRef"
|
||||
hide-required-asterisk
|
||||
>
|
||||
<template v-for="(item, index) in form_data.variable_list" :key="item.id">
|
||||
<el-card shadow="never" class="card-never mb-8" style="--el-card-padding: 12px">
|
||||
|
|
@ -17,7 +18,11 @@
|
|||
{{ $t('views.applicationWorkflow.variable.label') }}
|
||||
<span class="danger">*</span>
|
||||
</div>
|
||||
<el-button text @click="deleteVariable(index)" v-if="index !== 0">
|
||||
<el-button
|
||||
text
|
||||
@click="deleteVariable(index)"
|
||||
v-if="form_data.variable_list.length > 1"
|
||||
>
|
||||
<el-icon>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
|
|
@ -34,116 +39,102 @@
|
|||
@change="variableChange(item)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<div class="flex-between">
|
||||
<div>
|
||||
<span
|
||||
>{{ $t('views.applicationWorkflow.nodes.variableAssignNode.assign')
|
||||
}}<span class="danger">*</span></span
|
||||
>
|
||||
</div>
|
||||
<el-select
|
||||
:teleported="false"
|
||||
v-model="item.source"
|
||||
size="small"
|
||||
style="width: 85px"
|
||||
>
|
||||
<el-option
|
||||
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
|
||||
value="referencing"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.custom')"
|
||||
value="custom"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="item.source === 'custom'" class="flex">
|
||||
<el-row :gutter="8">
|
||||
<el-col :span="8">
|
||||
<el-select v-model="item.type" style="width: 85px">
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-form-item
|
||||
v-if="item.type === 'string'"
|
||||
:prop="'variable_list.' + index + '.value'"
|
||||
:rules="{
|
||||
message: t('dynamicsForm.tip.requiredMessage'),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
}"
|
||||
>
|
||||
<el-input
|
||||
class="ml-4"
|
||||
v-model="item.value"
|
||||
:placeholder="$t('common.inputPlaceholder')"
|
||||
show-word-limit
|
||||
clearable
|
||||
@wheel="wheel"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-else-if="item.type === 'num'"
|
||||
:prop="'variable_list.' + index + '.value'"
|
||||
:rules="{
|
||||
message: $t('common.inputPlaceholder'),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
}"
|
||||
>
|
||||
<el-input-number class="ml-4" v-model="item.value"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-else-if="item.type === 'json'"
|
||||
:prop="'variable_list.' + index + '.value'"
|
||||
:rules="[
|
||||
{
|
||||
message: $t('common.inputPlaceholder'),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
try {
|
||||
JSON.parse(value)
|
||||
callback() // Valid JSON
|
||||
} catch (e) {
|
||||
callback(new Error('Invalid JSON format'))
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]"
|
||||
>
|
||||
<el-input
|
||||
class="ml-4"
|
||||
v-model="item.value"
|
||||
:placeholder="$t('common.inputPlaceholder')"
|
||||
type="textarea"
|
||||
autosize
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<NodeCascader
|
||||
v-else
|
||||
ref="nodeCascaderRef2"
|
||||
:nodeModel="nodeModel"
|
||||
<div class="flex-between mb-8">
|
||||
<span class="lighter"
|
||||
>{{ $t('views.applicationWorkflow.nodes.variableAssignNode.assign')
|
||||
}}<span class="danger">*</span></span
|
||||
>
|
||||
<el-select :teleported="false" v-model="item.source" size="small" style="width: 85px">
|
||||
<el-option
|
||||
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
|
||||
value="referencing"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.custom')"
|
||||
value="custom"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div v-if="item.source === 'custom'" class="flex w-full">
|
||||
<el-select
|
||||
v-model="item.type"
|
||||
style="max-width: 85px"
|
||||
class="mr-8"
|
||||
@change="form_data.variable_list[index].value = null"
|
||||
>
|
||||
<el-option v-for="item in typeOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
|
||||
<el-form-item
|
||||
v-if="item.type === 'string'"
|
||||
:prop="'variable_list.' + index + '.value'"
|
||||
:rules="{
|
||||
message: t('common.inputPlaceholder'),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
}"
|
||||
>
|
||||
<el-input
|
||||
v-model="item.value"
|
||||
:placeholder="$t('common.inputPlaceholder')"
|
||||
show-word-limit
|
||||
clearable
|
||||
@wheel="wheel"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-else-if="item.type === 'num'"
|
||||
:prop="'variable_list.' + index + '.value'"
|
||||
:rules="{
|
||||
message: $t('common.inputPlaceholder'),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
}"
|
||||
>
|
||||
<el-input-number v-model="item.value"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
class="w-full"
|
||||
:placeholder="$t('views.applicationWorkflow.variable.placeholder')"
|
||||
v-model="item.reference"
|
||||
/>
|
||||
</el-form-item>
|
||||
v-else-if="item.type === 'json'"
|
||||
:prop="'variable_list.' + index + '.value'"
|
||||
:rules="[
|
||||
{
|
||||
message: $t('common.inputPlaceholder'),
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
try {
|
||||
JSON.parse(value)
|
||||
callback() // Valid JSON
|
||||
} catch (e) {
|
||||
callback(new Error('Invalid JSON format'))
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]"
|
||||
>
|
||||
<CodemirrorEditor
|
||||
v-model="item.value"
|
||||
:style="{
|
||||
height: '100px'
|
||||
}"
|
||||
@submitDialog="(val: string) => (form_data.variable_list[index].value = val)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<NodeCascader
|
||||
v-else
|
||||
ref="nodeCascaderRef2"
|
||||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
:placeholder="$t('views.applicationWorkflow.variable.placeholder')"
|
||||
v-model="item.reference"
|
||||
/>
|
||||
</el-card>
|
||||
</template>
|
||||
<el-button link type="primary" @click="addVariable">
|
||||
|
|
@ -212,6 +203,7 @@ function submitDialog(val: string) {
|
|||
const replyNodeFormRef = ref()
|
||||
const nodeCascaderRef = ref()
|
||||
const nodeCascaderRef2 = ref()
|
||||
|
||||
const validate = async () => {
|
||||
// console.log(replyNodeFormRef.value.validate())
|
||||
let ps = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue