Skip to content

Commit

Permalink
feat(frontend): add help tooltip for model selection (#2318)
Browse files Browse the repository at this point in the history
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
Zewed authored Mar 7, 2024
1 parent 5a19597 commit e96e4f7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export const ModelSelection = (props: ModelSelectionProps): JSX.Element => {
value: accessibleModelOptions[0].value as Model,
})}
>
<FieldHeader label="Model" iconName="robot" />
<FieldHeader
label="Model"
iconName="robot"
help="Changing the model could make this brain smarter, understanding you better and giving you more helpful answers."
/>
<SingleSelector
options={accessibleModelOptions}
onChange={(option) => {
Expand All @@ -44,7 +48,11 @@ export const ModelSelection = (props: ModelSelectionProps): JSX.Element => {
/>
</fieldset>
<fieldset>
<FieldHeader label="Max tokens" iconName="hashtag" />
<FieldHeader
label="Max tokens"
iconName="hashtag"
help="Increasing the number of tokens this brain can use in its replies will give you more detailed answers"
/>
<div className={styles.max_tokens}>
<input
className={styles.slider}
Expand Down
11 changes: 11 additions & 0 deletions frontend/lib/components/ui/FieldHeader/FieldHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import Tooltip from "@/lib/components/ui/Tooltip/Tooltip";

import styles from "./FieldHeader.module.scss";

import { Icon } from "../Icon/Icon";

type FieldHeaderProps = {
iconName: string;
label: string;
help?: string;
};

export const FieldHeader = ({
iconName,
label,
help,
}: FieldHeaderProps): JSX.Element => {
return (
<div className={styles.field_header_wrapper}>
<Icon name={iconName} color="black" size="small" />
<label>{label}</label>
{help && (
<Tooltip tooltip={help}>
<div>
<Icon name="help" size="normal" color="black" handleHover={true} />
</div>
</Tooltip>
)}
</div>
);
};

0 comments on commit e96e4f7

Please sign in to comment.