This commit is contained in:
parent
95f6b25333
commit
eed052abe9
|
|
@ -9,7 +9,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import * as z from "zod";
|
import * as z from "zod";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { CheckIcon } from "lucide-react";
|
import { CheckIcon } from "lucide-react";
|
||||||
import { getApiSettings } from "@/lib/storage";
|
import { getApiSettingsAsync } from "@/lib/storage";
|
||||||
import { getBaseUrlForModel, getApiKeyForModel } from "@/lib/api-helpers";
|
import { getBaseUrlForModel, getApiKeyForModel } from "@/lib/api-helpers";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
@ -127,7 +127,9 @@ export function AnalysisForm({ onSubmit, loading = false }: AnalysisFormProps) {
|
||||||
const isDeepThinkCustom = deepThinkLlm === "custom";
|
const isDeepThinkCustom = deepThinkLlm === "custom";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const savedSettings = getApiSettings();
|
// Use async version to get decrypted API keys
|
||||||
|
const loadSettings = async () => {
|
||||||
|
const savedSettings = await getApiSettingsAsync();
|
||||||
|
|
||||||
// For custom models, always use custom base URL and API key
|
// For custom models, always use custom base URL and API key
|
||||||
if (isQuickThinkCustom) {
|
if (isQuickThinkCustom) {
|
||||||
|
|
@ -150,6 +152,9 @@ export function AnalysisForm({ onSubmit, loading = false }: AnalysisFormProps) {
|
||||||
form.setValue("embedding_api_key", savedSettings.custom_api_key || savedSettings.openai_api_key);
|
form.setValue("embedding_api_key", savedSettings.custom_api_key || savedSettings.openai_api_key);
|
||||||
form.setValue("alpha_vantage_api_key", savedSettings.alpha_vantage_api_key || "");
|
form.setValue("alpha_vantage_api_key", savedSettings.alpha_vantage_api_key || "");
|
||||||
form.setValue("finmind_api_key", savedSettings.finmind_api_key || "");
|
form.setValue("finmind_api_key", savedSettings.finmind_api_key || "");
|
||||||
|
};
|
||||||
|
|
||||||
|
loadSettings();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [quickThinkLlm, deepThinkLlm, isQuickThinkCustom, isDeepThinkCustom]);
|
}, [quickThinkLlm, deepThinkLlm, isQuickThinkCustom, isDeepThinkCustom]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue