feat: map codex realtime thread status
This commit is contained in:
@@ -1296,6 +1296,63 @@ public final class BossUi {
|
||||
return card;
|
||||
}
|
||||
|
||||
JSONObject threadStatus = progress == null ? null : progress.optJSONObject("threadStatus");
|
||||
if (threadStatus != null) {
|
||||
String type = threadStatus.optString("type", "").trim();
|
||||
boolean waitingOnApproval = threadStatus.optBoolean("waitingOnApproval", false);
|
||||
boolean waitingOnUserInput = threadStatus.optBoolean("waitingOnUserInput", false);
|
||||
if (!TextUtils.isEmpty(type) || waitingOnApproval || waitingOnUserInput) {
|
||||
card.addView(divider(context));
|
||||
card.addView(sectionTitle(context, "线程状态"));
|
||||
String label = "active".equals(type) ? "活跃" :
|
||||
"idle".equals(type) ? "空闲" :
|
||||
"systemError".equals(type) ? "系统异常" :
|
||||
"notLoaded".equals(type) ? "未加载" : type;
|
||||
card.addView(detailRow(context, "●", TextUtils.isEmpty(label) ? "状态待同步" : label, "", false));
|
||||
if (waitingOnApproval) {
|
||||
card.addView(detailRow(context, "", "等待审批", "", false, true));
|
||||
}
|
||||
if (waitingOnUserInput) {
|
||||
card.addView(detailRow(context, "", "等待用户输入", "", false, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject realtime = progress == null ? null : progress.optJSONObject("realtime");
|
||||
if (realtime != null) {
|
||||
String status = realtime.optString("status", "").trim();
|
||||
if (!TextUtils.isEmpty(status)) {
|
||||
card.addView(divider(context));
|
||||
card.addView(sectionTitle(context, "实时状态"));
|
||||
String closeReason = realtime.optString("closeReason", "").trim();
|
||||
String lastError = realtime.optString("lastError", "").trim();
|
||||
String statusLabel = "started".equals(status) ? "已启动" :
|
||||
"streaming".equals(status) ? "同步中" :
|
||||
"closed".equals(status) ? "已关闭" :
|
||||
"error".equals(status) ? "异常" : status;
|
||||
String trailing = !TextUtils.isEmpty(lastError) ? lastError : closeReason;
|
||||
card.addView(detailRow(
|
||||
context,
|
||||
"◎",
|
||||
TextUtils.isEmpty(trailing) ? statusLabel : statusLabel + " · " + trailing,
|
||||
"",
|
||||
"error".equals(status)
|
||||
));
|
||||
String transcript = realtime.optString("transcriptPreview", "").trim();
|
||||
if (!TextUtils.isEmpty(transcript)) {
|
||||
card.addView(detailRow(context, "", transcript, "", false, true));
|
||||
}
|
||||
int audioChunkCount = realtime.optInt("audioChunkCount", 0);
|
||||
int itemCount = realtime.optInt("itemCount", 0);
|
||||
if (audioChunkCount > 0) {
|
||||
card.addView(detailRow(context, "", "音频片段 " + audioChunkCount, "", false, true));
|
||||
}
|
||||
if (itemCount > 0) {
|
||||
card.addView(detailRow(context, "", "实时事件 " + itemCount, "", false, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray warnings = progress == null ? null : progress.optJSONArray("warnings");
|
||||
if (warnings != null && warnings.length() > 0) {
|
||||
card.addView(divider(context));
|
||||
|
||||
Reference in New Issue
Block a user