Plugin support select file (#2756)

* feat: plugin support upload files (#2716)

* feat: plugin support file upload

* file history

* fix history & chattest

* chore: code

* plugin config icon & file preview padding

* perf: undefined fn

* fix: plugin file numbers & plugin template add config (#2743)

* perf: run plugin without human message (#2749)

* perf: run plugin without human message

* fix build

* fix build

* rename node

* perf: ui

* perf: plugin rerun with last params & plugin log add file (#2755)

* perf: plugin run with last params & plugin log add file

* delete console

* perf: plugin refresh code

* fix: ts

---------

Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
Archer
2024-09-20 14:12:58 +08:00
committed by shilin66
parent e8967ddd39
commit 91ce4b0166
59 changed files with 2032 additions and 854 deletions

View File

@@ -49,13 +49,16 @@ import { NextAPI } from '@/service/middleware/entry';
import { getAppLatestVersion } from '@fastgpt/service/core/app/controller';
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { updatePluginInputByVariables } from '@fastgpt/global/core/workflow/utils';
import {
getPluginRunUserQuery,
updatePluginInputByVariables
} from '@fastgpt/global/core/workflow/utils';
import { getNanoid } from '@fastgpt/global/common/string/tools';
import { getSystemTime } from '@fastgpt/global/common/time/timezone';
import { rewriteNodeOutputByHistories } from '@fastgpt/global/core/workflow/runtime/utils';
import { getWorkflowResponseWrite } from '@fastgpt/service/core/workflow/dispatch/utils';
import { getPluginRunUserQuery } from '@fastgpt/service/core/workflow/utils';
import { WORKFLOW_MAX_RUN_TIMES } from '@fastgpt/service/core/workflow/constants';
import { getPluginInputsFromStoreNodes } from '@fastgpt/global/core/app/plugin/utils';
type FastGptWebChatProps = {
chatId?: string; // undefined: get histories from messages, '': new chat, 'xxxxx': get histories from db
@@ -185,8 +188,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
// Get obj=Human history
const userQuestion: UserChatItemType = (() => {
if (isPlugin) {
// TODOget plugin files from variables
return getPluginRunUserQuery({ nodes: app.modules, variables });
return getPluginRunUserQuery({
pluginInputs: getPluginInputsFromStoreNodes(app.modules),
variables,
files: variables.files
});
}
const latestHumanChat = chatMessages.pop() as UserChatItemType | undefined;