mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Importing data flow files from the list page #9869 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import { setInitialChatVariableEnabledFieldValue } from '@/utils/chat';
|
|
import { ChatVariableEnabledField, variableEnabledFieldMap } from './chat';
|
|
|
|
export enum ProgrammingLanguage {
|
|
Python = 'python',
|
|
Javascript = 'javascript',
|
|
}
|
|
|
|
export const CodeTemplateStrMap = {
|
|
[ProgrammingLanguage.Python]: `def main(arg1: str, arg2: str) -> str:
|
|
return f"result: {arg1 + arg2}"
|
|
`,
|
|
[ProgrammingLanguage.Javascript]: `const axios = require('axios');
|
|
async function main({}) {
|
|
try {
|
|
const response = await axios.get('https://github.com/infiniflow/ragflow');
|
|
return 'Body:' + response.data;
|
|
} catch (error) {
|
|
return 'Error:' + error.message;
|
|
}
|
|
}`,
|
|
};
|
|
|
|
export enum AgentGlobals {
|
|
SysQuery = 'sys.query',
|
|
SysUserId = 'sys.user_id',
|
|
SysConversationTurns = 'sys.conversation_turns',
|
|
SysFiles = 'sys.files',
|
|
}
|
|
|
|
export const AgentGlobalsSysQueryWithBrace = `{${AgentGlobals.SysQuery}}`;
|
|
|
|
export const variableCheckBoxFieldMap = Object.keys(
|
|
variableEnabledFieldMap,
|
|
).reduce<Record<string, boolean>>((pre, cur) => {
|
|
pre[cur] = setInitialChatVariableEnabledFieldValue(
|
|
cur as ChatVariableEnabledField,
|
|
);
|
|
return pre;
|
|
}, {});
|
|
|
|
export const initialLlmBaseValues = {
|
|
...variableCheckBoxFieldMap,
|
|
temperature: 0.1,
|
|
top_p: 0.3,
|
|
frequency_penalty: 0.7,
|
|
presence_penalty: 0.4,
|
|
max_tokens: 256,
|
|
};
|
|
|
|
export enum AgentCategory {
|
|
AgentCanvas = 'agent_canvas',
|
|
DataflowCanvas = 'dataflow_canvas',
|
|
}
|
|
|
|
export enum DataflowOperator {
|
|
Begin = 'File',
|
|
Note = 'Note',
|
|
Parser = 'Parser',
|
|
Tokenizer = 'Tokenizer',
|
|
Splitter = 'Splitter',
|
|
HierarchicalMerger = 'HierarchicalMerger',
|
|
Extractor = 'Extractor',
|
|
}
|