public String getStepsExecutionStateStringFormat()

in spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/planning/model/vo/ExecutionPlan.java [127:172]


	public String getStepsExecutionStateStringFormat(boolean onlyCompletedAndFirstInProgress) {
		StringBuilder state = new StringBuilder();
		boolean foundInProgress = false;

		for (int i = 0; i < steps.size(); i++) {
			ExecutionStep step = steps.get(i);

			// 如果onlyCompletedAndFirstInProgress为true,则只显示COMPLETED状态的步骤和第一个IN_PROGRESS状态的步骤
			if (onlyCompletedAndFirstInProgress) {
				// 如果是COMPLETED状态,始终显示
				if (step.getStatus() == AgentState.COMPLETED) {
					// 什么都不做,继续显示
				}
				// 如果是IN_PROGRESS状态,且还没找到其他IN_PROGRESS的步骤
				else if (step.getStatus() == AgentState.IN_PROGRESS && !foundInProgress) {
					foundInProgress = true; // 标记已找到IN_PROGRESS步骤
				}
				// 其他所有情况(不是COMPLETED且不是第一个IN_PROGRESS)
				else {
					continue; // 跳过不符合条件的步骤
				}
			}

			String symbol = switch (step.getStatus()) {
				case COMPLETED -> "[completed]";
				case IN_PROGRESS -> "[in_progress]";
				case BLOCKED -> "[blocked]";
				case NOT_STARTED -> "[not_started]";
				default -> "[ ]";
			};
			state.append("步骤 ")
				.append(i)
				.append(": ")
				.append(symbol)
				.append(" ")
				.append(step.getStepRequirement())
				.append("\n")
				.append("\n");
			String result = step.getResult();
			if (result != null && !result.isEmpty()) {
				state.append("该步骤的执行结果: ").append("\n").append(result).append("\n");
			}

		}
		return state.toString();
	}