feat: update admin navigation and configuration for local deployment, enhance user experience with direct API connections

This commit is contained in:
HouYunFei
2026-06-16 12:07:35 +08:00
parent 0d90465339
commit 8a66524ea7
83 changed files with 649 additions and 7173 deletions
+5 -3
View File
@@ -1,4 +1,4 @@
import { apiGet, compactApiParams } from "@/services/api/request";
import { compactApiParams, serializeApiParams } from "@/services/api/request";
export type Prompt = {
id: string;
@@ -23,8 +23,7 @@ export type PromptListResponse = {
};
export async function fetchPrompts({ keyword = "", tag = [], category = ALL_PROMPTS_OPTION, page, pageSize }: { keyword?: string; tag?: string[]; category?: string; page?: number; pageSize?: number } = {}) {
return apiGet<PromptListResponse>(
"/api/prompts",
const params = serializeApiParams(
compactApiParams({
...(keyword ? { keyword } : {}),
...(tag.length ? { tag } : {}),
@@ -33,6 +32,9 @@ export async function fetchPrompts({ keyword = "", tag = [], category = ALL_PROM
...(pageSize ? { pageSize } : {}),
}),
);
const response = await fetch(`/api/prompts${params.size ? `?${params}` : ""}`);
if (!response.ok) throw new Error("获取提示词失败");
return (await response.json()) as PromptListResponse;
}
export function formatPromptDate(value: string) {