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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

account for no visible assistants #2765

Merged
merged 1 commit into from
Oct 10, 2024
Merged

account for no visible assistants #2765

merged 1 commit into from
Oct 10, 2024

Conversation

pablodanswer
Copy link
Contributor

Description

[Provide a brief description of the changes in this PR]

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Accepted Risk

[Any know risks or failure modes to point out to reviewers]

Related Issue(s)

[If applicable, link to the issue(s) this PR addresses]

Checklist:

  • All of the automated tests pass
  • All PR comments are addressed and marked resolved
  • If there are migrations, they have been rebased to latest main
  • If there are new dependencies, they are added to the requirements
  • If there are new environment variables, they are added to all of the deployment methods
  • If there are new APIs that don't require auth, they are added to PUBLIC_ENDPOINT_SPECS
  • Docker images build and basic functionalities work
  • Author has done a final read through of the PR right before merge

Copy link

vercel bot commented Oct 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 5:21pm

@pablodanswer pablodanswer marked this pull request as ready for review October 10, 2024 17:19
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces a new NoAssistantModal component and modifies the ChatPage to handle scenarios where no assistants are available in the chat interface.

  • Added /web/src/components/modals/NoAssistantModal.tsx to display different messages for admin and non-admin users when no assistants are available
  • Modified /web/src/app/chat/ChatPage.tsx to implement logic for showing the NoAssistantModal when necessary
  • Updated /web/src/components/BasicClickable.tsx to accept an optional 'className' prop for enhanced styling flexibility
  • Implemented conditional rendering in NoAssistantModal based on user admin status, providing appropriate guidance

3 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -139,7 +140,7 @@ export function ChatPage({

const [showApiKeyModal, setShowApiKeyModal] = useState(true);

const { user, refreshUser, isLoadingUser } = useUser();
const { user, refreshUser, isAdmin, isLoadingUser } = useUser();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider destructuring isAdmin from the useUser hook to improve readability

Comment on lines +1787 to +1793
{showApiKeyModal && !shouldShowWelcomeModal ? (
<ApiKeyModal
hide={() => setShowApiKeyModal(false)}
setPopup={setPopup}
/>
) : (
noAssistants && <NoAssistantModal isAdmin={isAdmin} />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider extracting this conditional rendering logic into a separate function for better readability

@@ -26,7 +28,9 @@ export function BasicClickable({
select-none
overflow-hidden
hover:bg-hover-light
${fullWidth ? "w-full" : ""}`}
${fullWidth ? "w-full" : ""}
${className ? className : ""}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: consider using template literal for className to avoid potential undefined value

onClick={() => {
window.location.href = "/admin/assistants";
}}
className="inline-flex flex justify-center items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-background-800 text-center focus:outline-none focus:ring-2 focus:ring-offset-2 "
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: remove duplicate 'flex' class

Comment on lines +22 to +23
window.location.href = "/admin/assistants";
}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: consider using Next.js router for navigation instead of directly manipulating window.location

@rkuo-danswer rkuo-danswer added this pull request to the merge queue Oct 10, 2024
Merged via the queue into main with commit 1581d35 Oct 10, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants