Skip to content

Commit dc8cfa1

Browse files
committed
logs for debugs, and logic for the approve reject flow
1 parent 1c47291 commit dc8cfa1

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/frontend_react/src/api/apiClient.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const fetchWithoutAuth = async (url: string, method: string = "POST", body: Body
8181
const errorText = await response.text();
8282
throw new Error(errorText || 'Login failed');
8383
}
84-
84+
console.log('response', response);
8585
const isJson = response.headers.get('content-type')?.includes('application/json');
8686
return isJson ? await response.json() : null;
8787
} catch (error) {

src/frontend_react/src/components/content/HomeInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const HomeInput: React.FC<HomeInputProps> = ({
4646
const handleSubmit = async () => {
4747
if (input.trim()) {
4848
setSubmitting(true);
49-
showToast("Creating a plan..", "progress", { dismissible: false });
49+
showToast("Creating a plan..", "progress");
5050
try {
5151
const response = await TaskService.submitInputTask(input.trim());
5252

src/frontend_react/src/components/content/PlanChat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const PlanChat: React.FC<PlanChatProps> = ({
117117
>
118118
<Button
119119
appearance="transparent"
120-
onClick={sendMessage}
120+
onClick={() => OnChatSubmit(inputValue)}
121121
icon={<Send />}
122122
disabled={!planData?.enableChat}
123123
/>

src/frontend_react/src/pages/PlanPage.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const PlanPage: React.FC = () => {
5151
if (!planId) return;
5252

5353
try {
54+
setInput(""); // Clear input on new load
5455
setPlanData(null);
5556
setLoading(true);
5657
setError(null);
@@ -87,14 +88,20 @@ const PlanPage: React.FC = () => {
8788
// Accept chat input and submit clarification
8889
const handleOnchatSubmit = useCallback(
8990
async (chatInput: string) => {
91+
console.log('handleOnchatSubmit called with input:', chatInput);
92+
if (!chatInput.trim()) {
93+
showToast("Please enter a clarification", "error");
94+
return;
95+
}
9096
if (!planData?.plan) return;
91-
showToast("Submitting clarification...", "progress", { dismissible: false });
97+
showToast("Submitting clarification...", "progress");
9298
try {
9399
await PlanDataService.submitClarification(
94100
planData.plan.id, // plan_id
95101
planData.plan.session_id, // session_id
96102
chatInput // human_clarification
97103
);
104+
setInput(""); // Clear input after submission
98105
showToast("Clarification submitted successfully", "success");
99106
await loadPlanData2();
100107
} catch (error) {
@@ -110,7 +117,7 @@ const PlanPage: React.FC = () => {
110117
// Move handlers here to fix dependency order
111118
const handleApproveStep = useCallback(async (step: Step) => {
112119
setProcessingSubtaskId(step.id);
113-
showToast("Submitting approval...", "progress", { dismissible: false });
120+
showToast("Submitting approval...", "progress");
114121
try {
115122
await PlanDataService.approveStep(step);
116123
showToast("Step approved successfully", "success");
@@ -126,7 +133,7 @@ const PlanPage: React.FC = () => {
126133

127134
const handleRejectStep = useCallback(async (step: Step) => {
128135
setProcessingSubtaskId(step.id);
129-
showToast("Submitting rejection...", "progress", { dismissible: false });
136+
showToast("Submitting rejection...", "progress");
130137
try {
131138
await PlanDataService.rejectStep(step);
132139
showToast("Step rejected successfully", "success");

0 commit comments

Comments
 (0)