mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-01-16 08:21:55 +00:00
update settings 配置
This commit is contained in:
parent
d3590a9b76
commit
7df06a45ad
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { t } from '../../lang/helpers';
|
import { t } from '../../lang/helpers';
|
||||||
import InfioPlugin from "../../main";
|
import InfioPlugin from "../../main";
|
||||||
@ -50,13 +50,21 @@ const getProviderSettingKey = (provider: ApiProvider): ProviderSettingKey => {
|
|||||||
|
|
||||||
const CustomProviderSettings: React.FC<CustomProviderSettingsProps> = ({ plugin, onSettingsUpdate }) => {
|
const CustomProviderSettings: React.FC<CustomProviderSettingsProps> = ({ plugin, onSettingsUpdate }) => {
|
||||||
const settings = plugin.settings;
|
const settings = plugin.settings;
|
||||||
const [activeTab, setActiveTab] = useState<ApiProvider>(ApiProvider.Infio);
|
const activeTab = settings.activeProviderTab || ApiProvider.Infio;
|
||||||
|
|
||||||
const handleSettingsUpdate = async (newSettings: InfioSettings) => {
|
const handleSettingsUpdate = async (newSettings: InfioSettings) => {
|
||||||
await plugin.setSettings(newSettings);
|
await plugin.setSettings(newSettings);
|
||||||
onSettingsUpdate?.();
|
onSettingsUpdate?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setActiveTab = (provider: ApiProvider) => {
|
||||||
|
const newSettings = {
|
||||||
|
...settings,
|
||||||
|
activeProviderTab: provider
|
||||||
|
};
|
||||||
|
handleSettingsUpdate(newSettings);
|
||||||
|
};
|
||||||
|
|
||||||
const providers = GetAllProviders(); // 按照重要程度排序
|
const providers = GetAllProviders(); // 按照重要程度排序
|
||||||
const embeddingProviders = GetEmbeddingProviders(); // 按照重要程度排序
|
const embeddingProviders = GetEmbeddingProviders(); // 按照重要程度排序
|
||||||
|
|
||||||
|
|||||||
@ -241,6 +241,9 @@ export const InfioSettingsSchema = z.object({
|
|||||||
modelId: z.string(),
|
modelId: z.string(),
|
||||||
})).catch([]),
|
})).catch([]),
|
||||||
|
|
||||||
|
// Active Provider Tab (for UI state)
|
||||||
|
activeProviderTab: z.nativeEnum(ApiProvider).catch(ApiProvider.Infio),
|
||||||
|
|
||||||
// Chat Model
|
// Chat Model
|
||||||
chatModelProvider: z.nativeEnum(ApiProvider).catch(ApiProvider.Infio),
|
chatModelProvider: z.nativeEnum(ApiProvider).catch(ApiProvider.Infio),
|
||||||
chatModelId: z.string().catch(''),
|
chatModelId: z.string().catch(''),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user