2025-10-29 10:22:14 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import SvgIcon from '@/components/SvgIcon/index.vue'
|
|
|
|
|
import { getAgentMapIcon } from '@/layout/components/config.ts'
|
2025-11-04 15:26:52 +08:00
|
|
|
import { type ConnectArg, Jsplumb } from '@/layout/components/Main/TaskTemplate/utils.ts'
|
2025-10-29 10:22:14 +08:00
|
|
|
import { type IRawStepTask, useAgentsStore } from '@/stores'
|
|
|
|
|
import { computed } from 'vue'
|
|
|
|
|
import { AnchorLocations } from '@jsplumb/browser-ui'
|
2025-11-04 15:26:52 +08:00
|
|
|
import MultiLineTooltip from '@/components/MultiLineTooltip/index.vue'
|
|
|
|
|
|
|
|
|
|
import Bg from './Bg.vue'
|
2025-10-29 10:22:14 +08:00
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
(el: 'resetAgentRepoLine'): void
|
|
|
|
|
(el: 'setCurrentTask', task: IRawStepTask): void
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const jsplumb = new Jsplumb('task-syllabus')
|
|
|
|
|
|
|
|
|
|
const handleScroll = () => {
|
|
|
|
|
emit('resetAgentRepoLine')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const agentsStore = useAgentsStore()
|
|
|
|
|
|
|
|
|
|
const collaborationProcess = computed(() => {
|
|
|
|
|
return agentsStore.agentRawPlan.data?.['Collaboration Process'] ?? []
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function handleCurrentTask(task: IRawStepTask, transparent: boolean): ConnectArg[] {
|
|
|
|
|
// 创建当前流程与产出的连线
|
|
|
|
|
const arr: ConnectArg[] = [
|
|
|
|
|
{
|
|
|
|
|
sourceId: `task-syllabus-flow-${task.Id}`,
|
|
|
|
|
targetId: `task-syllabus-output-object-${task.Id}`,
|
|
|
|
|
anchor: [AnchorLocations.Right, AnchorLocations.Left],
|
|
|
|
|
config: {
|
|
|
|
|
transparent,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// 创建当前产出与流程的连线
|
|
|
|
|
task.InputObject_List?.forEach((item) => {
|
|
|
|
|
const id = collaborationProcess.value.find((i) => i.OutputObject === item)?.Id
|
|
|
|
|
if (id) {
|
|
|
|
|
arr.push({
|
|
|
|
|
sourceId: `task-syllabus-output-object-${id}`,
|
|
|
|
|
targetId: `task-syllabus-flow-${task.Id}`,
|
|
|
|
|
anchor: [AnchorLocations.Left, AnchorLocations.Right],
|
|
|
|
|
config: {
|
|
|
|
|
type: 'output',
|
|
|
|
|
transparent,
|
2025-11-04 15:26:52 +08:00
|
|
|
},
|
2025-10-29 10:22:14 +08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return arr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changeTask(task?: IRawStepTask, isEmit?: boolean) {
|
|
|
|
|
jsplumb.reset()
|
|
|
|
|
const arr: ConnectArg[] = []
|
|
|
|
|
agentsStore.agentRawPlan.data?.['Collaboration Process']?.forEach((item) => {
|
|
|
|
|
arr.push(...handleCurrentTask(item, item.Id !== task?.Id))
|
|
|
|
|
})
|
|
|
|
|
jsplumb.connects(arr)
|
|
|
|
|
if (isEmit && task) {
|
|
|
|
|
emit('setCurrentTask', task)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-31 18:42:31 +08:00
|
|
|
function clear() {
|
|
|
|
|
jsplumb.reset()
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 10:22:14 +08:00
|
|
|
defineExpose({
|
|
|
|
|
changeTask,
|
2025-10-31 18:42:31 +08:00
|
|
|
clear,
|
2025-10-29 10:22:14 +08:00
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="h-full flex flex-col">
|
|
|
|
|
<div class="text-[18px] font-bold mb-[18px]">任务大纲</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
v-loading="agentsStore.agentRawPlan.loading"
|
|
|
|
|
class="flex-1 w-full overflow-y-auto relative"
|
|
|
|
|
@scroll="handleScroll"
|
|
|
|
|
>
|
2025-11-04 15:26:52 +08:00
|
|
|
<div v-show="collaborationProcess.length > 0" class="w-full relative min-h-full" id="task-syllabus">
|
|
|
|
|
<Bg />
|
|
|
|
|
|
|
|
|
|
<div class="w-full flex items-center gap-[14%] mb-[35px]">
|
|
|
|
|
<div class="flex-1 flex justify-center">
|
2025-10-29 10:22:14 +08:00
|
|
|
<div
|
|
|
|
|
class="card-item w-[45%] h-[41px] flex justify-center relative z-99 items-center rounded-[20px] bg-[var(--color-bg-tertiary)]"
|
|
|
|
|
>
|
|
|
|
|
流程
|
|
|
|
|
</div>
|
2025-11-04 15:26:52 +08:00
|
|
|
</div>
|
2025-10-29 10:22:14 +08:00
|
|
|
|
2025-11-04 15:26:52 +08:00
|
|
|
<div class="flex-1 flex justify-center">
|
|
|
|
|
<div
|
|
|
|
|
class="card-item w-[45%] h-[41px] flex justify-center relative z-99 items-center rounded-[20px] bg-[var(--color-bg-tertiary)]"
|
2025-10-29 10:22:14 +08:00
|
|
|
>
|
2025-11-04 15:26:52 +08:00
|
|
|
产物
|
|
|
|
|
</div>
|
2025-10-29 10:22:14 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-11-04 15:26:52 +08:00
|
|
|
|
2025-10-29 10:22:14 +08:00
|
|
|
<div
|
2025-11-04 15:26:52 +08:00
|
|
|
v-for="item in collaborationProcess"
|
|
|
|
|
:key="item.Id"
|
|
|
|
|
class="card-item w-full flex items-center gap-[14%]"
|
2025-10-29 10:22:14 +08:00
|
|
|
>
|
2025-11-04 15:26:52 +08:00
|
|
|
<!-- 流程卡片 -->
|
|
|
|
|
<el-card
|
|
|
|
|
class="w-[43%] overflow-y-auto relative z-99 task-syllabus-flow-card"
|
|
|
|
|
:class="agentsStore.currentTask?.StepName === item.StepName ? 'active-card' : ''"
|
|
|
|
|
shadow="hover"
|
|
|
|
|
:id="`task-syllabus-flow-${item.Id}`"
|
|
|
|
|
@click="changeTask(item, true)"
|
|
|
|
|
>
|
|
|
|
|
<MultiLineTooltip placement="right" :text="item.StepName" :lines="2">
|
|
|
|
|
<div class="text-[18px] font-bold text-center">
|
|
|
|
|
{{ item.StepName }}
|
2025-10-29 10:22:14 +08:00
|
|
|
</div>
|
2025-11-04 15:26:52 +08:00
|
|
|
</MultiLineTooltip>
|
|
|
|
|
<div class="h-[1px] w-full bg-[#494B51] my-[8px]"></div>
|
|
|
|
|
<MultiLineTooltip placement="right" :text="item.StepName" :lines="3">
|
2025-10-29 10:22:14 +08:00
|
|
|
<div
|
2025-11-04 15:26:52 +08:00
|
|
|
class="text-[14px] text-[var(--color-text-secondary)]"
|
|
|
|
|
:title="item.TaskContent"
|
2025-10-29 10:22:14 +08:00
|
|
|
>
|
2025-11-04 15:26:52 +08:00
|
|
|
{{ item.TaskContent }}
|
2025-10-29 10:22:14 +08:00
|
|
|
</div>
|
2025-11-04 15:26:52 +08:00
|
|
|
</MultiLineTooltip>
|
|
|
|
|
<div class="h-[1px] w-full bg-[#494B51] my-[8px]"></div>
|
|
|
|
|
<div
|
|
|
|
|
class="flex items-center gap-2 overflow-y-auto flex-wrap relative w-full max-h-[72px]"
|
|
|
|
|
>
|
|
|
|
|
<!-- 连接到智能体库的连接点 -->
|
2025-10-29 10:22:14 +08:00
|
|
|
<div
|
2025-11-04 15:26:52 +08:00
|
|
|
class="absolute left-[-10px] top-1/2 transform -translate-y-1/2"
|
|
|
|
|
:id="`task-syllabus-flow-agents-${item.Id}`"
|
|
|
|
|
></div>
|
|
|
|
|
<el-tooltip
|
|
|
|
|
v-for="agentSelection in item.AgentSelection"
|
|
|
|
|
:key="agentSelection"
|
|
|
|
|
effect="light"
|
|
|
|
|
placement="right"
|
2025-10-29 10:22:14 +08:00
|
|
|
>
|
2025-11-04 15:26:52 +08:00
|
|
|
<template #content>
|
|
|
|
|
<div class="w-[150px]">
|
|
|
|
|
<div class="text-[18px] font-bold">{{ agentSelection }}</div>
|
|
|
|
|
<div class="h-[1px] w-full bg-[#494B51] my-[8px]"></div>
|
|
|
|
|
<div>
|
|
|
|
|
{{
|
|
|
|
|
item.TaskProcess.find((i) => i.AgentName === agentSelection)?.Description
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<div
|
|
|
|
|
class="w-[31px] h-[31px] rounded-full flex items-center justify-center"
|
|
|
|
|
:style="{ background: getAgentMapIcon(agentSelection).color }"
|
2025-10-29 10:22:14 +08:00
|
|
|
>
|
2025-11-04 15:26:52 +08:00
|
|
|
<svg-icon
|
|
|
|
|
:icon-class="getAgentMapIcon(agentSelection).icon"
|
|
|
|
|
color="var(--color-text)"
|
|
|
|
|
size="24px"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-tooltip>
|
2025-10-29 10:22:14 +08:00
|
|
|
</div>
|
2025-11-04 15:26:52 +08:00
|
|
|
</el-card>
|
|
|
|
|
<!-- 产物卡片 -->
|
|
|
|
|
<el-card
|
|
|
|
|
class="w-[43%] relative"
|
|
|
|
|
shadow="hover"
|
|
|
|
|
:class="agentsStore.currentTask?.StepName === item.StepName ? 'active-card' : ''"
|
|
|
|
|
:id="`task-syllabus-output-object-${item.Id}`"
|
|
|
|
|
>
|
|
|
|
|
<div class="text-[18px] font-bold text-center">{{ item.OutputObject }}</div>
|
|
|
|
|
</el-card>
|
2025-10-29 10:22:14 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2025-11-04 15:26:52 +08:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.task-syllabus-flow-card {
|
|
|
|
|
:deep(.el-card__body) {
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
overflow: auto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|