mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-18 01:16:01 +00:00
4.8.10 test (#2601)
* perf: workflow children run params * feat: workflow userId * fix: ui size * perf: Markdown whitespace and ai images split * fix: openai sdk ts
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
||||
import { countPromptTokens } from '../../common/string/tiktoken/index';
|
||||
import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { ChatItemValueTypeEnum, ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import {
|
||||
getPluginInputsFromStoreNodes,
|
||||
getPluginRunContent
|
||||
} from '@fastgpt/global/core/app/plugin/utils';
|
||||
import { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node';
|
||||
import { UserChatItemType } from '@fastgpt/global/core/chat/type';
|
||||
|
||||
/* filter search result */
|
||||
export const filterSearchResultsByMaxChars = async (
|
||||
@@ -23,3 +31,25 @@ export const filterSearchResultsByMaxChars = async (
|
||||
|
||||
return results.length === 0 ? list.slice(0, 1) : results;
|
||||
};
|
||||
|
||||
/* Get plugin runtime input user query */
|
||||
export const getPluginRunUserQuery = (
|
||||
nodes: StoreNodeItemType[],
|
||||
variables: Record<string, any>
|
||||
): UserChatItemType & { dataId: string } => {
|
||||
return {
|
||||
dataId: getNanoid(24),
|
||||
obj: ChatRoleEnum.Human,
|
||||
value: [
|
||||
{
|
||||
type: ChatItemValueTypeEnum.text,
|
||||
text: {
|
||||
content: getPluginRunContent({
|
||||
pluginInputs: getPluginInputsFromStoreNodes(nodes),
|
||||
variables
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user