Merge branch 'ji' of http://192.168.0.200/knowledge-base-bj/deerflow-server into ji
This commit is contained in:
commit
7b6dd9ba6f
23 files changed
+1888
-572
No files matched your search
@@ -55,6 +55,13 @@ export interface LocalSettings {
|
||||
* app sizes text/spacing in rem, the whole UI scales proportionally.
|
||||
*/
|
||||
fontScale: number;
|
||||
/**
|
||||
* Per-user override for the skill / agent list display mode (card vs list).
|
||||
* `undefined` = follow the admin-configured system default. Set when the
|
||||
* user flips the card/list toggle on the skills or agents page.
|
||||
*/
|
||||
skillViewMode?: "card" | "list";
|
||||
agentViewMode?: "card" | "list";
|
||||
};
|
||||
context: Omit<
|
||||
AgentThreadContext,
|
||||
|
||||
@@ -90,13 +90,18 @@ export async function loadPrivateSquareStatus(): Promise<PrivateSquareStatus> {
|
||||
}
|
||||
|
||||
export type ThemeMode = "light" | "dark";
|
||||
export type ViewMode = "card" | "list";
|
||||
|
||||
export interface AppearanceSettings {
|
||||
default_theme: ThemeMode;
|
||||
default_skill_view: ViewMode;
|
||||
default_agent_view: ViewMode;
|
||||
}
|
||||
|
||||
export interface AppearanceUpdate {
|
||||
default_theme?: ThemeMode;
|
||||
default_skill_view?: ViewMode;
|
||||
default_agent_view?: ViewMode;
|
||||
}
|
||||
|
||||
export async function loadAppearanceSettings(): Promise<AppearanceSettings> {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { useLocalSettings } from "@/core/settings";
|
||||
|
||||
import {
|
||||
loadAppearanceSettings,
|
||||
loadCitationDisplaySettings,
|
||||
@@ -16,6 +18,7 @@ import {
|
||||
type LeaderboardSettingsUpdate,
|
||||
type PrivateSquareUpdate,
|
||||
type PromptPrefixUpdate,
|
||||
type ViewMode,
|
||||
} from "./api";
|
||||
|
||||
const PROMPT_PREFIX_KEY = ["systemSettings", "promptPrefix"] as const;
|
||||
@@ -86,6 +89,31 @@ export function useUpdateAppearanceSettings() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Effective card/list display mode for the skill or agent list. A user's own
|
||||
* choice (persisted in local settings) wins; otherwise the admin-configured
|
||||
* system default applies; otherwise a built-in fallback (skills → list,
|
||||
* agents → card, matching the historical layout of each page). `setMode`
|
||||
* persists the user's override locally.
|
||||
*/
|
||||
export function useViewMode(
|
||||
kind: "skill" | "agent",
|
||||
): [ViewMode, (mode: ViewMode) => void] {
|
||||
const [settings, setSettings] = useLocalSettings();
|
||||
const { data: appearance } = useAppearanceSettings();
|
||||
const overrideKey = kind === "skill" ? "skillViewMode" : "agentViewMode";
|
||||
const userOverride = settings.display[overrideKey];
|
||||
const adminDefault =
|
||||
kind === "skill"
|
||||
? appearance?.default_skill_view
|
||||
: appearance?.default_agent_view;
|
||||
const fallback: ViewMode = kind === "skill" ? "list" : "card";
|
||||
const mode: ViewMode = userOverride ?? adminDefault ?? fallback;
|
||||
const setMode = (next: ViewMode) =>
|
||||
setSettings("display", { [overrideKey]: next });
|
||||
return [mode, setMode];
|
||||
}
|
||||
|
||||
export function useCitationDisplaySettings() {
|
||||
return useQuery({
|
||||
queryKey: CITATION_DISPLAY_KEY,
|
||||
|
||||
Reference in new issue
Block a user