mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feature: Added global variable functionality ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
import {
|
||||
DSL,
|
||||
GobalVariableType,
|
||||
IAgentForm,
|
||||
ICategorizeForm,
|
||||
ICategorizeItem,
|
||||
@ -346,6 +348,28 @@ export const buildDslComponentsByGraph = (
|
||||
return components;
|
||||
};
|
||||
|
||||
export const buildDslGobalVariables = (
|
||||
dsl: DSL,
|
||||
gobalVariables?: Record<string, GobalVariableType>,
|
||||
) => {
|
||||
if (!gobalVariables) {
|
||||
return { globals: dsl.globals, variables: dsl.variables || {} };
|
||||
}
|
||||
|
||||
let gobalVariablesTemp = {};
|
||||
Object.keys(gobalVariables).forEach((key) => {
|
||||
gobalVariablesTemp = {
|
||||
['env.' + key]: gobalVariables[key].value,
|
||||
};
|
||||
});
|
||||
|
||||
const gobalVariablesResult = {
|
||||
...dsl.globals,
|
||||
...gobalVariablesTemp,
|
||||
};
|
||||
return { globals: gobalVariablesResult, variables: gobalVariables };
|
||||
};
|
||||
|
||||
export const receiveMessageError = (res: any) =>
|
||||
res && (res?.response.status !== 200 || res?.data?.code !== 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user