Add log level Selector for whisperai and others

Add log level Selector Input type for use by whisperai and others. Options include all 5 Python logging levels.
This commit is contained in:
JayZed 2023-12-19 20:53:26 -05:00
parent 20acf3de4c
commit cb80b9d3db
1 changed files with 17 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import { ReactText } from "react";
import { SelectorOption } from "@/components";
type Input<T, N> = {
type: N;
@ -6,12 +7,14 @@ type Input<T, N> = {
defaultValue?: T;
name?: string;
description?: string;
options?: SelectorOption<string>[];
};
type AvailableInput =
| Input<ReactText, "text">
| Input<string, "password">
| Input<boolean, "switch">
| Input<string, "select">
| Input<ReactText[], "chips">;
export interface ProviderInfo {
@ -22,6 +25,14 @@ export interface ProviderInfo {
inputs?: AvailableInput[];
}
export const logLevelOptions: SelectorOption<string>[] = [
{ label: "DEBUG", value: "DEBUG" },
{ label: "INFO", value: "INFO" },
{ label: "WARNING", value: "WARNING" },
{ label: "ERROR", value: "ERROR" },
{ label: "CRITICAL", value: "CRITICAL" },
];
export const ProviderList: Readonly<ProviderInfo[]> = [
{
key: "addic7ed",
@ -221,6 +232,12 @@ export const ProviderList: Readonly<ProviderInfo[]> = [
defaultValue: 3600,
name: "Transcription/translation timeout in seconds",
},
{
type: "select",
key: "loglevel",
name: "Logging level",
options: logLevelOptions,
},
],
},
{