Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/maxkb/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def get_admin_path(self):
def get_chat_path(self):
return self.get('CHAT_PATH', '/chat')

def get_default_execute_condition(self):
val = self.get('DEFAULT_EXECUTE_CONDITION', 'AND')
return 'OR' if val.upper() == 'OR' else 'AND'

def get_session_timeout(self):
return int(self.get('SESSION_TIMEOUT', 28800))

Expand Down
6 changes: 4 additions & 2 deletions apps/maxkb/urls/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ def page_not_found(request, exception):
if not os.path.exists(index_path):
return HttpResponse("页面不存在", status=404)
content = get_index_html(index_path)
content = content.replace("prefix: '/admin'", f"prefix: '{CONFIG.get_admin_path()}'").replace(
"chatPrefix: '/chat'", f"chatPrefix: '{CONFIG.get_chat_path()}'")
content = content.replace(
"prefix: '/admin'", f"prefix: '{CONFIG.get_admin_path()}'").replace(
"chatPrefix: '/chat'", f"chatPrefix: '{CONFIG.get_chat_path()}'").replace(
"defaultExecuteCondition: 'AND'", f"defaultExecuteCondition: '{CONFIG.get_default_execute_condition()}'")
return HttpResponse(content, status=200)
else:
return HttpResponseRedirect(admin_ui_prefix + '/')
Expand Down
1 change: 1 addition & 0 deletions ui/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
window.MaxKB = {
prefix: '/admin',
chatPrefix: '/chat',
defaultExecuteCondition: 'AND',
}
})()
</script>
Expand Down
1 change: 1 addition & 0 deletions ui/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ interface Window {
MaxKB: {
prefix: string
chatPrefix: string
defaultExecuteCondition: string
}
}
10 changes: 5 additions & 5 deletions ui/src/workflow/common/NodeContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
placement="bottom-start"
>
<el-button text>
<img src="@/assets/workflow/icon_or.svg" alt="" v-if="condition === 'OR'" />
<img src="@/assets/workflow/icon_and.svg" alt="" v-if="condition === 'AND'" />
<img src="@/assets/workflow/icon_or.svg" alt="" v-if="executeCondition === 'OR'" />
<img src="@/assets/workflow/icon_and.svg" alt="" v-if="executeCondition === 'AND'" />
</el-button>
<template #dropdown>
<div style="width: 280px" class="p-12-16">
<h5>{{ $t('workflow.condition.title') }}</h5>
<p class="mt-8 lighter">
<span>{{ $t('workflow.condition.front') }}</span>
<el-select v-model="condition" size="small" style="width: 60px; margin: 0 8px">
<el-select v-model="executeCondition" size="small" style="width: 60px; margin: 0 8px">
<el-option :label="$t('workflow.condition.AND')" value="AND" />
<el-option :label="$t('workflow.condition.OR')" value="OR" />
</el-select>
Expand Down Expand Up @@ -245,15 +245,15 @@ const form = ref<any>({
title: '',
})

const condition = computed({
const executeCondition = computed({
set: (v) => {
set(props.nodeModel.properties, 'condition', v)
},
get: () => {
if (props.nodeModel.properties.condition) {
return props.nodeModel.properties.condition
}
set(props.nodeModel.properties, 'condition', 'AND')
set(props.nodeModel.properties, 'condition', window.MaxKB.defaultExecuteCondition || 'AND')
return true
},
})
Expand Down
Loading