Skip to content

Commit 2a3a534

Browse files
EstrellaXDclaude
andcommitted
feat(webui): redesign LLM settings section
- Rename "Experimental Setting" to "LLM Settings" with cleaner labels - Replace jarring yellow warning banner with subtle themed notice - Only show config fields when LLM is enabled (slide-fade transition) - Add gpt-4o and gpt-4o-mini to model options - Use scoped CSS instead of UnoCSS utility classes for the section - Update i18n labels for both en and zh-CN Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a98a162 commit 2a3a534

4 files changed

Lines changed: 97 additions & 42 deletions

File tree

webui/src/components/setting/config-openai.vue

Lines changed: 78 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,10 @@ const { t } = useMyI18n();
77
const { getSettingGroup } = useConfigStore();
88
99
const openAI = getSettingGroup('experimental_openai');
10-
const openAIModels: OpenAIModel = ['gpt-3.5-turbo'];
10+
const openAIModels: OpenAIModel = ['gpt-4o', 'gpt-4o-mini', 'gpt-3.5-turbo'];
1111
const openAITypes: OpenAIType = ['openai', 'azure'];
1212
13-
const sharedItems: SettingItem<ExperimentalOpenAI>[] = [
14-
{
15-
configKey: 'enable',
16-
label: () => t('config.experimental_openai_set.enable'),
17-
type: 'switch',
18-
},
13+
const providerItems: SettingItem<ExperimentalOpenAI>[] = [
1914
{
2015
configKey: 'api_type',
2116
label: () => t('config.experimental_openai_set.api_type'),
@@ -30,7 +25,7 @@ const sharedItems: SettingItem<ExperimentalOpenAI>[] = [
3025
type: 'input',
3126
prop: {
3227
type: 'password',
33-
placeholder: 'e.g: sk-3Bl****w2E9kW',
28+
placeholder: 'sk-...',
3429
},
3530
},
3631
{
@@ -39,12 +34,12 @@ const sharedItems: SettingItem<ExperimentalOpenAI>[] = [
3934
type: 'input',
4035
prop: {
4136
type: 'url',
42-
placeholder: 'OpenAI API Base URL',
37+
placeholder: 'https://api.openai.com/v1',
4338
},
4439
},
4540
];
41+
4642
const openAIItems: SettingItem<ExperimentalOpenAI>[] = [
47-
...sharedItems,
4843
{
4944
configKey: 'model',
5045
label: () => t('config.experimental_openai_set.model'),
@@ -56,14 +51,13 @@ const openAIItems: SettingItem<ExperimentalOpenAI>[] = [
5651
];
5752
5853
const azureItems: SettingItem<ExperimentalOpenAI>[] = [
59-
...sharedItems,
6054
{
6155
configKey: 'api_version',
6256
label: () => t('config.experimental_openai_set.api_version'),
6357
type: 'input',
6458
prop: {
6559
type: 'text',
66-
placeholder: 'e.g: 2023-05-15',
60+
placeholder: '2024-02-01',
6761
},
6862
},
6963
{
@@ -72,26 +66,87 @@ const azureItems: SettingItem<ExperimentalOpenAI>[] = [
7266
type: 'input',
7367
prop: {
7468
type: 'text',
75-
placeholder: 'e.g: gpt-35-turbo',
69+
placeholder: 'gpt-4o',
7670
},
7771
},
7872
];
7973
</script>
8074

8175
<template>
8276
<ab-fold-panel :title="$t('config.experimental_openai_set.title')">
83-
<div fx-cer gap-2 mb-4 p-2 bg-amber-300 rounded-4>
84-
<Caution />
85-
<span>{{ $t('config.experimental_openai_set.warning') }}</span>
86-
</div>
77+
<div class="openai-section">
78+
<div class="openai-notice">
79+
<Caution size="16" />
80+
<span>{{ $t('config.experimental_openai_set.warning') }}</span>
81+
</div>
8782

88-
<div space-y-8>
8983
<ab-setting
90-
v-for="i in openAI.api_type === 'azure' ? azureItems : openAIItems"
91-
:key="i.configKey"
92-
v-bind="i"
93-
v-model:data="openAI[i.configKey]"
94-
></ab-setting>
84+
config-key="enable"
85+
:label="() => t('config.experimental_openai_set.enable')"
86+
type="switch"
87+
v-model:data="openAI.enable"
88+
/>
89+
90+
<transition name="slide-fade">
91+
<div v-if="openAI.enable" class="openai-config">
92+
<ab-setting
93+
v-for="i in providerItems"
94+
:key="i.configKey"
95+
v-bind="i"
96+
v-model:data="openAI[i.configKey]"
97+
/>
98+
99+
<ab-setting
100+
v-for="i in openAI.api_type === 'azure' ? azureItems : openAIItems"
101+
:key="i.configKey"
102+
v-bind="i"
103+
v-model:data="openAI[i.configKey]"
104+
/>
105+
</div>
106+
</transition>
95107
</div>
96108
</ab-fold-panel>
97109
</template>
110+
111+
<style lang="scss" scoped>
112+
.openai-section {
113+
display: flex;
114+
flex-direction: column;
115+
gap: 16px;
116+
}
117+
118+
.openai-notice {
119+
display: flex;
120+
align-items: center;
121+
gap: 8px;
122+
padding: 8px 12px;
123+
border-radius: var(--radius-sm);
124+
background: color-mix(in srgb, var(--color-warning) 10%, transparent);
125+
border: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
126+
color: var(--color-warning);
127+
font-size: 12px;
128+
transition: background-color var(--transition-normal),
129+
border-color var(--transition-normal);
130+
}
131+
132+
.openai-config {
133+
display: flex;
134+
flex-direction: column;
135+
gap: 16px;
136+
padding-top: 4px;
137+
}
138+
139+
.slide-fade-enter-active {
140+
transition: all 0.2s ease-out;
141+
}
142+
143+
.slide-fade-leave-active {
144+
transition: all 0.15s ease-in;
145+
}
146+
147+
.slide-fade-enter-from,
148+
.slide-fade-leave-to {
149+
opacity: 0;
150+
transform: translateY(-8px);
151+
}
152+
</style>

webui/src/i18n/en.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"username": "Username"
1313
},
1414
"experimental_openai_set": {
15-
"api_base": "OpenAI API Base URL (Azure entrypoint)",
16-
"api_key": "OpenAI API Key",
17-
"api_type": "OpenAI API Type",
18-
"api_version": "Azure OpenAI Version",
19-
"deployment_id": "Azure OpenAI Deployment ID",
20-
"enable": "Enable OpenAI",
21-
"model": "OpenAI Model",
22-
"title": "Experimental Setting",
23-
"warning": "Warning: Experimental feature is not yet stable. Please use with caution."
15+
"api_base": "API Base URL",
16+
"api_key": "API Key",
17+
"api_type": "Provider",
18+
"api_version": "API Version",
19+
"deployment_id": "Deployment ID",
20+
"enable": "Enable LLM Parsing",
21+
"model": "Model",
22+
"title": "LLM Settings",
23+
"warning": "Experimental: LLM-based anime title parsing may produce inaccurate results."
2424
},
2525
"manage_set": {
2626
"delete_bad_torrent": "Delete Bad Torrent",

webui/src/i18n/zh-CN.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"username": "用户名"
1313
},
1414
"experimental_openai_set": {
15-
"api_base": "OpenAI API Base URL (Azure entrypoint)",
16-
"api_key": "OpenAI API Key",
17-
"api_type": "OpenAI API 类型",
18-
"api_version": "Azure OpenAI 版本",
19-
"deployment_id": "Azure OpenAI Deployment ID",
20-
"enable": "启用 OpenAI",
21-
"model": "OpenAI 模型",
22-
"title": "实验功能设置",
23-
"warning": "警告:实验功能尚未稳定,请谨慎使用"
15+
"api_base": "API 地址",
16+
"api_key": "API 密钥",
17+
"api_type": "服务商",
18+
"api_version": "API 版本",
19+
"deployment_id": "部署 ID",
20+
"enable": "启用 LLM 解析",
21+
"model": "模型",
22+
"title": "LLM 设置",
23+
"warning": "实验功能:基于 LLM 的番剧标题解析可能产生不准确的结果。"
2424
},
2525
"manage_set": {
2626
"delete_bad_torrent": "删除坏种",

webui/types/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type ProxyType = ['http', 'https', 'socks5'];
1515
/** 通知类型 */
1616
export type NotificationType = ['telegram', 'server-chan', 'bark', 'wecom'];
1717
/** OpenAI Model List */
18-
export type OpenAIModel = ['gpt-3.5-turbo'];
18+
export type OpenAIModel = ['gpt-4o', 'gpt-4o-mini', 'gpt-3.5-turbo'];
1919
/** OpenAI API Type */
2020
export type OpenAIType = ['openai', 'azure'];
2121

0 commit comments

Comments
 (0)