Fix TypeScript error: type AiSettings query result explicitly
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
22fc1ce2f1
commit
b1c160f607
1 changed files with 8 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ import {
|
||||||
} from "@/api/auth";
|
} from "@/api/auth";
|
||||||
import { listBackups, triggerBackup, downloadBackup, restoreBackup } from "@/api/admin";
|
import { listBackups, triggerBackup, downloadBackup, restoreBackup } from "@/api/admin";
|
||||||
import { getAiSettings, saveAiSettings, clearAiSettings } from "@/api/settings";
|
import { getAiSettings, saveAiSettings, clearAiSettings } from "@/api/settings";
|
||||||
|
import type { AiSettings } from "@/api/settings";
|
||||||
import type { BackupFile } from "@/api/admin";
|
import type { BackupFile } from "@/api/admin";
|
||||||
import { cn } from "@/utils/cn";
|
import { cn } from "@/utils/cn";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
|
@ -660,11 +661,14 @@ function AiSection() {
|
||||||
const [showKey, setShowKey] = useState(false);
|
const [showKey, setShowKey] = useState(false);
|
||||||
const [success, setSuccess] = useState("");
|
const [success, setSuccess] = useState("");
|
||||||
|
|
||||||
const { data: current, isLoading } = useQuery({
|
const { data: current, isLoading } = useQuery<AiSettings>({
|
||||||
queryKey: ["ai-settings"],
|
queryKey: ["ai-settings"],
|
||||||
queryFn: getAiSettings,
|
queryFn: async () => {
|
||||||
onSuccess: (d: any) => { if (d.provider) setProvider(d.provider); },
|
const d = await getAiSettings();
|
||||||
} as any);
|
if (d.provider) setProvider(d.provider);
|
||||||
|
return d;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const saveMutation = useMutation({
|
const saveMutation = useMutation({
|
||||||
mutationFn: () => saveAiSettings(provider, apiKey),
|
mutationFn: () => saveAiSettings(provider, apiKey),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue