fix: fix openAI settings form & file rename

This commit is contained in:
Rewrite0
2023-10-06 05:12:10 +00:00
committed by GitHub
parent 88c4bd082c
commit c403e266ea
5 changed files with 17 additions and 9 deletions

View File

@@ -1,12 +1,13 @@
<script lang="ts" setup>
import { Caution } from '@icon-park/vue-next';
import type { SettingItem } from '#/components';
import type { ExperimentalOpenAI } from '#/config';
import type { ExperimentalOpenAI, OpenAIModel } from '#/config';
const { t } = useMyI18n();
const { getSettingGroup } = useConfigStore();
const experimentalFeatures = getSettingGroup('experimental_openai');
const openAI = getSettingGroup('experimental_openai');
const openAIModels: OpenAIModel = ['gpt-3.5-turbo'];
const items: SettingItem<ExperimentalOpenAI>[] = [
{
@@ -36,6 +37,9 @@ const items: SettingItem<ExperimentalOpenAI>[] = [
configKey: 'model',
label: () => t('config.experimental_openai_set.model'),
type: 'select',
prop: {
items: openAIModels,
},
},
];
</script>
@@ -46,12 +50,13 @@ const items: SettingItem<ExperimentalOpenAI>[] = [
<Caution />
<span>{{ $t('config.experimental_openai_set.warning') }}</span>
</div>
<div space-y-12px>
<ab-setting
v-for="i in items"
:key="i.configKey"
v-bind="i"
v-model:data="experimentalFeatures[i.configKey]"
v-model:data="openAI[i.configKey]"
></ab-setting>
</div>
</ab-fold-panel>

View File

@@ -29,14 +29,14 @@ definePage({
<config-player></config-player>
<config-experimental></config-experimental>
<config-openai></config-openai>
</div>
</div>
<div fx-cer justify-end gap-8px mt-20px>
<ab-button type="warn" @click="getConfig">{{
$t('config.cancel')
}}</ab-button>
<ab-button type="warn" @click="getConfig">
{{ $t('config.cancel') }}
</ab-button>
<ab-button @click="setConfig">{{ $t('config.apply') }}</ab-button>
</div>
</div>

View File

@@ -51,7 +51,7 @@ export interface Config {
enable: boolean;
api_key: string;
api_base: string;
model: string;
model: 'gpt-3.5-turbo';
};
}
@@ -135,3 +135,5 @@ export type RenameMethod = UnionToTuple<BangumiManage['rename_method']>;
export type ProxyType = UnionToTuple<Proxy['type']>;
/** 通知类型 */
export type NotificationType = UnionToTuple<Notification['type']>;
/** OpenAI Model List */
export type OpenAIModel = UnionToTuple<ExperimentalOpenAI['model']>;

View File

@@ -38,6 +38,7 @@ declare module '@vue/runtime-core' {
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']
ConfigOpenai: typeof import('./../../src/components/setting/config-openai.vue')['default']
ConfigParser: typeof import('./../../src/components/setting/config-parser.vue')['default']
ConfigPlayer: typeof import('./../../src/components/setting/config-player.vue')['default']
ConfigProxy: typeof import('./../../src/components/setting/config-proxy.vue')['default']

View File

@@ -42,7 +42,7 @@ declare module 'vue-router/auto/routes' {
'Index': RouteRecordInfo<'Index', '/', Record<never, never>, Record<never, never>>,
'Bangumi List': RouteRecordInfo<'Bangumi List', '/bangumi', Record<never, never>, Record<never, never>>,
'Calendar': RouteRecordInfo<'Calendar', '/calendar', Record<never, never>, Record<never, never>>,
'Config': RouteRecordInfo<'Config', '/config', Record<never, never>, Record<never, never>>,
'//config': RouteRecordInfo<'//config', '/config', Record<never, never>, Record<never, never>>,
'Downloader': RouteRecordInfo<'Downloader', '/downloader', Record<never, never>, Record<never, never>>,
'Log': RouteRecordInfo<'Log', '/log', Record<never, never>, Record<never, never>>,
'Player': RouteRecordInfo<'Player', '/player', Record<never, never>, Record<never, never>>,