mirror of
https://github.com/Yanyutin753/ChatGPT-Next-Web-LangChain-Gpt-4-All.git
synced 2025-10-17 16:44:01 +00:00
feat: 支持全局配置插件
This commit is contained in:
60
app/components/plugin-config.tsx
Normal file
60
app/components/plugin-config.tsx
Normal file
@@ -0,0 +1,60 @@
|
||||
import { PluginConfig } from "../store";
|
||||
|
||||
import Locale from "../locales";
|
||||
import { ListItem } from "./ui-lib";
|
||||
|
||||
export function PluginConfigList(props: {
|
||||
pluginConfig: PluginConfig;
|
||||
updateConfig: (updater: (config: PluginConfig) => void) => void;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Plugin.Enable.Title}
|
||||
subTitle={Locale.Settings.Plugin.Enable.SubTitle}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={props.pluginConfig.enable}
|
||||
onChange={(e) =>
|
||||
props.updateConfig(
|
||||
(config) => (config.enable = e.currentTarget.checked),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Plugin.MaxIteration.Title}
|
||||
subTitle={Locale.Settings.Plugin.MaxIteration.SubTitle}
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
max={10}
|
||||
value={props.pluginConfig.maxIterations}
|
||||
onChange={(e) =>
|
||||
props.updateConfig(
|
||||
(config) =>
|
||||
(config.maxIterations = e.currentTarget.valueAsNumber),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Plugin.ReturnIntermediateStep.Title}
|
||||
subTitle={Locale.Settings.Plugin.ReturnIntermediateStep.SubTitle}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={props.pluginConfig.returnIntermediateSteps}
|
||||
onChange={(e) =>
|
||||
props.updateConfig(
|
||||
(config) =>
|
||||
(config.returnIntermediateSteps = e.currentTarget.checked),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user