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 GitHub
parent 5e7c97b7b8
commit 75af549c7f
59 changed files with 2032 additions and 854 deletions

View File

@@ -13,7 +13,7 @@ export const PluginOutputModule: FlowNodeTemplateType = {
unique: true,
forbidDelete: true,
avatar: 'core/workflow/template/pluginOutput',
name: i18nT('workflow:custom_plugin_output'),
name: i18nT('workflow:template.plugin_output'),
intro: i18nT('workflow:intro_custom_plugin_output'),
showStatus: false,
version: '481',

View File

@@ -33,6 +33,11 @@ import { RuntimeNodeItemType } from './runtime/type';
import { getReferenceVariableValue } from './runtime/utils';
import { Input_Template_History, Input_Template_UserChatInput } from './template/input';
import { i18nT } from '../../../web/i18n/utils';
import { RuntimeUserPromptType, UserChatItemType } from '../../core/chat/type';
import { getNanoid } from '../../common/string/tools';
import { ChatRoleEnum } from '../../core/chat/constants';
import { runtimePrompt2ChatsValue } from '../../core/chat/adapt';
import { getPluginRunContent } from '../../core/app/plugin/utils';
export const getHandleId = (nodeId: string, type: 'source' | 'target', key: string) => {
return `${nodeId}-${type}-${key}`;
@@ -395,3 +400,26 @@ export function replaceEditorVariable({
}
return text || '';
}
/* Get plugin runtime input user query */
export const getPluginRunUserQuery = ({
pluginInputs,
variables,
files = []
}: {
pluginInputs: FlowNodeInputItemType[];
variables: Record<string, any>;
files?: RuntimeUserPromptType['files'];
}): UserChatItemType & { dataId: string } => {
return {
dataId: getNanoid(24),
obj: ChatRoleEnum.Human,
value: runtimePrompt2ChatsValue({
text: getPluginRunContent({
pluginInputs: pluginInputs,
variables
}),
files
})
};
};