mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-13 04:33:42 +08:00
feat: 支持全局配置插件
This commit is contained in:
@@ -511,7 +511,7 @@ export function ChatActions(props: {
|
||||
icon={<RobotIcon />}
|
||||
/>
|
||||
|
||||
{currentModel.endsWith("0613") && (
|
||||
{config.pluginConfig.enable && currentModel.endsWith("0613") && (
|
||||
<ChatAction
|
||||
onClick={switchUsePlugins}
|
||||
text={
|
||||
|
||||
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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -49,6 +49,7 @@ import { Avatar, AvatarPicker } from "./emoji";
|
||||
import { getClientConfig } from "../config/client";
|
||||
import { useSyncStore } from "../store/sync";
|
||||
import { nanoid } from "nanoid";
|
||||
import { PluginConfigList } from "./plugin-config";
|
||||
|
||||
function EditPromptModal(props: { id: string; onClose: () => void }) {
|
||||
const promptStore = usePromptStore();
|
||||
@@ -739,6 +740,17 @@ export function Settings() {
|
||||
<UserPromptModal onClose={() => setShowPromptModal(false)} />
|
||||
)}
|
||||
|
||||
<List>
|
||||
<PluginConfigList
|
||||
pluginConfig={config.pluginConfig}
|
||||
updateConfig={(updater) => {
|
||||
const pluginConfig = { ...config.pluginConfig };
|
||||
updater(pluginConfig);
|
||||
config.update((config) => (config.pluginConfig = pluginConfig));
|
||||
}}
|
||||
/>
|
||||
</List>
|
||||
|
||||
<DangerItems />
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
|
||||
Reference in New Issue
Block a user