diff --git a/backend/src/module/models/config.py b/backend/src/module/models/config.py index df15546a..3358124b 100644 --- a/backend/src/module/models/config.py +++ b/backend/src/module/models/config.py @@ -81,6 +81,13 @@ class Notification(BaseModel): return expandvars(self.chat_id_) +class Experimental(BaseModel): + openai_enable: bool = Field(False, description="Enable experimental OpenAI") + openai_api_key: str = Field("", description="OpenAI api key") + openai_api_base: str = Field("", description="OpenAI api base url") + openai_model: str = Field("", description="OpenAI model") + + class Config(BaseModel): program: Program = Program() downloader: Downloader = Downloader() @@ -89,6 +96,7 @@ class Config(BaseModel): log: Log = Log() proxy: Proxy = Proxy() notification: Notification = Notification() + Experimental: Experimental = Experimental() def dict(self, *args, by_alias=True, **kwargs): return super().dict(*args, by_alias=by_alias, **kwargs) diff --git a/webui/src/components/setting/config-experimental.vue b/webui/src/components/setting/config-experimental.vue new file mode 100644 index 00000000..dc9dff27 --- /dev/null +++ b/webui/src/components/setting/config-experimental.vue @@ -0,0 +1,45 @@ + + + diff --git a/webui/src/i18n/zh-CN.json b/webui/src/i18n/zh-CN.json index 76f89613..2383cb8b 100644 --- a/webui/src/i18n/zh-CN.json +++ b/webui/src/i18n/zh-CN.json @@ -137,6 +137,13 @@ "username": "用户名", "password": "密码" }, + "experimental_set": { + "title": "实验功能设置", + "openai_enable": "启用 OpenAI", + "openai_api_key": "OpenAI API Key", + "openai_api_base": "OpenAI API Base URL", + "openai_model": "OpenAI 模型" + }, "media_player_set": { "title": "播放器设置", "type": "类型", diff --git a/webui/src/pages/index/config.vue b/webui/src/pages/index/config.vue index 55e6e183..afc5fd14 100644 --- a/webui/src/pages/index/config.vue +++ b/webui/src/pages/index/config.vue @@ -28,6 +28,8 @@ definePage({ + + diff --git a/webui/types/config.ts b/webui/types/config.ts index 12c19937..00e40f1d 100644 --- a/webui/types/config.ts +++ b/webui/types/config.ts @@ -47,6 +47,12 @@ export interface Config { token: string; chat_id: string; }; + experimental: { + openai_enable: boolean; + openai_api_key: string; + openai_api_base: string; + openai_model: string; + }; } export const initConfig: Config = { @@ -96,6 +102,12 @@ export const initConfig: Config = { token: '', chat_id: '', }, + experimental: { + openai_enable: false, + openai_api_key: '', + openai_api_base: '', + openai_model: 'gpt-3.5-turbo', + }, }; type getItem = Pick[T]; @@ -107,6 +119,7 @@ export type BangumiManage = getItem<'bangumi_manage'>; export type Log = getItem<'log'>; export type Proxy = getItem<'proxy'>; export type Notification = getItem<'notification'>; +export type Experimental = getItem<'experimental'>; /** 下载方式 */ export type DownloaderType = UnionToTuple; diff --git a/webui/types/dts/components.d.ts b/webui/types/dts/components.d.ts index cc313003..12def335 100644 --- a/webui/types/dts/components.d.ts +++ b/webui/types/dts/components.d.ts @@ -34,6 +34,7 @@ declare module '@vue/runtime-core' { AbTag: typeof import('./../../src/components/basic/ab-tag.vue')['default'] AbTopbar: typeof import('./../../src/components/layout/ab-topbar.vue')['default'] ConfigDownload: typeof import('./../../src/components/setting/config-download.vue')['default'] + ConfigExperimental: typeof import('./../../src/components/setting/config-experimental.vue')['default'] ConfigManage: typeof import('./../../src/components/setting/config-manage.vue')['default'] ConfigNormal: typeof import('./../../src/components/setting/config-normal.vue')['default'] ConfigNotification: typeof import('./../../src/components/setting/config-notification.vue')['default']