Fix 4.8 node (#1370)

* perf: runtime props

* fix: Plugin run faied in debug mode

* perf: variable update

* fix: ts

* perf: variable ui
This commit is contained in:
Archer
2024-05-06 17:13:50 +08:00
committed by GitHub
parent 5bb9c550f6
commit eef609a063
37 changed files with 398 additions and 249 deletions

View File

@@ -155,6 +155,6 @@ export type ToolModuleResponseItemType = {
/* dispatch run time */
export type RuntimeUserPromptType = {
files?: UserChatItemValueItemType['file'][];
files: UserChatItemValueItemType['file'][];
text: string;
};

View File

@@ -1,7 +1,7 @@
import { DispatchNodeResponseType } from '../workflow/runtime/type';
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../workflow/node/constant';
import { FlowNodeTypeEnum } from '../workflow/node/constant';
import { ChatItemValueTypeEnum, ChatRoleEnum } from './constants';
import { ChatHistoryItemResType, ChatItemType } from './type.d';
import { ChatHistoryItemResType, ChatItemType, UserChatItemValueItemType } from './type.d';
export const getChatTitleFromChatMessage = (message?: ChatItemType, defaultValue = '新对话') => {
// @ts-ignore
@@ -77,3 +77,15 @@ export const filterPublicNodeResponseData = ({
return obj as ChatHistoryItemResType;
});
};
export const removeEmptyUserInput = (input: UserChatItemValueItemType[]) => {
return input.filter((item) => {
if (item.type === ChatItemValueTypeEnum.text && !item.text?.content?.trim()) {
return false;
}
if (item.type === ChatItemValueTypeEnum.file && !item.file?.url) {
return false;
}
return true;
});
};