mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
V4.8.17 feature (#3485)
* feat: add third party account config (#3443) * temp * editor workflow variable style * add team to dispatch * i18n * delete console * change openai account position * fix * fix * fix * fix * fix * 4.8.17 test (#3461) * perf: external provider config * perf: ui * feat: add template config (#3434) * change template position * template config * delete console * delete * fix * fix * perf: Mongo visutal field (#3464) * remve invalid code * perf: team member visutal code * perf: virtual search; perf: search test data * fix: ts * fix: image response headers * perf: template code * perf: auth layout;perf: auto save (#3472) * perf: auth layout * perf: auto save * perf: auto save * fix: template guide display & http input support external variables (#3475) * fix: template guide display * http editor support external workflow variables * perf: auto save;fix: ifelse checker line break; (#3478) * perf: auto save * perf: auto save * fix: ifelse checker line break * perf: doc * perf: doc * fix: update var type error * 4.8.17 test (#3479) * perf: auto save * perf: auto save * perf: template code * 4.8.17 test (#3480) * perf: auto save * perf: auto save * perf: model price model * feat: add react memo * perf: model provider filter * fix: ts (#3481) * perf: auto save * perf: auto save * fix: ts * simple app tool select (#3473) * workflow plugin userguide & simple tool ui * simple tool filter * reuse component * change component to hook * fix * perf: too selector modal (#3484) * perf: auto save * perf: auto save * perf: markdown render * perf: too selector * fix: app version require tmbId * perf: templates refresh * perf: templates refresh * hide auto save error tip * perf: toolkit guide --------- Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
@@ -35,7 +35,7 @@ type ActionProps = Props & { cqModel: LLMModelItemType };
|
||||
/* request openai chat */
|
||||
export const dispatchClassifyQuestion = async (props: Props): Promise<CQResponse> => {
|
||||
const {
|
||||
user,
|
||||
externalProvider,
|
||||
node: { nodeId, name },
|
||||
histories,
|
||||
params: { model, history = 6, agents, userChatInput }
|
||||
@@ -69,7 +69,7 @@ export const dispatchClassifyQuestion = async (props: Props): Promise<CQResponse
|
||||
.filter((item) => item.key !== result.key)
|
||||
.map((item) => getHandleId(nodeId, 'source', item.key)),
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
totalPoints: user.openaiAccount?.key ? 0 : totalPoints,
|
||||
totalPoints: externalProvider.openaiAccount?.key ? 0 : totalPoints,
|
||||
model: modelName,
|
||||
query: userChatInput,
|
||||
tokens,
|
||||
@@ -80,7 +80,7 @@ export const dispatchClassifyQuestion = async (props: Props): Promise<CQResponse
|
||||
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]: [
|
||||
{
|
||||
moduleName: name,
|
||||
totalPoints: user.openaiAccount?.key ? 0 : totalPoints,
|
||||
totalPoints: externalProvider.openaiAccount?.key ? 0 : totalPoints,
|
||||
model: modelName,
|
||||
tokens
|
||||
}
|
||||
@@ -90,7 +90,7 @@ export const dispatchClassifyQuestion = async (props: Props): Promise<CQResponse
|
||||
|
||||
const completions = async ({
|
||||
cqModel,
|
||||
user,
|
||||
externalProvider,
|
||||
histories,
|
||||
params: { agents, systemPrompt = '', userChatInput }
|
||||
}: ActionProps) => {
|
||||
@@ -131,7 +131,7 @@ const completions = async ({
|
||||
},
|
||||
cqModel
|
||||
),
|
||||
userKey: user.openaiAccount
|
||||
userKey: externalProvider.openaiAccount
|
||||
});
|
||||
const answer = data.choices?.[0].message?.content || '';
|
||||
|
||||
|
@@ -46,7 +46,7 @@ const agentFunName = 'request_function';
|
||||
|
||||
export async function dispatchContentExtract(props: Props): Promise<Response> {
|
||||
const {
|
||||
user,
|
||||
externalProvider,
|
||||
node: { name },
|
||||
histories,
|
||||
params: { content, history = 6, model, description, extractKeys }
|
||||
@@ -123,7 +123,7 @@ export async function dispatchContentExtract(props: Props): Promise<Response> {
|
||||
[NodeOutputKeyEnum.contextExtractFields]: JSON.stringify(arg),
|
||||
...arg,
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
totalPoints: user.openaiAccount?.key ? 0 : totalPoints,
|
||||
totalPoints: externalProvider.openaiAccount?.key ? 0 : totalPoints,
|
||||
model: modelName,
|
||||
query: content,
|
||||
tokens,
|
||||
@@ -134,7 +134,7 @@ export async function dispatchContentExtract(props: Props): Promise<Response> {
|
||||
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]: [
|
||||
{
|
||||
moduleName: name,
|
||||
totalPoints: user.openaiAccount?.key ? 0 : totalPoints,
|
||||
totalPoints: externalProvider.openaiAccount?.key ? 0 : totalPoints,
|
||||
model: modelName,
|
||||
tokens
|
||||
}
|
||||
@@ -211,7 +211,7 @@ ${description ? `- ${description}` : ''}
|
||||
};
|
||||
|
||||
const toolChoice = async (props: ActionProps) => {
|
||||
const { user, extractModel } = props;
|
||||
const { externalProvider, extractModel } = props;
|
||||
|
||||
const { filterMessages, agentFunction } = await getFunctionCallSchema(props);
|
||||
|
||||
@@ -233,7 +233,7 @@ const toolChoice = async (props: ActionProps) => {
|
||||
},
|
||||
extractModel
|
||||
),
|
||||
userKey: user.openaiAccount
|
||||
userKey: externalProvider.openaiAccount
|
||||
});
|
||||
|
||||
const arg: Record<string, any> = (() => {
|
||||
@@ -263,7 +263,7 @@ const toolChoice = async (props: ActionProps) => {
|
||||
};
|
||||
|
||||
const functionCall = async (props: ActionProps) => {
|
||||
const { user, extractModel } = props;
|
||||
const { externalProvider, extractModel } = props;
|
||||
|
||||
const { agentFunction, filterMessages } = await getFunctionCallSchema(props);
|
||||
const functions: ChatCompletionCreateParams.Function[] = [agentFunction];
|
||||
@@ -281,7 +281,7 @@ const functionCall = async (props: ActionProps) => {
|
||||
},
|
||||
extractModel
|
||||
),
|
||||
userKey: user.openaiAccount
|
||||
userKey: externalProvider.openaiAccount
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -312,7 +312,7 @@ const functionCall = async (props: ActionProps) => {
|
||||
|
||||
const completions = async ({
|
||||
extractModel,
|
||||
user,
|
||||
externalProvider,
|
||||
histories,
|
||||
params: { content, extractKeys, description = 'No special requirements' }
|
||||
}: ActionProps) => {
|
||||
@@ -360,7 +360,7 @@ Human: ${content}`
|
||||
},
|
||||
extractModel
|
||||
),
|
||||
userKey: user.openaiAccount
|
||||
userKey: externalProvider.openaiAccount
|
||||
});
|
||||
const answer = data.choices?.[0].message?.content || '';
|
||||
|
||||
|
@@ -43,7 +43,7 @@ export const runToolWithFunctionCall = async (
|
||||
requestOrigin,
|
||||
runtimeNodes,
|
||||
runtimeEdges,
|
||||
user,
|
||||
externalProvider,
|
||||
stream,
|
||||
workflowStreamResponse,
|
||||
params: { temperature, maxToken, aiChatVision }
|
||||
@@ -221,7 +221,7 @@ export const runToolWithFunctionCall = async (
|
||||
getEmptyResponseTip
|
||||
} = await createChatCompletion({
|
||||
body: requestBody,
|
||||
userKey: user.openaiAccount,
|
||||
userKey: externalProvider.openaiAccount,
|
||||
options: {
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain, */*'
|
||||
|
@@ -46,7 +46,7 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
|
||||
requestOrigin,
|
||||
chatConfig,
|
||||
runningAppInfo: { teamId },
|
||||
user,
|
||||
externalProvider,
|
||||
params: {
|
||||
model,
|
||||
systemPrompt,
|
||||
@@ -153,7 +153,7 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
|
||||
})();
|
||||
|
||||
// censor model and system key
|
||||
if (toolModel.censor && !user.openaiAccount?.key) {
|
||||
if (toolModel.censor && !externalProvider.openaiAccount?.key) {
|
||||
await postTextCensor({
|
||||
text: `${systemPrompt}
|
||||
${userChatInput}
|
||||
@@ -228,7 +228,7 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
|
||||
tokens: toolNodeTokens,
|
||||
modelType: ModelTypeEnum.llm
|
||||
});
|
||||
const toolAIUsage = user.openaiAccount?.key ? 0 : totalPoints;
|
||||
const toolAIUsage = externalProvider.openaiAccount?.key ? 0 : totalPoints;
|
||||
|
||||
// flat child tool response
|
||||
const childToolResponse = dispatchFlowResponse.map((item) => item.flowResponses).flat();
|
||||
|
@@ -51,7 +51,7 @@ export const runToolWithPromptCall = async (
|
||||
requestOrigin,
|
||||
runtimeNodes,
|
||||
runtimeEdges,
|
||||
user,
|
||||
externalProvider,
|
||||
stream,
|
||||
workflowStreamResponse,
|
||||
params: { temperature, maxToken, aiChatVision }
|
||||
@@ -230,7 +230,7 @@ export const runToolWithPromptCall = async (
|
||||
getEmptyResponseTip
|
||||
} = await createChatCompletion({
|
||||
body: requestBody,
|
||||
userKey: user.openaiAccount,
|
||||
userKey: externalProvider.openaiAccount,
|
||||
options: {
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain, */*'
|
||||
|
@@ -24,11 +24,9 @@ import { AIChatItemType } from '@fastgpt/global/core/chat/type';
|
||||
import { formatToolResponse, initToolCallEdges, initToolNodes } from './utils';
|
||||
import { computedMaxToken, llmCompletionsBodyFormat } from '../../../../ai/utils';
|
||||
import { getNanoid, sliceStrStartEnd } from '@fastgpt/global/common/string/tools';
|
||||
import { addLog } from '../../../../../common/system/log';
|
||||
import { toolValueTypeList } from '@fastgpt/global/core/workflow/constants';
|
||||
import { WorkflowInteractiveResponseType } from '@fastgpt/global/core/workflow/template/system/interactive/type';
|
||||
import { ChatItemValueTypeEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import { i18nT } from '../../../../../../web/i18n/utils';
|
||||
|
||||
type ToolRunResponseType = {
|
||||
toolRunResponse: DispatchFlowResponse;
|
||||
@@ -92,7 +90,7 @@ export const runToolWithToolChoice = async (
|
||||
runtimeNodes,
|
||||
runtimeEdges,
|
||||
stream,
|
||||
user,
|
||||
externalProvider,
|
||||
workflowStreamResponse,
|
||||
params: { temperature, maxToken, aiChatVision }
|
||||
} = workflowProps;
|
||||
@@ -278,7 +276,7 @@ export const runToolWithToolChoice = async (
|
||||
getEmptyResponseTip
|
||||
} = await createChatCompletion({
|
||||
body: requestBody,
|
||||
userKey: user.openaiAccount,
|
||||
userKey: externalProvider.openaiAccount,
|
||||
options: {
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain, */*'
|
||||
|
@@ -62,7 +62,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
res,
|
||||
requestOrigin,
|
||||
stream = false,
|
||||
user,
|
||||
externalProvider,
|
||||
histories,
|
||||
node: { name },
|
||||
query,
|
||||
@@ -134,7 +134,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
}),
|
||||
(() => {
|
||||
// censor model and system key
|
||||
if (modelConstantsData.censor && !user.openaiAccount?.key) {
|
||||
if (modelConstantsData.censor && !externalProvider.openaiAccount?.key) {
|
||||
return postTextCensor({
|
||||
text: `${systemPrompt}
|
||||
${userChatInput}
|
||||
@@ -170,7 +170,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
// console.log(JSON.stringify(requestBody, null, 2), '===');
|
||||
const { response, isStreamResponse, getEmptyResponseTip } = await createChatCompletion({
|
||||
body: requestBody,
|
||||
userKey: user.openaiAccount,
|
||||
userKey: externalProvider.openaiAccount,
|
||||
options: {
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain, */*'
|
||||
@@ -230,7 +230,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
return {
|
||||
answerText,
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
totalPoints: user.openaiAccount?.key ? 0 : totalPoints,
|
||||
totalPoints: externalProvider.openaiAccount?.key ? 0 : totalPoints,
|
||||
model: modelName,
|
||||
tokens,
|
||||
query: `${userChatInput}`,
|
||||
@@ -245,7 +245,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]: [
|
||||
{
|
||||
moduleName: name,
|
||||
totalPoints: user.openaiAccount?.key ? 0 : totalPoints,
|
||||
totalPoints: externalProvider.openaiAccount?.key ? 0 : totalPoints,
|
||||
model: modelName,
|
||||
tokens
|
||||
}
|
||||
|
@@ -126,7 +126,8 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
||||
runtimeEdges = [],
|
||||
histories = [],
|
||||
variables = {},
|
||||
user,
|
||||
timezone,
|
||||
externalProvider,
|
||||
stream = false,
|
||||
...props
|
||||
} = data;
|
||||
@@ -150,7 +151,7 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
||||
[DispatchNodeResponseKeyEnum.runTimes]: 1,
|
||||
[DispatchNodeResponseKeyEnum.assistantResponses]: [],
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: null,
|
||||
newVariables: removeSystemVariable(variables)
|
||||
newVariables: removeSystemVariable(variables, externalProvider.externalWorkflowVariables)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -180,6 +181,7 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
||||
|
||||
variables = {
|
||||
...getSystemVariable(data),
|
||||
...externalProvider.externalWorkflowVariables,
|
||||
...variables
|
||||
};
|
||||
|
||||
@@ -493,11 +495,11 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
||||
}
|
||||
|
||||
// replace {{xx}} variables
|
||||
let value = replaceVariable(input.value, variables);
|
||||
// let value = replaceVariable(input.value, variables);
|
||||
|
||||
// replace {{$xx.xx$}} variables
|
||||
value = replaceEditorVariable({
|
||||
text: value,
|
||||
let value = replaceEditorVariable({
|
||||
text: input.value,
|
||||
nodes: runtimeNodes,
|
||||
variables
|
||||
});
|
||||
@@ -543,7 +545,8 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
||||
res,
|
||||
variables,
|
||||
histories,
|
||||
user,
|
||||
timezone,
|
||||
externalProvider,
|
||||
stream,
|
||||
node,
|
||||
runtimeNodes,
|
||||
@@ -677,7 +680,7 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
||||
[DispatchNodeResponseKeyEnum.assistantResponses]:
|
||||
mergeAssistantResponseAnswerText(chatAssistantResponse),
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: toolRunResponse,
|
||||
newVariables: removeSystemVariable(variables)
|
||||
newVariables: removeSystemVariable(variables, externalProvider.externalWorkflowVariables)
|
||||
};
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
@@ -686,7 +689,7 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
|
||||
|
||||
/* get system variable */
|
||||
const getSystemVariable = ({
|
||||
user,
|
||||
timezone,
|
||||
runningAppInfo,
|
||||
chatId,
|
||||
responseChatItemId,
|
||||
@@ -707,7 +710,7 @@ const getSystemVariable = ({
|
||||
chatId,
|
||||
responseChatItemId,
|
||||
histories,
|
||||
cTime: getSystemTime(user.timezone)
|
||||
cTime: getSystemTime(timezone)
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -22,7 +22,6 @@ export const dispatchLoop = async (props: Props): Promise<Response> => {
|
||||
params,
|
||||
runtimeEdges,
|
||||
runtimeNodes,
|
||||
user,
|
||||
node: { name }
|
||||
} = props;
|
||||
const { loopInputArray = [], childrenNodeIdList = [] } = params;
|
||||
@@ -86,14 +85,14 @@ export const dispatchLoop = async (props: Props): Promise<Response> => {
|
||||
return {
|
||||
[DispatchNodeResponseKeyEnum.assistantResponses]: assistantResponses,
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
totalPoints: totalPoints,
|
||||
totalPoints,
|
||||
loopInput: loopInputArray,
|
||||
loopResult: outputValueArr,
|
||||
loopDetail: loopDetail
|
||||
},
|
||||
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]: [
|
||||
{
|
||||
totalPoints: user.openaiAccount?.key ? 0 : totalPoints,
|
||||
totalPoints,
|
||||
moduleName: name
|
||||
}
|
||||
],
|
||||
|
@@ -53,8 +53,8 @@ function checkCondition(condition: VariableConditionEnum, inputValue: any, value
|
||||
[VariableConditionEnum.isEmpty]: () => isEmpty(inputValue),
|
||||
[VariableConditionEnum.isNotEmpty]: () => !isEmpty(inputValue),
|
||||
|
||||
[VariableConditionEnum.equalTo]: () => String(inputValue) === value,
|
||||
[VariableConditionEnum.notEqual]: () => String(inputValue) !== value,
|
||||
[VariableConditionEnum.equalTo]: () => String(inputValue).trim() === value.trim(),
|
||||
[VariableConditionEnum.notEqual]: () => String(inputValue).trim() !== value.trim(),
|
||||
|
||||
// number
|
||||
[VariableConditionEnum.greaterThan]: () => Number(inputValue) > Number(value),
|
||||
@@ -67,8 +67,8 @@ function checkCondition(condition: VariableConditionEnum, inputValue: any, value
|
||||
[VariableConditionEnum.notInclude]: () => !isInclude(inputValue, value),
|
||||
|
||||
// string
|
||||
[VariableConditionEnum.startWith]: () => inputValue?.startsWith(value),
|
||||
[VariableConditionEnum.endWith]: () => inputValue?.endsWith(value),
|
||||
[VariableConditionEnum.startWith]: () => inputValue?.trim()?.startsWith(value),
|
||||
[VariableConditionEnum.endWith]: () => inputValue?.trim()?.endsWith(value),
|
||||
[VariableConditionEnum.reg]: () => {
|
||||
if (typeof inputValue !== 'string' || !value) return false;
|
||||
if (value.startsWith('/')) {
|
||||
@@ -79,7 +79,7 @@ function checkCondition(condition: VariableConditionEnum, inputValue: any, value
|
||||
}
|
||||
|
||||
const reg = new RegExp(value, 'g');
|
||||
const result = reg.test(inputValue);
|
||||
const result = reg.test(inputValue.trim());
|
||||
|
||||
return result;
|
||||
},
|
||||
|
@@ -19,7 +19,7 @@ type Props = ModuleDispatchProps<{
|
||||
type Response = DispatchNodeResultType<{}>;
|
||||
|
||||
export const dispatchUpdateVariable = async (props: Props): Promise<Response> => {
|
||||
const { params, variables, runtimeNodes, workflowStreamResponse, node } = props;
|
||||
const { params, variables, runtimeNodes, workflowStreamResponse, externalProvider } = props;
|
||||
|
||||
const { updateList } = params;
|
||||
const nodeIds = runtimeNodes.map((node) => node.nodeId);
|
||||
@@ -41,15 +41,15 @@ export const dispatchUpdateVariable = async (props: Props): Promise<Response> =>
|
||||
const value = (() => {
|
||||
// If first item is empty, it means it is a input value
|
||||
if (!item.value?.[0]) {
|
||||
const formatValue = valueTypeFormat(item.value?.[1], item.valueType);
|
||||
|
||||
return typeof formatValue === 'string'
|
||||
? replaceEditorVariable({
|
||||
text: formatValue,
|
||||
nodes: runtimeNodes,
|
||||
variables
|
||||
})
|
||||
: formatValue;
|
||||
const val =
|
||||
typeof item.value?.[1] === 'string'
|
||||
? replaceEditorVariable({
|
||||
text: item.value?.[1],
|
||||
nodes: runtimeNodes,
|
||||
variables
|
||||
})
|
||||
: item.value?.[1];
|
||||
return valueTypeFormat(val, item.valueType);
|
||||
} else {
|
||||
return getReferenceVariableValue({
|
||||
value: item.value,
|
||||
@@ -80,7 +80,7 @@ export const dispatchUpdateVariable = async (props: Props): Promise<Response> =>
|
||||
|
||||
workflowStreamResponse?.({
|
||||
event: SseResponseEventEnum.updateVariables,
|
||||
data: removeSystemVariable(variables)
|
||||
data: removeSystemVariable(variables, externalProvider.externalWorkflowVariables)
|
||||
});
|
||||
|
||||
return {
|
||||
|
@@ -14,6 +14,7 @@ import { NextApiResponse } from 'next';
|
||||
import { SseResponseEventEnum } from '@fastgpt/global/core/workflow/runtime/constants';
|
||||
import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
||||
import json5 from 'json5';
|
||||
|
||||
export const getWorkflowResponseWrite = ({
|
||||
res,
|
||||
@@ -116,11 +117,18 @@ export const valueTypeFormat = (value: any, type?: WorkflowIOValueTypeEnum) => {
|
||||
return Boolean(value);
|
||||
}
|
||||
try {
|
||||
if (type === WorkflowIOValueTypeEnum.datasetQuote && !Array.isArray(value)) {
|
||||
return JSON.parse(value);
|
||||
}
|
||||
if (type === WorkflowIOValueTypeEnum.selectDataset && !Array.isArray(value)) {
|
||||
return JSON.parse(value);
|
||||
if (
|
||||
type &&
|
||||
[
|
||||
WorkflowIOValueTypeEnum.object,
|
||||
WorkflowIOValueTypeEnum.chatHistory,
|
||||
WorkflowIOValueTypeEnum.datasetQuote,
|
||||
WorkflowIOValueTypeEnum.selectApp,
|
||||
WorkflowIOValueTypeEnum.selectDataset
|
||||
].includes(type) &&
|
||||
typeof value !== 'object'
|
||||
) {
|
||||
return json5.parse(value);
|
||||
}
|
||||
} catch (error) {
|
||||
return value;
|
||||
@@ -141,14 +149,23 @@ export const checkQuoteQAValue = (quoteQA?: SearchDataResponseItemType[]) => {
|
||||
};
|
||||
|
||||
/* remove system variable */
|
||||
export const removeSystemVariable = (variables: Record<string, any>) => {
|
||||
export const removeSystemVariable = (
|
||||
variables: Record<string, any>,
|
||||
removeObj: Record<string, string> = {}
|
||||
) => {
|
||||
const copyVariables = { ...variables };
|
||||
delete copyVariables.userId;
|
||||
delete copyVariables.appId;
|
||||
delete copyVariables.chatId;
|
||||
delete copyVariables.responseChatItemId;
|
||||
delete copyVariables.histories;
|
||||
delete copyVariables.cTime;
|
||||
|
||||
// delete external provider workflow variables
|
||||
Object.keys(removeObj).forEach((key) => {
|
||||
delete copyVariables[key];
|
||||
});
|
||||
|
||||
return copyVariables;
|
||||
};
|
||||
export const filterSystemVariables = (variables: Record<string, any>): SystemVariablesType => {
|
||||
|
Reference in New Issue
Block a user