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

Add the feature of side navigation and preview. #39

Merged
merged 12 commits into from
Jul 29, 2024
Merged

Add the feature of side navigation and preview. #39

merged 12 commits into from
Jul 29, 2024

Conversation

StarConnor
Copy link
Collaborator

  1. Add a module in sidenav.tsx in ui/src/components/app/ to support side navigation.

    • The side navigation has the feature of showing a blue bar and coloring the text blue when the users scroll to the corresponding part of the webpage, see figure->
      image | 50*50
    • The CSS configuration is set as .side-nav in ui/src/globals.css and the html CSS snippet is used to make the movement smooth.
  2. Add the id description of the "Top", "Interp.", "Hist.", "Logits", "Act." to corresponding <div> components. These serve as the links and side navigation could reach the links through <a href="#xxx">.

  3. To avoid too many sample tabs that could exceed the width of the wrapping card, I split the sample tabs into 2 parts. Because the new analysis seems to use 10 sample configs (i.e. "Top Activation", "Sample 90%", ..., "Sample 10%"), the split seems to be perfectly fitted with the card width. See figure->
    image

@StarConnor StarConnor requested a review from dest1n1s July 27, 2024 12:01
@StarConnor StarConnor changed the title Add the feature of side navigation. Add the feature of side navigation and preview. Jul 28, 2024
@StarConnor
Copy link
Collaborator Author

Fix some bugs left in the last commit.

@StarConnor
Copy link
Collaborator Author

Add the feature of preview.

Explain

Adjust the display of every sample from static block to the "accordion", which will display the context around the token which has the max activation in the sample (100 tokens before and 100 tokens after) and display the whole sample on the click.

Implementation

In the file ui/src/components/feature/sample.tsx

  1. Wrap the previous return of sample block with the accordion component.
  2. Add the preparation of the tokens around the token which has the max activation. This will be counted as the AccordionTrigger contents. (Note: the preparation is sort of redundant, but I didn't know how to make it neater).

In the file ui/src/components/ui/accordion.tsx

  1. Modify the accordion component in ui/src/components/ui/accordion.tsx. Concretely, I delete the style of hover:underline because the accordion trigger content will has an underline if you hover over it (this is annoying).

@dest1n1s dest1n1s merged commit 98e74ba into main Jul 29, 2024
1 check passed
@dest1n1s dest1n1s deleted the ui branch July 29, 2024 01:57
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