feat: surface codex thread config progress
This commit is contained in:
@@ -1353,6 +1353,90 @@ public final class BossUi {
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject threadGoal = progress == null ? null : progress.optJSONObject("threadGoal");
|
||||
JSONObject threadSettings = progress == null ? null : progress.optJSONObject("threadSettings");
|
||||
JSONObject compaction = progress == null ? null : progress.optJSONObject("compaction");
|
||||
boolean hasThreadConfig = threadGoal != null || threadSettings != null || compaction != null;
|
||||
if (hasThreadConfig) {
|
||||
card.addView(divider(context));
|
||||
card.addView(sectionTitle(context, "线程配置"));
|
||||
if (threadGoal != null) {
|
||||
String status = threadGoal.optString("status", "").trim();
|
||||
String objective = threadGoal.optString("objective", "").trim();
|
||||
if ("cleared".equals(status)) {
|
||||
card.addView(detailRow(context, "◎", "目标已清除", "", false));
|
||||
} else if (!TextUtils.isEmpty(status) || !TextUtils.isEmpty(objective)) {
|
||||
card.addView(detailRow(
|
||||
context,
|
||||
"◎",
|
||||
TextUtils.isEmpty(status) ? "目标" : "目标 " + status,
|
||||
"",
|
||||
false
|
||||
));
|
||||
if (!TextUtils.isEmpty(objective)) {
|
||||
card.addView(detailRow(context, "", objective, "", false, true));
|
||||
}
|
||||
int tokensUsed = threadGoal.optInt("tokensUsed", 0);
|
||||
int tokenBudget = threadGoal.optInt("tokenBudget", 0);
|
||||
if (tokensUsed > 0 || tokenBudget > 0) {
|
||||
StringBuilder budget = new StringBuilder();
|
||||
budget.append("预算 ");
|
||||
if (tokensUsed > 0) {
|
||||
budget.append(String.format(Locale.US, "%,d", tokensUsed));
|
||||
} else {
|
||||
budget.append("0");
|
||||
}
|
||||
if (tokenBudget > 0) {
|
||||
budget.append(" / ").append(String.format(Locale.US, "%,d", tokenBudget));
|
||||
}
|
||||
card.addView(detailRow(context, "", budget.toString(), "", false, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (threadSettings != null) {
|
||||
String model = threadSettings.optString("model", "").trim();
|
||||
String provider = threadSettings.optString("modelProvider", "").trim();
|
||||
if (!TextUtils.isEmpty(model)) {
|
||||
card.addView(detailRow(
|
||||
context,
|
||||
"◇",
|
||||
TextUtils.isEmpty(provider) ? "模型 " + model : "模型 " + model + " · " + provider,
|
||||
"",
|
||||
false
|
||||
));
|
||||
}
|
||||
String approval = threadSettings.optString("approvalPolicy", "").trim();
|
||||
String sandbox = threadSettings.optString("sandboxPolicy", "").trim();
|
||||
if (!TextUtils.isEmpty(approval) || !TextUtils.isEmpty(sandbox)) {
|
||||
String label = !TextUtils.isEmpty(approval) && !TextUtils.isEmpty(sandbox)
|
||||
? "审批 " + approval + " · 沙箱 " + sandbox
|
||||
: !TextUtils.isEmpty(approval) ? "审批 " + approval : "沙箱 " + sandbox;
|
||||
card.addView(detailRow(context, "◇", label, "", false));
|
||||
}
|
||||
String collaborationMode = threadSettings.optString("collaborationMode", "").trim();
|
||||
String serviceTier = threadSettings.optString("serviceTier", "").trim();
|
||||
if (!TextUtils.isEmpty(collaborationMode) || !TextUtils.isEmpty(serviceTier)) {
|
||||
String label = !TextUtils.isEmpty(collaborationMode) && !TextUtils.isEmpty(serviceTier)
|
||||
? "协作 " + collaborationMode + " · " + serviceTier
|
||||
: !TextUtils.isEmpty(collaborationMode) ? "协作 " + collaborationMode : "服务 " + serviceTier;
|
||||
card.addView(detailRow(context, "◇", label, "", false));
|
||||
}
|
||||
}
|
||||
if (compaction != null) {
|
||||
String message = compaction.optString("message", "").trim();
|
||||
String status = compaction.optString("status", "").trim();
|
||||
if (!TextUtils.isEmpty(message) || !TextUtils.isEmpty(status)) {
|
||||
card.addView(detailRow(
|
||||
context,
|
||||
"◷",
|
||||
TextUtils.isEmpty(message) ? "上下文压缩 " + status : message,
|
||||
"",
|
||||
false
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject modelRoute = progress == null ? null : progress.optJSONObject("modelRoute");
|
||||
JSONObject tokenUsage = progress == null ? null : progress.optJSONObject("tokenUsage");
|
||||
JSONArray mcpServers = progress == null ? null : progress.optJSONArray("mcpServers");
|
||||
|
||||
Reference in New Issue
Block a user