diff --git a/src/components/dialoguePanel/DialogueFlow.vue b/src/components/dialoguePanel/DialogueFlow.vue index 8ad097e57d8f72956fefd4409d7e06138b629aa5..0aec7d17d43a35ad3f06f198d20b9d7c260acd2c 100644 --- a/src/components/dialoguePanel/DialogueFlow.vue +++ b/src/components/dialoguePanel/DialogueFlow.vue @@ -1,19 +1,25 @@ diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 751cf80ef3b5764c916bc3712044316f11166251..e50b9f4ba26437de2a1e5e5afab5c1c7cd80a8a8 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -469,7 +469,7 @@ const handleSendMessage = async (question, user_selected_flow, user_selected_app
- +
补充参数 @@ -1152,6 +1152,76 @@ const handleSendMessage = async (question, user_selected_flow, user_selected_app padding-left: 64px; .dialogue-panel__robot-content { border-radius: 8px; + // 工作流调试时控制显示 + .dialogue-thought { + // ai思考无需显示 + display: none; + } + ::v-deep(.demo-collapse) { + border-radius: 4px; + .title.el-collapse-item { + .loading-text { + display: flex; + text-align: left; + align-items: center; + .textTitle { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .totalTime { + min-width: 54px; + width: fit-content; + padding: 0px 8px; + height: 16px; + line-height: 16px; + font-size: 12px; + border-radius: 4px; + } + .totalTime.errorBg { + background-color: rgba(227, 32, 32, 0.2); + } + } + } + .normal.el-collapse-item { + border-bottom: 1px dashed #dfe5ef; + .el-collapse-item__header { + background-color: var(--o-bg-color-base) !important; + color: var(--o-text-color-primary); + padding-right: 0px; + .o-collapse-icon { + width: 16px; + height: 16px; + } + .title { + flex: 1; + text-align: left; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .time { + min-width: 54px; + width: fit-content; + padding: 0px 8px; + height: 16px; + line-height: 16px; + border-radius: 4px; + font-size: 12px; + } + &::after { + background-color: transparent; + } + } + &:last-child { + border-bottom: 1px solid transparent; + } + } + .el-collapse-item__content { + margin:0px 16px; + } + } // 调试抽屉中echarts无需显示 .answer_img { display: none; diff --git a/src/store/conversation.ts b/src/store/conversation.ts index a962de852ee8b3a308ca09c1f016f929d17ba275..9057a9defb5afe9553276dfca69662f4a1a6f5a5 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -314,6 +314,8 @@ export const useSessionStore = defineStore('conversation', () => { if (target) { target.data.output = message.content target.status = message.flow?.stepStatus; + // 工作流添加每阶段的时间耗时 + target['costTime'] = message.time_cost; if(message.flow.step_status === "error"){ conversationItem.flowdata.status = message.flow?.stepStatus; } @@ -322,7 +324,17 @@ export const useSessionStore = defineStore('conversation', () => { else if(message["event"] === "flow.stop") { //时间流结束 let flow = message.content.flow; - if(message.content.type !== "schema"){ + if (params.type) { + // 如果是工作流的调试功能-添加status/data + conversationItem.flowdata = { + id: flow?.stepName, + title: i18n.global.t('flow.flow_end'), + progress: flow?.stepProgress, + status: message.flow?.stepStatus, + display:true, + data:conversationItem?.flowdata?.data, + }; + }else if(message.content.type !== "schema"){ conversationItem.flowdata?.data[0].push({ id:"end", title:"end", diff --git a/src/views/app/index.vue b/src/views/app/index.vue index 5d2fece6ed750958760cfee80d9524673817ac38..f7d212a5443bc082ce4cc4e14ffc9b964df91648 100644 --- a/src/views/app/index.vue +++ b/src/views/app/index.vue @@ -136,7 +136,7 @@ const handleCreateApp = () => { }; const routerToDetail = appItem => { - if (!appItem.published && appType.value === 'createdByMe') { + if (!appItem.published) { return; } //获取appItem.id & appItem.name diff --git a/src/views/createapp/components/codeMirror/nodeMirrorText.vue b/src/views/createapp/components/codeMirror/nodeMirrorText.vue index a9a24d1511d396730c97f72d883fb38487b58bc9..e72724d1645cbb8f87735f7707b19e0e9ca64ae1 100644 --- a/src/views/createapp/components/codeMirror/nodeMirrorText.vue +++ b/src/views/createapp/components/codeMirror/nodeMirrorText.vue @@ -36,6 +36,7 @@ import { useChangeThemeStore } from 'src/store/conversation'; import yaml from 'js-yaml'; import { writeText } from 'src/utils'; import { errorMsg, successMsg } from 'src/components/Message'; +import { StatusInfoTitle } from '../types'; const props = defineProps({ status: { default: 'default', @@ -69,19 +70,12 @@ const resultInfo = ref({ ], }); -const statusInfoTitle = ref({ - default: '', - success: '运行成功', - error: '运行失败', - running: '运行中', -}); - watch( () => props, () => { resultInfo.value.status = props.status; // 目前props.status只有success、error、running三种 - resultInfo.value.infoList[0].title = statusInfoTitle.value[props.status]; + resultInfo.value.infoList[0].title = StatusInfoTitle[props.status]; if (props?.inputAndOutput) { resultInfo.value.time = props.inputAndOutput.input_parameters.timeout ?? 0; @@ -104,7 +98,7 @@ const handleCopy = code => { errorMsg('无可复制的信息'); return; } - writeText(code); + writeText(yaml.dump(code)); successMsg('复制成功'); }; @@ -157,14 +151,6 @@ const handleCopy = code => { padding: 0px 8px; border-radius: 4px; } - .successBg { - background-color: rgba(36, 171, 54, 0.2); - color: #24ab36; - } - .errorBg { - background-color: #fbdede; - color: #e32020; - } .flexRight { margin-left: auto; margin-right: -4px; diff --git a/src/views/createapp/components/types.ts b/src/views/createapp/components/types.ts index cfa0953e73fa67586e762ddf4b98b635eee1c46a..331915297f8a13960c722246574a7b6fae0781bf 100644 --- a/src/views/createapp/components/types.ts +++ b/src/views/createapp/components/types.ts @@ -17,6 +17,14 @@ export enum BranchSourceIdType { SOURCEB = "source_b", } +export const StatusInfoTitle = { + default: '', + success: '运行成功', + error: '运行失败', + running: '运行中', + pending: '运行中', +}; + export interface LinkItem { key: string; label: string; diff --git a/src/views/createapp/components/workFlow.vue b/src/views/createapp/components/workFlow.vue index 344e332fce80429bbd9d6c6fc939913372f43ac1..e684e122c07cb258dfe63661611a100760fe7726 100644 --- a/src/views/createapp/components/workFlow.vue +++ b/src/views/createapp/components/workFlow.vue @@ -18,7 +18,7 @@ import { useLayout } from './workFlowConfig/useLayout'; import { IconSearch, IconCaretRight, IconCaretDown, IconPlusCircle } from '@computing/opendesign-icons'; import EditYamlDrawer from './workFlowConfig/yamlEditDrawer.vue'; import { api } from 'src/apis'; -import { BranchSourceIdType } from './types'; +import { BranchSourceIdType, StatusInfoTitle } from './types'; import { useRoute } from 'vue-router'; import yaml from 'js-yaml'; import $bus from 'src/bus/index'; @@ -48,7 +48,9 @@ const workFlowList = ref([]); const props = defineProps(['flowList']); const flowObj = ref({}); const nodes = ref([]); -const debugResult = ref('success'); +const debugResult = ref(''); +const debugTime = ref(''); +const totalTime = ref(0); const hanleAsideVisible = () => { if (!copilotAside.value) return; if (isCopilotAsideVisible.value) { @@ -264,8 +266,10 @@ const searchApiList = () => { }); }; -const handleDebugDialogOps = visible => { +const handleDebugDialogOps = (visible) => { debugDialogVisible.value = visible; + // 调试弹窗关闭时---结果清空 + debugResult.value = ''; }; const edgesChange = edges => { @@ -329,7 +333,6 @@ const queryFlow = (deal: string) => { }); } }; - // 点击编辑工作流--查询当前工作流数据-后续添加回显 const editFlow = item => { api @@ -424,11 +427,22 @@ $bus.on('getNodesStatue', lines => { const newLines = yaml.load(item); // step.input和step.output对应的节点状态需要修改 if (newLines?.data?.event === 'step.input' || newLines?.data?.event === 'step.output') { - if (newLines?.data?.flow?.stepId) { // output-节点运行结束时,获取节点运行的耗时 - const constTime = newLines.data.event === 'step.output' ? `${newLines.data?.time_cost?.toFixed(3)}s` : ''; + let constTime = ''; + if (newLines.data.event === 'step.output') { + totalTime.value += newLines.data?.time_cost; + constTime = `${newLines.data?.time_cost?.toFixed(3)}s` + } updateNodeFunc(newLines.data.flow.stepId, newLines.data.flow?.stepStatus, constTime); - } + } else if (newLines?.data?.event === 'flow.stop') { + debugResult.value = newLines.data.flow?.stepStatus; + debugTime.value = `${totalTime.value.toFixed(3)}s` + } else if (newLines?.data?.event === 'flow.start'){ + totalTime.value = 0; + debugTime.value = ''; + debugResult.value = newLines.data.flow?.stepStatus; + } else { + // do nothing } }); } catch (error) { @@ -711,10 +725,11 @@ defineExpose({
- @@ -765,7 +780,7 @@ defineExpose({ background: url(@/assets/images/flow_fail.png) center center no-repeat; } - .runningIcon { + .runningIcon, .pendingIcon { background: url(@/assets/images/loading.png) center center no-repeat; } .time { @@ -774,14 +789,6 @@ defineExpose({ padding: 0px 8px; border-radius: 4px; } - .successBg { - background-color: rgba(36, 171, 54, 0.2); - color: #24ab36; - } - .errorBg { - background-color: #fbdede; - color: #e32020; - } .flexRight { margin-left: auto; margin-right: -4px; diff --git a/src/views/createapp/components/workFlowConfig/BranchNode.vue b/src/views/createapp/components/workFlowConfig/BranchNode.vue index 96dcb3834d852a7ae91d2d0b8734c47be618e118..318542c0e461b8ce5dc946bdc0278bcc15ba11ab 100644 --- a/src/views/createapp/components/workFlowConfig/BranchNode.vue +++ b/src/views/createapp/components/workFlowConfig/BranchNode.vue @@ -23,7 +23,7 @@ const props = defineProps({ }); const emits = defineEmits(['delNode', 'editYamlDrawer']); -const statusList = ref(['pending', 'success', 'error']); +const statusList = ref(['running', 'success', 'error']); const branchIdList = ref([]); diff --git a/src/views/createapp/components/workFlowConfig/CustomSaENode.vue b/src/views/createapp/components/workFlowConfig/CustomSaENode.vue index 45722b452e7ecfeacd879aea4ed14a4fc1ce410d..17902c51409abf3895f98d83a1d79c643d4f2f14 100644 --- a/src/views/createapp/components/workFlowConfig/CustomSaENode.vue +++ b/src/views/createapp/components/workFlowConfig/CustomSaENode.vue @@ -24,7 +24,7 @@ const props = defineProps({ }, }); -const statusList = ref(['waiting', 'success', 'error', 'default']); +const statusList = ref(['running', 'success', 'error']); const curStatus = ref(''); diff --git a/src/views/createapp/components/workFlowDebug.vue b/src/views/createapp/components/workFlowDebug.vue index 9e94fd98aee6fb8a0b2feba4a05890362e0b2f9e..0abe33694adab864c9f89f5f586e88c71effecdd 100644 --- a/src/views/createapp/components/workFlowDebug.vue +++ b/src/views/createapp/components/workFlowDebug.vue @@ -6,7 +6,7 @@
-
+
(''); - /** * * @param item @@ -134,6 +137,31 @@ const handleKeydown = (event: KeyboardEvent) => { }; const handleCloseDebugDialog = () => { + testFlag.value = false + delChat(); props.handleDebugDialogOps(false); }; + +// 关闭或者跳转前需要将会话删除 +const delChat = async () => { + if (!currentSelectedSession.value) { + // 如果还没生成会话Id, 无需调用接口删除 + return; + } else { + // 调用接口,删除当前对话 + const res = await api.deleteSession({ conversationList: [currentSelectedSession.value] }); + if (res[1]?.result) { + // 删除成功 + conversationList.value = []; + selectedSessionIds.value = []; + currentSelectedSession.value = ''; + historySession.value = [];= + } + } +} + +onBeforeRouteLeave((to, from ,next) => { + handleCloseDebugDialog(); + next(); +}) diff --git a/src/views/createapp/index.vue b/src/views/createapp/index.vue index e21a2938e0a26a1583165eb82c589560bc8a52ad..7f46c0a2ccea7108bab09ec7fce872f2c9f95d13 100644 --- a/src/views/createapp/index.vue +++ b/src/views/createapp/index.vue @@ -139,7 +139,7 @@ const handleJumperAppCenter = () => {
- 取消 + 取消 保存 预览 发布 diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index ee8decb1234d446fb671c7d2b6f9adebf0ea6c60..d96e75918565bf5d4e271d9e6dcea2f8a755f816 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -411,6 +411,7 @@ const isAllowToSend = computed(() => { // 会话切换时 watch(currentSelectedSession, async newVal => { + if (!newVal) return; const newExistList = existUploadMap.get(newVal); const newFileView = uploadViewsMap.get(newVal); let curPolling = pollingMap.get(newVal); diff --git a/src/views/styles/createApp.scss b/src/views/styles/createApp.scss index b737cb89bcd65ae78ca84b09c58cd2ef2437176f..c0ee53ea7401b6e5071dcdf93bcb95c0e7362be7 100644 --- a/src/views/styles/createApp.scss +++ b/src/views/styles/createApp.scss @@ -337,6 +337,15 @@ border-color: var(--o-color-primary) !important; color: var(--o-color-white) !important; } + // 成功失败样式 + .successBg { + background-color: rgba(36, 171, 54, 0.2); + color: #24ab36; + } + .errorBg { + background-color: #fbdede; + color: #e32020; + } } .w320 {