Skip to content

Commit

Permalink
Chat: show enhanced context settings on first chat (#3567)
Browse files Browse the repository at this point in the history
  • Loading branch information
abeatrix authored Mar 27, 2024
1 parent ff459b6 commit a88b9cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
10 changes: 3 additions & 7 deletions vscode/webviews/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc
)

const telemetryService = useMemo(() => createWebviewTelemetryService(vscodeAPI), [vscodeAPI])

const isNewInstall = useMemo(() => !userHistory.some(c => c.interactions.length > 0), [userHistory])
if (!view || !authStatus || !config) {
return <LoadingPage />
}
Expand All @@ -207,12 +207,7 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc
/>
) : (
<>
<Notices
probablyNewInstall={
!userHistory.filter(chat => chat.interactions.length)?.length
}
vscodeAPI={vscodeAPI}
/>
<Notices probablyNewInstall={isNewInstall} vscodeAPI={vscodeAPI} />
{errorMessages && (
<ErrorBanner errors={errorMessages} setErrors={setErrorMessages} />
)}
Expand Down Expand Up @@ -246,6 +241,7 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc
guardrails={attributionEnabled ? guardrails : undefined}
chatIDHistory={chatIDHistory}
isWebviewActive={isWebviewActive}
isNewInstall={isNewInstall}
/>
</EnhancedContextEnabled.Provider>
</EnhancedContextContext.Provider>
Expand Down
1 change: 1 addition & 0 deletions vscode/webviews/Chat.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const meta: Meta<typeof Chat> = {
},
telemetryService: null as any,
isTranscriptError: false,
isNewInstall: false,
} satisfies React.ComponentProps<typeof Chat>,

decorators: [WithBorder, VSCodeStoryDecorator],
Expand Down
4 changes: 3 additions & 1 deletion vscode/webviews/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface ChatboxProps {
guardrails?: Guardrails
chatIDHistory: string[]
isWebviewActive: boolean
isNewInstall: boolean
}

const isMac = isMacOS()
Expand All @@ -63,6 +64,7 @@ export const Chat: React.FunctionComponent<React.PropsWithChildren<ChatboxProps>
guardrails,
chatIDHistory,
isWebviewActive,
isNewInstall,
}) => {
const [messageBeingEdited, setMessageBeingEdited] = useState<number | undefined>(undefined)

Expand Down Expand Up @@ -530,7 +532,7 @@ export const Chat: React.FunctionComponent<React.PropsWithChildren<ChatboxProps>
isOpen={isEnhancedContextOpen}
setOpen={onEnhancedContextTogglerClick}
presentationMode={userInfo.isDotComUser ? 'consumer' : 'enterprise'}
isFirstChat={transcript.length < 1}
isFirstChat={isNewInstall}
/>
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions vscode/webviews/Components/EnhancedContextSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,7 @@ export const EnhancedContextSettings: React.FunctionComponent<EnhancedContextSet
}, [isOpen])

React.useEffect(() => {
if (isFirstChat) {
setOpen(true)
}
setOpen(isFirstChat)
}, [isFirstChat, setOpen])

// Can't point at and use VSCodeButton type with 'ref'
Expand Down

0 comments on commit a88b9cf

Please sign in to comment.