Skip to content

Commit c9eb84f

Browse files
committed
feat: Workflow menu that distinguishes between applications and knowledge bases
1 parent 1622d06 commit c9eb84f

File tree

15 files changed

+54
-16
lines changed

15 files changed

+54
-16
lines changed

apps/application/flow/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def get_next_nodes(self, node_id) -> List[Node]:
181181
return [en.node for en in self.next_node_map.get(node_id, [])]
182182

183183
@staticmethod
184-
def new_instance(flow_obj: Dict, workflow_mode: WorkflowMode = WorkflowMode.APPLICATION.value):
184+
def new_instance(flow_obj: Dict, workflow_mode: WorkflowMode = WorkflowMode.APPLICATION):
185185
nodes = flow_obj.get('nodes')
186186
edges = flow_obj.get('edges')
187187
nodes = [Node(node.get('id'), node.get('type'), **node)

apps/application/flow/i_step_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def handler(self, workflow):
7979
message_tokens=message_tokens,
8080
answer_tokens=answer_tokens,
8181
answer_text_list=answer_text_list,
82-
run_time=time.time() - workflow.context['start_time'],
82+
run_time=time.time() - workflow.context.get('start_time') if workflow.context.get('start_time') is not None else 0,
8383
index=0)
8484

8585
self.chat_info.append_chat_record(chat_record)

ui/src/views/application-workflow/component/NodeContent.vue renamed to ui/src/components/dropdown_menu/application/NodeContent.vue

File renamed without changes.

ui/src/views/application-workflow/component/DropdownMenu.vue renamed to ui/src/components/dropdown_menu/application/index.vue

File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<component :is="kw[workflow_mode]" :show="show" :id="id" :workflow-ref="workflowRef"></component>
3+
</template>
4+
<script setup lang="ts">
5+
import { inject } from 'vue'
6+
import { WorkflowMode } from '@/enums/application'
7+
import ApplicationDropdownMenu from '@/components/dropdown_menu/application/index.vue'
8+
import KnowledgeDropdownMenu from '@/components/dropdown_menu/knowledge/index.vue'
9+
const workflow_mode = inject('workflowMode') || WorkflowMode.Application
10+
defineProps({
11+
show: {
12+
type: Boolean,
13+
default: false,
14+
},
15+
id: {
16+
type: String,
17+
default: '',
18+
},
19+
workflowRef: Object,
20+
})
21+
const kw: any = {
22+
[WorkflowMode.Application]: ApplicationDropdownMenu,
23+
[WorkflowMode.Knowledge]: KnowledgeDropdownMenu,
24+
}
25+
</script>
26+
<style lang="scss" scoped></style>

ui/src/views/knowledge-workflow/component/NodeContent.vue renamed to ui/src/components/dropdown_menu/knowledge/NodeContent.vue

File renamed without changes.

ui/src/views/knowledge-workflow/component/DropdownMenu.vue renamed to ui/src/components/dropdown_menu/knowledge/index.vue

File renamed without changes.

ui/src/views/application-workflow/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ import { ref, onMounted, onBeforeUnmount, computed, nextTick, provide } from 'vu
145145
import { useRouter, useRoute } from 'vue-router'
146146
import type { Action } from 'element-plus'
147147
import Workflow from '@/workflow/index.vue'
148-
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
148+
import DropdownMenu from '@/components/dropdown_menu/index.vue'
149149
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
150150
import { isAppIcon, resetUrl } from '@/utils/common'
151151
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'

ui/src/views/knowledge-workflow/index.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ import { ref, onBeforeMount, onBeforeUnmount, computed, nextTick, provide } from
142142
import { useRouter, useRoute } from 'vue-router'
143143
import type { Action } from 'element-plus'
144144
import Workflow from '@/workflow/index.vue'
145-
import DropdownMenu from '@/views/knowledge-workflow/component/DropdownMenu.vue'
145+
import DropdownMenu from '@/components/dropdown_menu/index.vue'
146146
import PublishHistory from '@/views/knowledge-workflow/component/PublishHistory.vue'
147147
import { isAppIcon, resetUrl } from '@/utils/common'
148148
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
@@ -395,7 +395,6 @@ const clickShowDebug = () => {
395395
}
396396
DebugRef.value?.open(graphData, id)
397397
} catch (e: any) {
398-
console.log(e)
399398
MsgError(e.toString())
400399
}
401400
})

ui/src/workflow/common/NodeContainer.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@
172172
</div>
173173
</template>
174174
<script setup lang="ts">
175-
import { ref, computed, onMounted } from 'vue'
176-
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
175+
import { ref, computed, onMounted, inject } from 'vue'
177176
import { set } from 'lodash'
178177
import { iconComponent } from '../icons/utils'
179178
import { copyClick } from '@/utils/clipboard'
@@ -182,6 +181,9 @@ import { MsgError, MsgConfirm } from '@/utils/message'
182181
import type { FormInstance } from 'element-plus'
183182
import { t } from '@/locales'
184183
import { useRoute } from 'vue-router'
184+
import DropdownMenu from '@/components/dropdown_menu/index.vue'
185+
const w = inject('workflowMode')
186+
console.log(w)
185187
const route = useRoute()
186188
const {
187189
params: { id },

0 commit comments

Comments
 (0)