feat:修改任务过程大纲探索后端返回不符合用户要求的bug
This commit is contained in:
@@ -99,7 +99,7 @@ class Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分支任务大纲(根节点级别)
|
// 分支任务大纲
|
||||||
branchPlanOutline = (data: {
|
branchPlanOutline = (data: {
|
||||||
branch_Number: number
|
branch_Number: number
|
||||||
Modification_Requirement: string
|
Modification_Requirement: string
|
||||||
@@ -126,7 +126,7 @@ class Api {
|
|||||||
branchTaskProcess = (data: {
|
branchTaskProcess = (data: {
|
||||||
branch_Number: number
|
branch_Number: number
|
||||||
Modification_Requirement: string
|
Modification_Requirement: string
|
||||||
Existing_Steps: string[]
|
Existing_Steps: BranchAction[]
|
||||||
Baseline_Completion: number
|
Baseline_Completion: number
|
||||||
stepTaskExisting: any
|
stepTaskExisting: any
|
||||||
goal: string
|
goal: string
|
||||||
@@ -566,7 +566,7 @@ class Api {
|
|||||||
mockBranchTaskProcess = async (data: {
|
mockBranchTaskProcess = async (data: {
|
||||||
branch_Number: number
|
branch_Number: number
|
||||||
Modification_Requirement: string
|
Modification_Requirement: string
|
||||||
Existing_Steps: string[]
|
Existing_Steps: BranchAction[]
|
||||||
Baseline_Completion: number
|
Baseline_Completion: number
|
||||||
stepTaskExisting: any
|
stepTaskExisting: any
|
||||||
goal: string
|
goal: string
|
||||||
|
|||||||
@@ -268,8 +268,6 @@ const initializeFlow = () => {
|
|||||||
const branchesInitialized = sessionStorage.getItem(branchesInitKey) === 'true'
|
const branchesInitialized = sessionStorage.getItem(branchesInitKey) === 'true'
|
||||||
|
|
||||||
if (branchesInitialized && savedBranches.length > 0) {
|
if (branchesInitialized && savedBranches.length > 0) {
|
||||||
// ✅ 已有分支,完全从 store 恢复所有节点和边
|
|
||||||
// 🔑 关键:清空当前节点,完全从store恢复,确保初始流程节点位置和数据不变
|
|
||||||
nodes.value = []
|
nodes.value = []
|
||||||
edges.value = []
|
edges.value = []
|
||||||
|
|
||||||
@@ -703,6 +701,9 @@ const onNodeClick = (event: any) => {
|
|||||||
// 🆕 点击主流程节点时,从 store 读取"初始流程"分支的副本
|
// 🆕 点击主流程节点时,从 store 读取"初始流程"分支的副本
|
||||||
if (currentTask.value) {
|
if (currentTask.value) {
|
||||||
const taskStepId = currentTask.value.Id
|
const taskStepId = currentTask.value.Id
|
||||||
|
if (!taskStepId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const currentAgents = currentTask.value.AgentSelection || []
|
const currentAgents = currentTask.value.AgentSelection || []
|
||||||
const branches = selectionStore.getTaskProcessBranches(taskStepId, currentAgents)
|
const branches = selectionStore.getTaskProcessBranches(taskStepId, currentAgents)
|
||||||
const initialBranch = branches.find(branch => branch.branchContent === '初始流程')
|
const initialBranch = branches.find(branch => branch.branchContent === '初始流程')
|
||||||
@@ -806,16 +807,14 @@ const submitBranch = async () => {
|
|||||||
// 使用 Mock API
|
// 使用 Mock API
|
||||||
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
||||||
|
|
||||||
// 计算基线完成度
|
// 🆕 根节点分支:从零开始生成完整方案
|
||||||
const currentTaskProcess = taskProcess.value || []
|
// Baseline_Completion = 0 表示没有已完成的部分,需要生成所有阶段
|
||||||
const baselineCompletion = currentTaskProcess.length > 0 ? 0 : 100
|
// Existing_Steps 传空数组,不传递初始流程信息
|
||||||
|
|
||||||
// 调用 Mock API(返回 2D 数组,与后端格式一致)
|
|
||||||
const response = await api.mockBranchTaskProcess({
|
const response = await api.mockBranchTaskProcess({
|
||||||
branch_Number: 1,
|
branch_Number: 1,
|
||||||
Modification_Requirement: branchContent,
|
Modification_Requirement: branchContent,
|
||||||
Existing_Steps: [],
|
Existing_Steps: [], // ← 根节点分支不传递现有步骤
|
||||||
Baseline_Completion: baselineCompletion,
|
Baseline_Completion: 0, // ← 从零开始
|
||||||
stepTaskExisting: currentTask.value,
|
stepTaskExisting: currentTask.value,
|
||||||
goal: generalGoal
|
goal: generalGoal
|
||||||
})
|
})
|
||||||
@@ -843,15 +842,14 @@ const submitBranch = async () => {
|
|||||||
// 调用真实 API
|
// 调用真实 API
|
||||||
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
||||||
|
|
||||||
// 计算基线完成度
|
// 🆕 根节点分支:从零开始生成完整方案
|
||||||
const currentTaskProcess = taskProcess.value || []
|
// Baseline_Completion = 0 表示没有已完成的部分,需要生成所有阶段
|
||||||
const baselineCompletion = currentTaskProcess.length > 0 ? 0 : 100
|
// Existing_Steps 传空数组,不传递初始流程信息
|
||||||
|
|
||||||
const response = await api.branchTaskProcess({
|
const response = await api.branchTaskProcess({
|
||||||
branch_Number: 1,
|
branch_Number: 1,
|
||||||
Modification_Requirement: branchContent,
|
Modification_Requirement: branchContent,
|
||||||
Existing_Steps: [],
|
Existing_Steps: [], // ← 根节点分支不传递现有步骤
|
||||||
Baseline_Completion: baselineCompletion,
|
Baseline_Completion: 0, // ← 从零开始
|
||||||
stepTaskExisting: currentTask.value,
|
stepTaskExisting: currentTask.value,
|
||||||
goal: generalGoal
|
goal: generalGoal
|
||||||
})
|
})
|
||||||
@@ -989,28 +987,68 @@ const submitBranch = async () => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// ========== Agent 节点分支 ==========
|
// ========== Agent 节点分支 ==========
|
||||||
// 获取父 agent 节点的原始索引
|
const parentIsBranchTask = parentNode.data.isBranchTask || false
|
||||||
const parentOriginalIndex = parentNode.data.originalIndex ?? 0
|
const parentOriginalIndex = parentNode.data.originalIndex ?? 0
|
||||||
const parentAgentName = parentNode.data.agentName
|
|
||||||
|
|
||||||
let newAgentActions: IApiAgentAction[] = []
|
let newAgentActions: IApiAgentAction[] = []
|
||||||
|
|
||||||
if (USE_MOCK_DATA) {
|
if (USE_MOCK_DATA) {
|
||||||
// 使用 Mock API
|
// 使用 Mock API
|
||||||
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
||||||
|
|
||||||
// 计算基线完成度
|
|
||||||
const currentTaskProcess = taskProcess.value || []
|
const currentTaskProcess = taskProcess.value || []
|
||||||
const baselineCompletion =
|
|
||||||
|
// 🆕 根据父节点类型构建 existingSteps
|
||||||
|
let existingSteps: any[] = []
|
||||||
|
let baselineCompletion = 100
|
||||||
|
|
||||||
|
if (!parentIsBranchTask) {
|
||||||
|
// 父节点是主流程节点:传递主流程从 0 到父节点的步骤
|
||||||
|
baselineCompletion =
|
||||||
currentTaskProcess.length > 0
|
currentTaskProcess.length > 0
|
||||||
? Math.round(((parentOriginalIndex + 1) / currentTaskProcess.length) * 100)
|
? Math.round(((parentOriginalIndex + 1) / currentTaskProcess.length) * 100)
|
||||||
: 100
|
: 100
|
||||||
|
|
||||||
|
existingSteps = currentTaskProcess.slice(0, parentOriginalIndex + 1).map((p: any) => ({
|
||||||
|
ID: p.ID,
|
||||||
|
ActionType: p.ActionType,
|
||||||
|
AgentName: p.AgentName,
|
||||||
|
Description: p.Description,
|
||||||
|
ImportantInput: p.ImportantInput || []
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
// 父节点是分支节点:从分支数据中获取步骤
|
||||||
|
const taskStepId = currentTask.value?.Id || ''
|
||||||
|
const currentAgents = currentTask.value?.AgentSelection || []
|
||||||
|
const branches = selectionStore.getTaskProcessBranches(taskStepId, currentAgents)
|
||||||
|
|
||||||
|
// 找到父节点所属的分支
|
||||||
|
const parentBranch = branches.find(branch =>
|
||||||
|
branch.nodes.some(n => n.id === parentNode.id)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (parentBranch && parentBranch.tasks) {
|
||||||
|
// 获取分支中从第一个节点到父节点的所有步骤
|
||||||
|
const parentIndexInBranch = parentBranch.nodes.findIndex(n => n.id === parentNode.id)
|
||||||
|
existingSteps = parentBranch.tasks.slice(0, parentIndexInBranch + 1).map((p: any) => ({
|
||||||
|
ID: p.ID,
|
||||||
|
ActionType: p.ActionType,
|
||||||
|
AgentName: p.AgentName,
|
||||||
|
Description: p.Description,
|
||||||
|
ImportantInput: p.ImportantInput || []
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 分支节点的基线完成度:根据主流程进度计算
|
||||||
|
baselineCompletion =
|
||||||
|
currentTaskProcess.length > 0
|
||||||
|
? Math.round(((parentOriginalIndex + 1) / currentTaskProcess.length) * 100)
|
||||||
|
: 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 调用 Mock API
|
// 调用 Mock API
|
||||||
const response = await api.mockBranchTaskProcess({
|
const response = await api.mockBranchTaskProcess({
|
||||||
branch_Number: 1,
|
branch_Number: 1,
|
||||||
Modification_Requirement: branchContent,
|
Modification_Requirement: branchContent,
|
||||||
Existing_Steps: [],
|
Existing_Steps: existingSteps,
|
||||||
Baseline_Completion: baselineCompletion,
|
Baseline_Completion: baselineCompletion,
|
||||||
stepTaskExisting: currentTask.value,
|
stepTaskExisting: currentTask.value,
|
||||||
goal: generalGoal
|
goal: generalGoal
|
||||||
@@ -1038,23 +1076,66 @@ const submitBranch = async () => {
|
|||||||
} else {
|
} else {
|
||||||
// 调用真实 API
|
// 调用真实 API
|
||||||
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
const generalGoal = agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
||||||
|
|
||||||
// 计算基线完成度
|
|
||||||
const currentTaskProcess = taskProcess.value || []
|
const currentTaskProcess = taskProcess.value || []
|
||||||
const baselineCompletion =
|
|
||||||
|
// 🆕 根据父节点类型构建 existingSteps
|
||||||
|
let existingSteps: any[] = []
|
||||||
|
let baselineCompletion = 100
|
||||||
|
|
||||||
|
if (!parentIsBranchTask) {
|
||||||
|
// 父节点是主流程节点:传递主流程从 0 到父节点的步骤
|
||||||
|
baselineCompletion =
|
||||||
currentTaskProcess.length > 0
|
currentTaskProcess.length > 0
|
||||||
? Math.round(((parentOriginalIndex + 1) / currentTaskProcess.length) * 100)
|
? Math.round(((parentOriginalIndex + 1) / currentTaskProcess.length) * 100)
|
||||||
: 100
|
: 100
|
||||||
|
|
||||||
|
existingSteps = currentTaskProcess.slice(0, parentOriginalIndex + 1).map((p: any) => ({
|
||||||
|
ID: p.ID,
|
||||||
|
ActionType: p.ActionType,
|
||||||
|
AgentName: p.AgentName,
|
||||||
|
Description: p.Description,
|
||||||
|
ImportantInput: p.ImportantInput || []
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
// 父节点是分支节点:从分支数据中获取步骤
|
||||||
|
const taskStepId = currentTask.value?.Id || ''
|
||||||
|
const currentAgents = currentTask.value?.AgentSelection || []
|
||||||
|
const branches = selectionStore.getTaskProcessBranches(taskStepId, currentAgents)
|
||||||
|
|
||||||
|
// 找到父节点所属的分支
|
||||||
|
const parentBranch = branches.find(branch =>
|
||||||
|
branch.nodes.some(n => n.id === parentNode.id)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (parentBranch && parentBranch.tasks) {
|
||||||
|
// 获取分支中从第一个节点到父节点的所有步骤
|
||||||
|
const parentIndexInBranch = parentBranch.nodes.findIndex(n => n.id === parentNode.id)
|
||||||
|
existingSteps = parentBranch.tasks.slice(0, parentIndexInBranch + 1).map((p: any) => ({
|
||||||
|
ID: p.ID,
|
||||||
|
ActionType: p.ActionType,
|
||||||
|
AgentName: p.AgentName,
|
||||||
|
Description: p.Description,
|
||||||
|
ImportantInput: p.ImportantInput || []
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 分支节点的基线完成度:根据主流程进度计算
|
||||||
|
baselineCompletion =
|
||||||
|
currentTaskProcess.length > 0
|
||||||
|
? Math.round(((parentOriginalIndex + 1) / currentTaskProcess.length) * 100)
|
||||||
|
: 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const response = await api.branchTaskProcess({
|
const response = await api.branchTaskProcess({
|
||||||
branch_Number: 1,
|
branch_Number: 1,
|
||||||
Modification_Requirement: branchContent,
|
Modification_Requirement: branchContent,
|
||||||
Existing_Steps: [],
|
Existing_Steps: existingSteps,
|
||||||
Baseline_Completion: baselineCompletion,
|
Baseline_Completion: baselineCompletion,
|
||||||
stepTaskExisting: currentTask.value,
|
stepTaskExisting: currentTask.value,
|
||||||
goal: generalGoal
|
goal: generalGoal
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log('branchTaskProcess response:', response)
|
||||||
// 后端返回格式: [[action1, action2], [action3, action4]]
|
// 后端返回格式: [[action1, action2], [action3, action4]]
|
||||||
// 取第一个分支
|
// 取第一个分支
|
||||||
if (response && response.length > 0) {
|
if (response && response.length > 0) {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ const mockBranchTaskProcessDataRaw: BranchAction[][] = [
|
|||||||
*
|
*
|
||||||
* @param branch_Number - 分支数量
|
* @param branch_Number - 分支数量
|
||||||
* @param Modification_Requirement - 修改需求
|
* @param Modification_Requirement - 修改需求
|
||||||
* @param Existing_Steps - 现有步骤名称列表
|
* @param Existing_Steps - 现有步骤列表(包含完整信息的对象数组)
|
||||||
* @param Baseline_Completion - 基线完成度
|
* @param Baseline_Completion - 基线完成度
|
||||||
* @param stepTaskExisting - 现有任务
|
* @param stepTaskExisting - 现有任务
|
||||||
* @param General_Goal - 总体目标
|
* @param General_Goal - 总体目标
|
||||||
@@ -115,7 +115,7 @@ const mockBranchTaskProcessDataRaw: BranchAction[][] = [
|
|||||||
export const mockBranchTaskProcessAPI = async (params: {
|
export const mockBranchTaskProcessAPI = async (params: {
|
||||||
branch_Number: number
|
branch_Number: number
|
||||||
Modification_Requirement: string
|
Modification_Requirement: string
|
||||||
Existing_Steps: string[]
|
Existing_Steps: BranchAction[]
|
||||||
Baseline_Completion: number
|
Baseline_Completion: number
|
||||||
stepTaskExisting: any
|
stepTaskExisting: any
|
||||||
General_Goal: string
|
General_Goal: string
|
||||||
|
|||||||
@@ -818,7 +818,7 @@ const getHeatmapColor = (score: number) => {
|
|||||||
<!-- 左侧区域 - 20% -->
|
<!-- 左侧区域 - 20% -->
|
||||||
<div class="allocation-left">
|
<div class="allocation-left">
|
||||||
<div class="section-card" v-loading="isLoadingSelectGroup">
|
<div class="section-card" v-loading="isLoadingSelectGroup">
|
||||||
<div class="section-title">Assignment</div>
|
<div class="section-title">智能体</div>
|
||||||
<!-- 所有 agent 组合卡片(包括初始组合和用户创建的组合) -->
|
<!-- 所有 agent 组合卡片(包括初始组合和用户创建的组合) -->
|
||||||
<div
|
<div
|
||||||
v-for="(group, groupIndex) in confirmedAgentGroups"
|
v-for="(group, groupIndex) in confirmedAgentGroups"
|
||||||
@@ -853,7 +853,6 @@ const getHeatmapColor = (score: number) => {
|
|||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!currentTask" class="placeholder-text">请先在任务大纲中选择一个任务</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -863,7 +862,7 @@ const getHeatmapColor = (score: number) => {
|
|||||||
<!-- 右侧区域 - 79% -->
|
<!-- 右侧区域 - 79% -->
|
||||||
<div class="allocation-right">
|
<div class="allocation-right">
|
||||||
<div class="section-card">
|
<div class="section-card">
|
||||||
<div class="section-title">Comparison</div>
|
<div class="section-title">智能体对比</div>
|
||||||
<div
|
<div
|
||||||
v-if="allAgents.length > 0"
|
v-if="allAgents.length > 0"
|
||||||
class="comparison-content"
|
class="comparison-content"
|
||||||
|
|||||||
Reference in New Issue
Block a user