-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
feat(#677): turn settings into a separate page #731
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
next/src/types/modelSettings.ts
Outdated
export const [GPT_35_TURBO, GPT_4] = ["gpt-3.5-turbo" as const, "gpt-4" as const]; | ||
export const GPT_MODEL_NAMES = [GPT_35_TURBO, GPT_4]; | ||
export type GPTModelNames = typeof GPT_35_TURBO | typeof GPT_4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type GPTModelNames = "gpt-3.5-turbo" | "gpt-4"
I think something like this is a bit standard, then you just use the string literals directly (And typing is handled by Typescript)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that. I wanted to minimize duplicating "gpt-3.5-turbo"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it feels a bit weird but just they way typescript land works typically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Asim's approach :)
I think export type GPTModelNames = "gpt-3.5-turbo" | "gpt-4" is just frankly cleaner
This is looking good! Like the generics! |
</SidebarLayout> | ||
); | ||
}; | ||
|
||
export default SettingsPage; | ||
|
||
export const getStaticProps: GetStaticProps = async ({ locale = "en" }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to include this to get translation working. let me know if there's a better way to handle this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Cs4K1Sr4C any thoughts here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, just some minor things. Let me know if you wanna sync
next/src/pages/settings.tsx
Outdated
helpText={`${t("CONTROL_MAXIMUM_OF_TOKENS_DESCRIPTION", { | ||
ns: "settings", | ||
})}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this already returns a string, we don't need to wrap this in a paramaterized string:
helpText={`${t("CONTROL_MAXIMUM_OF_TOKENS_DESCRIPTION", { | |
ns: "settings", | |
})}`} | |
helpText={t("CONTROL_MAXIMUM_OF_TOKENS_DESCRIPTION", { ns: "settings"})} |
next/src/pages/settings.tsx
Outdated
})}`} | ||
/> | ||
<Input | ||
label={`${t("LOOP", { ns: "settings" })}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below :)
next/src/pages/settings.tsx
Outdated
max: 1, | ||
step: 0.01 | ||
}} | ||
helpText={`${t("HIGHER_VALUES_MAKE_OUTPUT_MORE_RANDOM", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see coment below :)
next/src/pages/settings.tsx
Outdated
|
||
<h1 className="mt-6">Advanced Settings</h1> | ||
<Input | ||
label={`${t("TEMPERATURE", { ns: "settings" })}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below :)
next/src/pages/settings.tsx
Outdated
})}`} | ||
/> | ||
<Input | ||
label={`${t("TOKENS", { ns: "settings" })}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below :)
next/src/ui/input.tsx
Outdated
@@ -0,0 +1,42 @@ | |||
import React from "react"; | |||
import {useTranslation} from "next-i18next"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import looks unused, let me know if you need help setting up prettier. Installing the prettier plugin will help with formatting 🎨
next/src/ui/input.tsx
Outdated
{...props.attributes} | ||
/> | ||
</div> | ||
{props.helpText && (<p className="mt-2 text-sm text-gray-500" id={`${props.name}-description`}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be som formatting issues here that prettier will solve
'language' as const, 'customModelName' as const, 'customTemperature' as const, 'customMaxLoops' as const, 'maxTokens' as const | ||
]; | ||
|
||
export interface ModelSettings { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jshen123 can we chat about this one?
Note quite sure of the benefit ohh this compared to:
export type ModelSettings = {
language?: string;
customModelName?: string;
customTemperature?: number;
customMaxLoops?: number;
maxTokens?: number;
};
name: "agentgpt-settings-storage", | ||
storage: createJSONStorage(() => localStorage), | ||
partialize: (state) => ({ | ||
[SETTINGS_LANGUAGE]: state[SETTINGS_LANGUAGE], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below about model settings
next/src/pages/settings.tsx
Outdated
|
||
const SettingsPage = () => { | ||
const [language, setLanguage] = useState<Language>(ENGLISH); | ||
const [t] = useTranslation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add the settings namescape here as default it can be removed from the rest of your translations
Hi @awtkns @asim-shrestha, what's the preference on how we are passing in props? :) |
@Jshen123 it depends on the context. Option two is probably better here as i think each prop is only used once |
@@ -25,7 +33,7 @@ const links = [ | |||
]; | |||
|
|||
interface Props extends PropsWithChildren { | |||
settings: SettingModel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making it optional since it's no longer needed for the new settings component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the commented change, all changes here are from Prettier
Resolves #677
Description:
save
)Future TODO:
useSettings
withmodelSettingsStore