Skip to content

Commit f2de165

Browse files
authored
Merge pull request #466 from microsoft/macae-v3-fr-dev-92
Macae v3 fr dev 92
2 parents 2cde5d7 + c4fb8bf commit f2de165

File tree

7 files changed

+46
-41
lines changed

7 files changed

+46
-41
lines changed

src/frontend/src/components/content/PlanChat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const PlanChat: React.FC<SimplifiedPlanChatProps> = ({
159159
{renderThinkingState(waitingForPlan)}
160160

161161
{/* Plan response with all information */}
162-
{showApprovalButtons && renderPlanResponse(planApprovalRequest, handleApprovePlan, handleRejectPlan, processingApproval, showApprovalButtons)}
162+
{renderPlanResponse(planApprovalRequest, handleApprovePlan, handleRejectPlan, processingApproval, showApprovalButtons)}
163163
{renderAgentMessages(agentMessages)}
164164

165165

@@ -174,7 +174,7 @@ const PlanChat: React.FC<SimplifiedPlanChatProps> = ({
174174
setInput={setInput}
175175
submittingChatDisableInput={submittingChatDisableInput}
176176
OnChatSubmit={OnChatSubmit}
177-
showChatInput={!planApprovalRequest}
177+
showChatInput={true}
178178
waitingForPlan={waitingForPlan}
179179
loading={false} />
180180
</div>

src/frontend/src/components/content/PlanChatBody.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ const PlanChatBody: React.FC<SimplifiedPlanChatProps> = ({
2828
maxWidth: '800px',
2929
margin: '0 auto',
3030
width: '100%'
31-
}}>
31+
}}
32+
33+
>
3234
<ChatInput
3335
value={input}
3436
onChange={setInput}
3537
onEnter={() => OnChatSubmit(input)}
36-
disabledChat={submittingChatDisableInput || waitingForPlan}
38+
disabledChat={submittingChatDisableInput}
3739
placeholder={
3840
waitingForPlan
3941
? "Creating plan..."
@@ -44,7 +46,7 @@ const PlanChatBody: React.FC<SimplifiedPlanChatProps> = ({
4446
appearance="transparent"
4547
onClick={() => OnChatSubmit(input)}
4648
icon={<SendRegular />}
47-
disabled={submittingChatDisableInput || waitingForPlan}
49+
disabled={submittingChatDisableInput}
4850
style={{ height: '40px', width: '40px' }}
4951
/>
5052
</ChatInput>

src/frontend/src/components/content/PlanPanelRight.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ import {
66
PersonRegular,
77
ArrowTurnDownRightRegular,
88
} from "@fluentui/react-icons";
9-
import { MPlanData } from "../../models";
9+
import { MPlanData, PlanDetailsProps } from "../../models";
1010
import { TaskService } from "../../services/TaskService";
1111
import { AgentTypeUtils, AgentType } from "../../models/enums";
1212
import ContentNotFound from "../NotFound/ContentNotFound";
1313

14-
interface PlanPanelRightProps {
15-
planData: any;
16-
loading: boolean;
17-
planApprovalRequest: MPlanData | null;
18-
}
1914

20-
const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
15+
const PlanPanelRight: React.FC<PlanDetailsProps> = ({
2116
planData,
2217
loading,
2318
planApprovalRequest
@@ -62,9 +57,9 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
6257

6358
// Get the icon name from the utility
6459
const iconName = AgentTypeUtils.getAgentIcon(agentType);
65-
60+
6661
// Return the appropriate icon component or fallback to PersonRegular
67-
return <PersonRegular style={{
62+
return <PersonRegular style={{
6863
color: 'var(--colorPaletteBlueForeground2)',
6964
fontSize: '16px'
7065
}} />;
@@ -83,11 +78,11 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
8378
if (!planApprovalRequest.steps || planApprovalRequest.steps.length === 0) return [];
8479

8580
const result: Array<{ type: 'heading' | 'substep'; text: string }> = [];
86-
81+
8782
planApprovalRequest.steps.forEach(step => {
8883
const action = step.cleanAction || step.action || '';
8984
const trimmedAction = action.trim();
90-
85+
9186
if (trimmedAction) {
9287
// Check if the step ends with a colon
9388
if (trimmedAction.endsWith(':')) {
@@ -117,8 +112,8 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
117112
display: 'flex',
118113
flexDirection: 'column'
119114
}}>
120-
<Body1 style={{
121-
marginBottom: '16px',
115+
<Body1 style={{
116+
marginBottom: '16px',
122117
flexShrink: 0,
123118
fontSize: '14px',
124119
fontWeight: 600,
@@ -186,7 +181,7 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
186181
flex: 1,
187182
overflow: 'auto'
188183
}}>
189-
<Body1 style={{
184+
<Body1 style={{
190185
marginBottom: '16px',
191186
fontSize: '14px',
192187
fontWeight: 600,
@@ -227,11 +222,11 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
227222
}}>
228223
{getAgentIcon(agentName)}
229224
</div>
230-
225+
231226
{/* Agent Info - just name */}
232227
<div style={{ flex: 1 }}>
233-
<Body1 style={{
234-
fontWeight: 600,
228+
<Body1 style={{
229+
fontWeight: 600,
235230
fontSize: '14px',
236231
color: 'var(--colorNeutralForeground1)'
237232
}}>

src/frontend/src/models/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export * from './homeInput';
1616
export * from './auth';
1717

1818
// Export taskDetails with explicit naming to avoid Agent conflict
19-
export type { SubTask, Human, TaskDetailsProps } from './taskDetails';
19+
export type { SubTask, Human, PlanDetailsProps } from './taskDetails';
2020
export type { Agent as TaskAgent } from './taskDetails';
2121

2222
// Export Team models (Agent interface takes precedence)

src/frontend/src/models/taskDetails.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ProcessedPlanData, Step } from "./plan";
1+
import { MPlanData, ProcessedPlanData, Step } from "./plan";
22

33
export interface SubTask {
44
id: string;
@@ -20,10 +20,8 @@ export interface Human {
2020
avatarUrl?: string;
2121
}
2222

23-
export interface TaskDetailsProps {
23+
export interface PlanDetailsProps {
2424
planData: ProcessedPlanData;
2525
loading: boolean;
26-
submittingChatDisableInput: boolean;
27-
processingSubtaskId: string | null;
28-
OnApproveStep: (step: Step, total: number, completed: number, approve: boolean) => void;
26+
planApprovalRequest: MPlanData | null;
2927
}

src/frontend/src/pages/PlanPage.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ const PlanPage: React.FC = () => {
4444
const [loading, setLoading] = useState<boolean>(true);
4545
const [submittingChatDisableInput, setSubmitting] = useState<boolean>(false);
4646
const [error, setError] = useState<Error | null>(null);
47-
const [processingSubtaskId, setProcessingSubtaskId] = useState<string | null>(
48-
null
49-
);
47+
5048
const [planApprovalRequest, setPlanApprovalRequest] = useState<MPlanData | null>(null);
5149
const [reloadLeftList, setReloadLeftList] = useState(true);
5250
const [waitingForPlan, setWaitingForPlan] = useState(true);
@@ -504,11 +502,7 @@ const PlanPage: React.FC = () => {
504502

505503
<PlanPanelRight
506504
planData={planData}
507-
submittingChatDisableInput={submittingChatDisableInput}
508-
processingSubtaskId={processingSubtaskId}
509505
loading={loading}
510-
streamingMessages={streamingMessages}
511-
planApproved={planApproved}
512506
planApprovalRequest={planApprovalRequest}
513507
/>
514508
</CoralShellRow>

src/frontend/src/services/WebSocketService.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { headerBuilder } from '../api/config';
1+
import { getApiUrl, headerBuilder } from '../api/config';
22
import { PlanDataService } from './PlanDataService';
33
import { MPlanData, ParsedPlanApprovalRequest, StreamingPlanUpdate, StreamMessage, WebsocketMessageType } from '../models';
44

@@ -12,8 +12,24 @@ class WebSocketService {
1212
private planSubscriptions: Set<string> = new Set();
1313
private reconnectTimer: NodeJS.Timeout | null = null;
1414
private isConnecting = false;
15-
private baseWsUrl = process.env.REACT_APP_BACKEND_URL?.replace('http', 'ws') || 'ws://localhost:8000';
15+
private baseWsUrl = getApiUrl() || 'ws://localhost:8000';
1616

17+
private buildSocketUrl(processId?: string, sessionId?: string): string {
18+
// Trim and remove trailing slashes
19+
let base = (this.baseWsUrl || '').trim().replace(/\/+$/, '');
20+
// Normalize protocol: http -> ws, https -> wss
21+
base = base.replace(/^http:\/\//i, 'ws://')
22+
.replace(/^https:\/\//i, 'wss://');
23+
24+
// Leave ws/wss as-is; anything else is assumed already correct
25+
26+
// Decide path addition
27+
const hasApiSegment = /\/api(\/|$)/i.test(base);
28+
const socketPath = hasApiSegment ? '/v3/socket' : '/api/v3/socket';
29+
const url = `${base}${socketPath}${processId ? `/${processId}` : `/${sessionId}`}`;
30+
console.log("Constructed WebSocket URL:", url);
31+
return url;
32+
}
1733
connect(sessionId: string, processId?: string): Promise<void> {
1834
return new Promise((resolve, reject) => {
1935
if (this.isConnecting) {
@@ -26,9 +42,7 @@ class WebSocketService {
2642
}
2743
try {
2844
this.isConnecting = true;
29-
const wsUrl = processId
30-
? `${this.baseWsUrl}/api/v3/socket/${processId}`
31-
: `${this.baseWsUrl}/api/v3/socket/${sessionId}`;
45+
const wsUrl = this.buildSocketUrl(processId, sessionId);
3246
this.ws = new WebSocket(wsUrl);
3347

3448
this.ws.onopen = () => {
@@ -210,7 +224,9 @@ class WebSocketService {
210224

211225
case WebsocketMessageType.USER_CLARIFICATION_REQUEST: {
212226
if (message.data) {
213-
//const transformed = PlanDataService.parseUserClarificationRequest(message);
227+
//\const transformed = PlanDataService.parseUserClarificationRequest(message);
228+
console.log('WebSocket USER_CLARIFICATION_REQUEST message received:', message);
229+
214230
this.emit(WebsocketMessageType.USER_CLARIFICATION_REQUEST, message);
215231
}
216232
break;

0 commit comments

Comments
 (0)