fix: harden production chat runtime

This commit is contained in:
kris
2026-03-31 20:20:07 +08:00
parent ec7081f6cc
commit 02fcc56332
12 changed files with 310 additions and 11 deletions

View File

@@ -852,7 +852,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
ProjectChatUiState.ReplyWaitSpec waitSpec =
ProjectChatUiState.resolveReplyWaitAfterDispatchConfirm(response.json);
runOnUiThread(() -> {
projectApprovalState = "approval_required".equals(projectCollaborationMode) ? "approved" : "not_required";
applyDispatchPlanActionResponse(response.json);
if (waitSpec.shouldWait) {
startReplyWait(
waitSpec,
@@ -887,9 +887,8 @@ public class ProjectDetailActivity extends BossScreenActivity {
throw new IllegalStateException(response.message());
}
runOnUiThread(() -> {
currentPendingDispatchPlan = null;
composerSending = false;
projectApprovalState = "rejected";
applyDispatchPlanActionResponse(response.json);
updateComposerSendButtonState();
showMessage("已拒绝主 Agent 推荐");
reload(true);
@@ -1935,6 +1934,24 @@ public class ProjectDetailActivity extends BossScreenActivity {
}
}
private void applyDispatchPlanActionResponse(@Nullable JSONObject response) {
if (response == null) {
return;
}
JSONObject collaborationGate = response.optJSONObject("collaborationGate");
if (collaborationGate != null) {
projectCollaborationMode = collaborationGate.optString("collaborationMode", projectCollaborationMode);
projectApprovalState = collaborationGate.optString("approvalState", projectApprovalState);
}
JSONObject plan = response.optJSONObject("plan");
if (plan != null) {
String status = plan.optString("status", "");
if (!"pending_user_confirmation".equals(status)) {
currentPendingDispatchPlan = null;
}
}
}
private List<String> collectMessageIds(@Nullable JSONArray messages) {
ArrayList<String> ids = new ArrayList<>();
if (messages == null) {