forked from hoarder-app/hoarder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Admin settings config hoarder-app#282
created the basic structure
- Loading branch information
1 parent
8b69cdd
commit 33f49ef
Showing
6 changed files
with
467 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
import { cn } from "@/lib/utils"; | ||
import * as SwitchPrimitives from "@radix-ui/react-switch"; | ||
|
||
const Switch = React.forwardRef< | ||
React.ElementRef<typeof SwitchPrimitives.Root>, | ||
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> | ||
>(({ className, ...props }, ref) => ( | ||
<SwitchPrimitives.Root | ||
className={cn( | ||
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", | ||
className, | ||
)} | ||
{...props} | ||
ref={ref} | ||
> | ||
<SwitchPrimitives.Thumb | ||
className={cn( | ||
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0", | ||
)} | ||
/> | ||
</SwitchPrimitives.Root> | ||
)); | ||
Switch.displayName = SwitchPrimitives.Root.displayName; | ||
|
||
export { Switch }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
import { z } from "zod"; | ||
|
||
import { | ||
ConfigType, | ||
ConfigValue, | ||
InferenceProviderEnum, | ||
InferenceProviderEnumValidator, | ||
} from "./configValue"; | ||
|
||
export const SectionSymbol = Symbol("section"); | ||
|
||
export interface SectionInformation { | ||
name: string; | ||
} | ||
|
||
export interface ConfigSubSection { | ||
[SectionSymbol]: SectionInformation; | ||
[configValue: string]: ConfigValue<ConfigType>; | ||
} | ||
|
||
export type ServerConfig = Record<string, ConfigSubSection>; | ||
|
||
export const serverConfig: ServerConfig = { | ||
generalConfig: { | ||
[SectionSymbol]: { | ||
name: "General", | ||
}, | ||
disableSignups: new ConfigValue({ | ||
key: "DISABLE_SIGNUPS", | ||
name: "Disable Signups", | ||
type: ConfigType.BOOLEAN, | ||
defaultValue: false, | ||
validator: z.boolean(), | ||
}), | ||
maxAssetSize: new ConfigValue({ | ||
key: "MAX_ASSET_SIZE_MB", | ||
name: "Maximum Asset size(MB)", | ||
type: ConfigType.NUMBER, | ||
defaultValue: 4, | ||
validator: z.number().positive(), | ||
}), | ||
disableNewReleaseCheck: new ConfigValue({ | ||
key: "DISABLE_NEW_RELEASE_CHECK", | ||
name: "Disable new release check", | ||
type: ConfigType.BOOLEAN, | ||
defaultValue: false, | ||
validator: z.boolean(), | ||
}), | ||
}, | ||
crawlerConfig: { | ||
[SectionSymbol]: { | ||
name: "Crawler", | ||
}, | ||
downloadBannerImage: new ConfigValue({ | ||
key: "CRAWLER_DOWNLOAD_BANNER_IMAGE", | ||
name: "Download Banner Image", | ||
type: ConfigType.BOOLEAN, | ||
defaultValue: true, | ||
validator: z.boolean(), | ||
}), | ||
storeScreenshot: new ConfigValue({ | ||
key: "CRAWLER_STORE_SCREENSHOT", | ||
name: "Disable screenshots", | ||
type: ConfigType.BOOLEAN, | ||
defaultValue: true, | ||
validator: z.boolean(), | ||
}), | ||
storeFullPageScreenshot: new ConfigValue({ | ||
key: "CRAWLER_FULL_PAGE_SCREENSHOT", | ||
name: "Store full page screenshots", | ||
type: ConfigType.BOOLEAN, | ||
defaultValue: false, | ||
validator: z.boolean(), | ||
}), | ||
fullPageArchive: new ConfigValue({ | ||
key: "CRAWLER_FULL_PAGE_ARCHIVE", | ||
name: "Store full page archive", | ||
type: ConfigType.BOOLEAN, | ||
defaultValue: false, | ||
validator: z.boolean(), | ||
}), | ||
jobTimeout: new ConfigValue({ | ||
key: "CRAWLER_JOB_TIMEOUT_SEC", | ||
name: "Job Timeout (sec)", | ||
type: ConfigType.NUMBER, | ||
defaultValue: 60, | ||
validator: z.number().positive(), | ||
}), | ||
navigateTimeout: new ConfigValue({ | ||
key: "CRAWLER_NAVIGATE_TIMEOUT_SEC", | ||
name: "Navigate Timeout (sec)", | ||
type: ConfigType.NUMBER, | ||
defaultValue: 30, | ||
validator: z.number().positive(), | ||
}), | ||
}, | ||
inferenceConfig: { | ||
[SectionSymbol]: { | ||
name: "Inference Config", | ||
}, | ||
inferenceProvider: new ConfigValue({ | ||
key: "INFERENCE_PROVIDER", | ||
name: "Inference Provider", | ||
type: ConfigType.INFERENCE_PROVIDER_ENUM, | ||
defaultValue: InferenceProviderEnum.DISABLED, | ||
validator: InferenceProviderEnumValidator, | ||
}), | ||
openApiKey: new ConfigValue({ | ||
key: "OPENAI_API_KEY", | ||
name: "OpenAPI Key", | ||
type: ConfigType.STRING, | ||
defaultValue: "", | ||
validator: z.string(), | ||
}), | ||
openAiBaseUrl: new ConfigValue({ | ||
key: "OPENAI_BASE_URL", | ||
name: "OpenAPI base URL", | ||
type: ConfigType.STRING, | ||
defaultValue: "", | ||
validator: z.string(), | ||
}), | ||
ollamaBaseUrl: new ConfigValue({ | ||
key: "OLLAMA_BASE_URL", | ||
name: "Ollama base URL", | ||
type: ConfigType.STRING, | ||
defaultValue: "", | ||
validator: z.string(), | ||
}), | ||
inferenceTextModel: new ConfigValue({ | ||
key: "INFERENCE_TEXT_MODEL", | ||
name: "Inference text model", | ||
type: ConfigType.STRING, | ||
defaultValue: "gpt-3.5-turbo-0125", | ||
validator: z.string(), | ||
}), | ||
inferenceImageModel: new ConfigValue({ | ||
key: "INFERENCE_IMAGE_MODEL", | ||
name: "Inference image model", | ||
type: ConfigType.STRING, | ||
defaultValue: "gpt-4o-2024-05-13", | ||
validator: z.string(), | ||
}), | ||
inferenceLanguage: new ConfigValue({ | ||
key: "INFERENCE_LANG", | ||
name: "Inference language", | ||
type: ConfigType.STRING, | ||
defaultValue: "english", | ||
validator: z.string(), | ||
}), | ||
}, | ||
}; |
Oops, something went wrong.