Skip to content

Commit 98d3e2a

Browse files
committed
clean chat after clarification
1 parent 8407007 commit 98d3e2a

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ const PlanChat: React.FC<PlanChatProps> = ({
2424
planData,
2525
input,
2626
loading,
27+
setInput,
2728
submittingChatDisableInput,
2829
OnChatSubmit,
2930
}) => {
3031
const messages = planData?.messages || [];
31-
const [inputValue, setInput] = useState(input);
32-
const [isTyping, setIsTyping] = useState(false);
3332
const [showScrollButton, setShowScrollButton] = useState(false);
3433
const [inputHeight, setInputHeight] = useState(0);
3534

@@ -61,7 +60,7 @@ const PlanChat: React.FC<PlanChatProps> = ({
6160
if (inputContainerRef.current) {
6261
setInputHeight(inputContainerRef.current.offsetHeight);
6362
}
64-
}, [inputValue]); // or [inputValue, submittingChatDisableInput]
63+
}, [input]); // or [inputValue, submittingChatDisableInput]
6564

6665

6766

@@ -164,17 +163,17 @@ const PlanChat: React.FC<PlanChatProps> = ({
164163
<div ref={inputContainerRef} className="plan-chat-input-container">
165164
<div className="plan-chat-input-wrapper">
166165
<ChatInput
167-
value={inputValue}
166+
value={input}
168167
onChange={setInput}
169-
onEnter={() => OnChatSubmit(inputValue)}
168+
onEnter={() => OnChatSubmit(input)}
170169
disabledChat={
171170
planData.enableChat ? submittingChatDisableInput : true
172171
}
173172
placeholder="Add more info to this task..."
174173
>
175174
<Button
176175
appearance="transparent"
177-
onClick={() => OnChatSubmit(inputValue)}
176+
onClick={() => OnChatSubmit(input)}
178177
icon={<Send />}
179178
disabled={planData.enableChat ? submittingChatDisableInput : true}
180179
/>

src/frontend_react/src/models/plan.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export interface PlanChatProps {
120120
planData: ProcessedPlanData;
121121
input: string;
122122
loading: boolean;
123+
setInput: any;
123124
submittingChatDisableInput: boolean;
124125
OnChatSubmit: (message: string) => void;
125126
}

src/frontend_react/src/pages/PlanPage.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
import React, { useCallback, useEffect, useState } from "react";
22
import { useParams, useNavigate } from "react-router-dom";
33
import {
4-
Button,
54
Text,
6-
Card,
7-
CardHeader,
8-
useToastController,
9-
Spinner,
10-
Badge,
115
ToggleButton,
126
} from "@fluentui/react-components";
13-
import {
14-
Add20Regular,
15-
ArrowLeft24Regular,
16-
ErrorCircle24Regular,
17-
Person24Regular,
18-
CheckmarkCircle24Regular,
19-
AlertUrgent24Regular,
20-
Sparkle20Filled,
21-
ChatMultipleRegular,
22-
ChatMultiple20Regular,
23-
} from "@fluentui/react-icons";
247
import "../styles/PlanPage.css";
258
import CoralShellColumn from "../coral/components/Layout/CoralShellColumn";
269
import CoralShellRow from "../coral/components/Layout/CoralShellRow";
@@ -209,6 +192,7 @@ const PlanPage: React.FC = () => {
209192
planData={planData}
210193
OnChatSubmit={handleOnchatSubmit}
211194
loading={loading}
195+
setInput={setInput}
212196
submittingChatDisableInput={submittingChatDisableInput}
213197
input={input}
214198
/>

0 commit comments

Comments
 (0)