对话面板:新增默认折叠的「思考过程」块
- App.tsx:直连回合按回合累积过程/步骤行(相邻重复去重、最多 40 行),每次回合更新时收集,新回合开始时清空 - App.tsx:把累积结果作为 processSteps 传给对话面板 - ProjectSupervisorView:新增可选属性 processSteps;在消息流里渲染默认折叠的「思考过程」块(details 默认收起,data-testid=agent-thinking) - styles.css:思考过程块与步骤列表的最小样式(左右与消息内容对齐 16px) - 说明(限制):Codex app-server 0.147/0.149 只推结构性 item、不推 reasoning 文本(codex_app_server.rs 对 reasoning 类型是明确忽略并有单测钉住),所以这里展示的是我们真实能拿到的过程行(正在思考中 / 正在执行命令:x / 正在写入文件:y),不是模型内部推理原文;策划/设计链原有的 designReasoning 折叠块不受影响
This commit is contained in:
@@ -823,6 +823,26 @@ export function App({
|
||||
const directCodexConversationTurnSequenceRef = useRef(0);
|
||||
// 工具调用卡片:按 **id** 归并(实时增量 + 回读历史共用一份),同一 id 只渲染一次。
|
||||
// 用 ref 做写入基准,避免同一批事件里多条增量互相覆盖。
|
||||
// 直连回合的"思考过程"行:按回合累积过程/中间态文本(去重相邻重复、最多 40 行)。
|
||||
const [directTurnSteps, setDirectTurnSteps] = useState<string[]>([]);
|
||||
const directTurnStepsRef = useRef<string[]>([]);
|
||||
function pushDirectTurnStep(text: string) {
|
||||
const line = text.trim();
|
||||
if (!line) {
|
||||
return;
|
||||
}
|
||||
const current = directTurnStepsRef.current;
|
||||
if (current[current.length - 1] === line) {
|
||||
return;
|
||||
}
|
||||
const next = [...current, line].slice(-40);
|
||||
directTurnStepsRef.current = next;
|
||||
setDirectTurnSteps(next);
|
||||
}
|
||||
function clearDirectTurnSteps() {
|
||||
directTurnStepsRef.current = [];
|
||||
setDirectTurnSteps([]);
|
||||
}
|
||||
const [directToolCalls, setDirectToolCalls] = useState<
|
||||
GameCreatorDirectToolCall[]
|
||||
>([]);
|
||||
@@ -892,6 +912,7 @@ export function App({
|
||||
}
|
||||
|
||||
function resetDirectCodexTurn() {
|
||||
clearDirectTurnSteps();
|
||||
activeDirectCodexTurnRef.current = null;
|
||||
lastDirectCodexActivityRef.current = null;
|
||||
setDirectCodexProgress('');
|
||||
@@ -1850,6 +1871,7 @@ export function App({
|
||||
? payload.updatedAt
|
||||
: Date.now();
|
||||
const processDetail = directCodexProcessDetail(payload);
|
||||
pushDirectTurnStep(processDetail);
|
||||
if (payload.status === 'failed') {
|
||||
activeDirectCodexTurnRef.current = null;
|
||||
lastDirectCodexActivityRef.current = null;
|
||||
@@ -12181,6 +12203,7 @@ export function App({
|
||||
: projectSupervisorTransientReply
|
||||
}
|
||||
designReasoning={planningV2Reasoning}
|
||||
processSteps={directTurnSteps}
|
||||
visibleMessages={visibleMessages}
|
||||
visibleProfessionalAgentCards={visibleProfessionalAgentCards}
|
||||
showProfessionalCollaboration={
|
||||
|
||||
@@ -156,6 +156,8 @@ type ProjectSupervisorViewProps = RuntimePanelProps & {
|
||||
showProfessionalCollaboration?: boolean;
|
||||
transientReply: string;
|
||||
designReasoning?: string;
|
||||
/** 直连回合累积的过程/步骤行(真 reasoning 文本当前拿不到,见文档限制)。 */
|
||||
processSteps?: string[];
|
||||
visibleMessages: ChatMessage[];
|
||||
visibleProfessionalAgentCards: AgentStatusCard[];
|
||||
walletEntry?: ReactNode;
|
||||
@@ -220,6 +222,7 @@ export function ProjectSupervisorView({
|
||||
showProfessionalCollaboration = true,
|
||||
transientReply,
|
||||
designReasoning = '',
|
||||
processSteps = [],
|
||||
visibleMessages,
|
||||
visibleProfessionalAgentCards,
|
||||
walletEntry,
|
||||
@@ -454,6 +457,19 @@ export function ProjectSupervisorView({
|
||||
className="message-tool-call"
|
||||
/>
|
||||
) : null}
|
||||
{directCodex && processSteps.length > 0 ? (
|
||||
<details
|
||||
className="design-agent-reasoning project-supervisor-thinking"
|
||||
data-testid="agent-thinking"
|
||||
>
|
||||
<summary>思考过程</summary>
|
||||
<ol className="project-supervisor-thinking-steps">
|
||||
{processSteps.map((step, index) => (
|
||||
<li key={`${index}-${step}`}>{step}</li>
|
||||
))}
|
||||
</ol>
|
||||
</details>
|
||||
) : null}
|
||||
{designReasoning ? (
|
||||
<details className="design-agent-reasoning">
|
||||
<summary>显示思考过程</summary>
|
||||
|
||||
@@ -11877,3 +11877,23 @@ button.design-workspace-tree__entry:hover,
|
||||
> .project-supervisor-process-card {
|
||||
margin: 0 16px 8px;
|
||||
}
|
||||
|
||||
/* 直连回合的「思考过程」块:默认折叠(<details> 默认收起),展开后按步骤列过程行。
|
||||
注意:Codex app-server 当前不推 reasoning 文本,这里展示的是我们真实拿到的过程行。 */
|
||||
.project-supervisor-thinking {
|
||||
margin: 0 16px 8px;
|
||||
}
|
||||
|
||||
.project-supervisor-thinking > summary {
|
||||
cursor: pointer;
|
||||
color: var(--platform-text-soft);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.project-supervisor-thinking-steps {
|
||||
margin: 6px 0 0;
|
||||
padding-left: 18px;
|
||||
color: var(--platform-text-soft);
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user