diff --git a/app/components/plugin.module.scss b/app/components/plugin.module.scss index 6812b4087..2f4a3aeb4 100644 --- a/app/components/plugin.module.scss +++ b/app/components/plugin.module.scss @@ -76,6 +76,10 @@ .plugin-info { font-size: 12px; } + .plugin-runtime-warning { + font-size: 12px; + color: #f86c6c; + } } } diff --git a/app/components/plugin.tsx b/app/components/plugin.tsx index 599204a2f..f81be1d2f 100644 --- a/app/components/plugin.tsx +++ b/app/components/plugin.tsx @@ -44,140 +44,7 @@ import { FileName, Path } from "../constant"; import { BUILTIN_PLUGIN_STORE } from "../plugins"; import { nanoid } from "nanoid"; import { getISOLang, getLang } from "../locales"; - -// export function PluginConfig(props: { -// plugin: Plugin; -// updateMask: Updater; -// extraListItems?: JSX.Element; -// readonly?: boolean; -// shouldSyncFromGlobal?: boolean; -// }) { -// const [showPicker, setShowPicker] = useState(false); - -// const updateConfig = (updater: (config: ModelConfig) => void) => { -// if (props.readonly) return; - -// // const config = { ...props.mask.modelConfig }; -// // updater(config); -// props.updateMask((mask) => { -// // mask.modelConfig = config; -// // // if user changed current session mask, it will disable auto sync -// // mask.syncGlobalConfig = false; -// }); -// }; - -// const globalConfig = useAppConfig(); - -// return ( -// <> -// { -// const context = props.mask.context.slice(); -// updater(context); -// props.updateMask((mask) => (mask.context = context)); -// }} -// /> - -// -// -// { -// props.updateMask((mask) => (mask.avatar = emoji)); -// setShowPicker(false); -// }} -// > -// } -// open={showPicker} -// onClose={() => setShowPicker(false)} -// > -//
setShowPicker(true)} -// style={{ cursor: "pointer" }} -// > -//
-//
-//
-// -// -// props.updateMask((mask) => { -// mask.name = e.currentTarget.value; -// }) -// } -// > -// -// -// { -// props.updateMask((mask) => { -// mask.hideContext = e.currentTarget.checked; -// }); -// }} -// > -// - -// {!props.shouldSyncFromGlobal ? ( -// -// } -// text={Locale.Mask.Config.Share.Action} -// onClick={copyMaskLink} -// /> -// -// ) : null} - -// {props.shouldSyncFromGlobal ? ( -// -// { -// const checked = e.currentTarget.checked; -// if ( -// checked && -// (await showConfirm(Locale.Mask.Config.Sync.Confirm)) -// ) { -// props.updateMask((mask) => { -// mask.syncGlobalConfig = checked; -// mask.modelConfig = { ...globalConfig.modelConfig }; -// }); -// } else if (!checked) { -// props.updateMask((mask) => { -// mask.syncGlobalConfig = checked; -// }); -// } -// }} -// > -// -// ) : null} -//
- -// -// -// {props.extraListItems} -// -// -// ); -// } +import { getServerSideConfig } from "../config/server"; function ContextPromptItem(props: { prompt: ChatMessage; @@ -351,6 +218,8 @@ export function PluginPage() { }); }; + const serverConfig = getServerSideConfig(); + return (
@@ -371,22 +240,7 @@ export function PluginPage() {
-
- {/*
- } - bordered - onClick={downloadAll} - /> -
-
- } - bordered - onClick={() => importFromFile()} - /> -
*/} -
+
@@ -398,17 +252,6 @@ export function PluginPage() { autoFocus onInput={(e) => onSearch(e.currentTarget.value)} /> - - {/* } - text={Locale.Mask.Page.Create} - bordered - onClick={() => { - const createdMask = pluginStore.create(); - setEditingMaskId(createdMask.id); - }} - /> */}
@@ -417,6 +260,11 @@ export function PluginPage() {
{m.name}
+ {m.onlyNodeRuntime && serverConfig.isVercel && ( +
+ {Locale.Plugin.RuntimeWarning} +
+ )} {/* 描述 */}
{`${m.description}`} @@ -426,35 +274,12 @@ export function PluginPage() {
{ updatePluginEnableStatus(m.id, e.currentTarget.checked); }} > - {/* {m.builtin ? ( - } - text={Locale.Mask.Item.View} - onClick={() => setEditingMaskId(m.id)} - /> - ) : ( - } - text={Locale.Mask.Item.Edit} - onClick={() => setEditingMaskId(m.id)} - /> - )} - {!m.builtin && ( - } - text={Locale.Mask.Item.Delete} - onClick={async () => { - if (await showConfirm(Locale.Mask.Item.DeleteConfirm)) { - maskStore.delete(m.id); - } - }} - /> - )} */}
))} @@ -481,15 +306,7 @@ export function PluginPage() { } />, ]} - > - {/* - pluginStore.update(editingPluginId!, updater) - } - readonly={editingPlugin.builtin} - /> */} - + >
)} diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 6436f277a..d121c95c6 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -403,6 +403,7 @@ const cn = { Download: "下载预设", Clone: "克隆预设", }, + RuntimeWarning: "仅在非Vercel环境部署时可用", }, FineTuned: { Sysmessage: "你是一个助手", diff --git a/app/locales/en.ts b/app/locales/en.ts index b4e6e8161..14b975925 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -409,6 +409,7 @@ const en: LocaleType = { Download: "Download", Clone: "Clone", }, + RuntimeWarning: "Only available when deployed in a non-Vercel environment.", }, FineTuned: { Sysmessage: "You are an assistant that", diff --git a/app/plugins/cn.ts b/app/plugins/cn.ts index 469dfe9b7..d15cdc385 100644 --- a/app/plugins/cn.ts +++ b/app/plugins/cn.ts @@ -9,6 +9,7 @@ export const CN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1693744292000, enable: true, + onlyNodeRuntime: false, }, { name: "计算器", @@ -18,6 +19,7 @@ export const CN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1693744292000, enable: true, + onlyNodeRuntime: false, }, { name: "网页浏览器", @@ -28,6 +30,7 @@ export const CN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1693744292000, enable: true, + onlyNodeRuntime: false, }, { name: "维基百科", @@ -37,6 +40,7 @@ export const CN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1694235989000, enable: false, + onlyNodeRuntime: false, }, { name: "DALL·E", @@ -47,6 +51,7 @@ export const CN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1694703673000, enable: false, + onlyNodeRuntime: false, }, { name: "Stable Diffusion", @@ -57,6 +62,7 @@ export const CN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1688899480510, enable: false, + onlyNodeRuntime: false, }, { name: "Arxiv", @@ -66,5 +72,16 @@ export const CN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1699265115000, enable: false, + onlyNodeRuntime: false, + }, + { + name: "PDF浏览器", + toolName: "pdf-browser", + lang: "cn", + description: "可以从pdf文件的url中提取信息或总结其内容。", + builtin: true, + createdAt: 1700907315000, + enable: false, + onlyNodeRuntime: true, }, ]; diff --git a/app/plugins/en.ts b/app/plugins/en.ts index d0e77ddb6..485e447ff 100644 --- a/app/plugins/en.ts +++ b/app/plugins/en.ts @@ -9,6 +9,7 @@ export const EN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1693744292000, enable: true, + onlyNodeRuntime: false, }, { name: "Calculator", @@ -19,6 +20,7 @@ export const EN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1693744292000, enable: true, + onlyNodeRuntime: false, }, { name: "WebBrowser", @@ -29,6 +31,7 @@ export const EN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1693744292000, enable: true, + onlyNodeRuntime: false, }, { name: "Wikipedia", @@ -39,6 +42,7 @@ export const EN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1694235989000, enable: false, + onlyNodeRuntime: false, }, { name: "DALL·E", @@ -49,6 +53,7 @@ export const EN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1694703673000, enable: false, + onlyNodeRuntime: false, }, { name: "Stable Diffusion", @@ -59,6 +64,7 @@ export const EN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1688899480510, enable: false, + onlyNodeRuntime: false, }, { name: "Arxiv", @@ -68,5 +74,17 @@ export const EN_PLUGINS: BuiltinPlugin[] = [ builtin: true, createdAt: 1699265115000, enable: false, + onlyNodeRuntime: false, + }, + { + name: "PDFBrowser", + toolName: "pdf-browser", + lang: "en", + description: + "A class designed to interact with pdf file, extract information from the URL of a PDF file or summarize its content.", + builtin: true, + createdAt: 1700907315000, + enable: false, + onlyNodeRuntime: true, }, ]; diff --git a/app/store/plugin.ts b/app/store/plugin.ts index f590b5fe1..0344f8e66 100644 --- a/app/store/plugin.ts +++ b/app/store/plugin.ts @@ -16,6 +16,7 @@ export type Plugin = { description: string; builtin: boolean; enable: boolean; + onlyNodeRuntime: boolean; }; export const DEFAULT_PLUGIN_STATE = { @@ -43,7 +44,7 @@ export const createEmptyPlugin = () => builtin: false, createdAt: Date.now(), enable: true, - } as Plugin); + }) as Plugin; export const usePluginStore = create()( persist( @@ -99,7 +100,7 @@ export const usePluginStore = create()( (m) => ({ ...m, - } as Plugin), + }) as Plugin, ); const pluginStatuses = get().pluginStatuses; return userPlugins.concat(buildinPlugins).map((e) => {