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

Fix gpt presets loading #928

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions enjoy/src/renderer/pages/conversations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default () => {
const [creating, setCreating] = useState<boolean>(false);
const [preset, setPreset] = useState<any>({});
const [config, setConfig] = useState<any>({
gptPresets: [],
gptPresets: GPT_PRESETS,
customPreset: {},
ttsPreset: {
key: "tts",
Expand Down Expand Up @@ -168,7 +168,10 @@ export default () => {
const defaultGpt = await webApi.config("default_gpt_preset");
const defaultTts = await webApi.config("default_tts_preset");

presets = gptPresets;
if (gptPresets.length > 0) {
presets = [...gptPresets];
}

if (defaultGpt.engine === currentEngine.name) {
defaultGpt.key = "custom";
defaultGpt.name = t("custom");
Expand Down Expand Up @@ -242,8 +245,6 @@ export default () => {
{t("chooseFromPresetGpts")}
</div>
<ScrollArea className="h-64 pr-4">
{config.gptPresets.length === 0 && <LoaderSpin />}

{config.gptPresets.map((preset: any) => (
<DialogTrigger
key={preset.key}
Expand Down
Loading