Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null dereference from empty intent/input #442

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion webapp/src/components/chat/plan-viewer/PlanViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ export const PlanViewer: React.FC<PlanViewerProps> = ({ message, messageIndex })
plan={plan}
setPlan={setPlan}
planState={planState}
description={getPlanGoal(parsedContent.userIntent ?? parsedContent.originalUserInput)}
description={getPlanGoal(
parsedContent.userIntent ??
parsedContent.originalUserInput ??
parsedContent.proposedPlan.description,
)}
/>
{planState === PlanState.PlanApprovalRequired && (
<>
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/components/chat/tabs/PlansTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ function useTable(planMessages: IChatMessage[], setChatTab: () => void) {
const items = planMessages
.map((message, index) => {
const parsedPlan = JSON.parse(message.content) as ProposedPlan;
const plangoal = parsedPlan.userIntent ?? parsedPlan.originalUserInput;
const plangoal =
parsedPlan.userIntent ?? parsedPlan.originalUserInput ?? parsedPlan.proposedPlan.description;

return {
index: index,
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/libs/models/Plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface ProposedPlan {
state: PlanState;

// User input that prompted the plan
originalUserInput: string;
originalUserInput?: string;

// User intent to serves as goal of plan.
userIntent?: string;
Expand Down