refactor(OptionHover.jsx): simplify types object by removing unnecessary nesting and description keys

This commit is contained in:
Daniel Avila 2023-03-31 17:35:30 -04:00
parent 97e3ff6b6f
commit 92dbdcaaa2

View file

@ -1,38 +1,16 @@
import React from 'react'; import React from 'react';
import { import { HoverCardPortal, HoverCardContent } from '~/components/ui/HoverCard.tsx';
// HoverCard,
// HoverCardTrigger,
HoverCardPortal,
HoverCardContent
} from '~/components/ui/HoverCard.tsx';
// import { cn } from '~/utils/';
const types = { const types = {
temp: { temp: 'Higher values = more random, while lower values = more focused and deterministic. We recommend altering this or Top P but not both.',
description: max: "The max tokens to generate. The total length of input tokens and generated tokens is limited by the model's context length.",
'Higher values = more random, while lower values = more focused and deterministic. We recommend altering this or Top P but not both.' 'top-p':
}, 'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We recommend altering this or temperature but not both.',
max: { freq: "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.",
description: pres: "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."
'The max tokens to generate. The total length of input tokens and generated tokens is limited by the model\'s context length.'
},
'top-p': {
description:
'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We recommend altering this or temperature but not both.'
},
freq: {
description:
'Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim.'
},
pres: {
description:
'Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics.'
},
}; };
function OptionHover({ type, side }) { function OptionHover({ type, side }) {
const options = {}; const options = {};
if (type === 'pres') { if (type === 'pres') {
@ -41,9 +19,13 @@ function OptionHover({ type, side }) {
return ( return (
<HoverCardPortal> <HoverCardPortal>
<HoverCardContent side={side} className="w-52 " {...options}> <HoverCardContent
side={side}
className="w-52 "
{...options}
>
<div className="space-y-2"> <div className="space-y-2">
<p className="text-sm text-gray-600 dark:text-gray-300">{types[type].description}</p> <p className="text-sm text-gray-600 dark:text-gray-300">{types[type]}</p>
</div> </div>
</HoverCardContent> </HoverCardContent>
</HoverCardPortal> </HoverCardPortal>