2024-06-07 13:46:50 +08:00
|
|
|
import {
|
2024-06-25 12:09:07 +08:00
|
|
|
DatabaseOutlined,
|
2024-06-07 13:46:50 +08:00
|
|
|
MergeCellsOutlined,
|
2024-06-28 16:25:20 +08:00
|
|
|
MessageOutlined,
|
2024-06-07 13:46:50 +08:00
|
|
|
RocketOutlined,
|
|
|
|
|
SendOutlined,
|
2024-06-11 18:01:19 +08:00
|
|
|
SlidersOutlined,
|
2024-06-07 13:46:50 +08:00
|
|
|
} from '@ant-design/icons';
|
|
|
|
|
|
2024-06-05 10:46:06 +08:00
|
|
|
export enum Operator {
|
|
|
|
|
Begin = 'Begin',
|
|
|
|
|
Retrieval = 'Retrieval',
|
|
|
|
|
Generate = 'Generate',
|
|
|
|
|
Answer = 'Answer',
|
2024-06-25 12:09:07 +08:00
|
|
|
Categorize = 'Categorize',
|
2024-06-28 16:25:20 +08:00
|
|
|
Message = 'Message',
|
2024-06-05 10:46:06 +08:00
|
|
|
}
|
2024-06-06 11:01:14 +08:00
|
|
|
|
2024-06-11 18:01:19 +08:00
|
|
|
export const operatorIconMap = {
|
|
|
|
|
[Operator.Retrieval]: RocketOutlined,
|
|
|
|
|
[Operator.Generate]: MergeCellsOutlined,
|
|
|
|
|
[Operator.Answer]: SendOutlined,
|
|
|
|
|
[Operator.Begin]: SlidersOutlined,
|
2024-06-25 12:09:07 +08:00
|
|
|
[Operator.Categorize]: DatabaseOutlined,
|
2024-06-28 16:25:20 +08:00
|
|
|
[Operator.Message]: MessageOutlined,
|
2024-06-11 18:01:19 +08:00
|
|
|
};
|
|
|
|
|
|
2024-06-12 17:38:41 +08:00
|
|
|
export const operatorMap = {
|
|
|
|
|
[Operator.Retrieval]: {
|
|
|
|
|
description: 'Retrieval description drjlftglrthjftl',
|
|
|
|
|
},
|
|
|
|
|
[Operator.Generate]: { description: 'Generate description' },
|
|
|
|
|
[Operator.Answer]: { description: 'Answer description' },
|
|
|
|
|
[Operator.Begin]: { description: 'Begin description' },
|
2024-06-25 12:09:07 +08:00
|
|
|
[Operator.Categorize]: { description: 'Categorize description' },
|
2024-06-28 16:25:20 +08:00
|
|
|
[Operator.Message]: { description: 'Message description' },
|
2024-06-12 17:38:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const componentMenuList = [
|
2024-06-11 18:01:19 +08:00
|
|
|
{
|
|
|
|
|
name: Operator.Retrieval,
|
2024-06-12 17:38:41 +08:00
|
|
|
description: operatorMap[Operator.Retrieval].description,
|
2024-06-11 18:01:19 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: Operator.Generate,
|
2024-06-12 17:38:41 +08:00
|
|
|
description: operatorMap[Operator.Generate].description,
|
2024-06-11 18:01:19 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: Operator.Answer,
|
2024-06-12 17:38:41 +08:00
|
|
|
description: operatorMap[Operator.Answer].description,
|
2024-06-11 18:01:19 +08:00
|
|
|
},
|
2024-06-25 12:09:07 +08:00
|
|
|
{
|
|
|
|
|
name: Operator.Categorize,
|
|
|
|
|
description: operatorMap[Operator.Categorize].description,
|
|
|
|
|
},
|
2024-06-28 16:25:20 +08:00
|
|
|
{
|
|
|
|
|
name: Operator.Message,
|
|
|
|
|
description: operatorMap[Operator.Message].description,
|
|
|
|
|
},
|
2024-06-07 13:46:50 +08:00
|
|
|
];
|
|
|
|
|
|
2024-06-06 11:01:14 +08:00
|
|
|
export const initialRetrievalValues = {
|
|
|
|
|
similarity_threshold: 0.2,
|
|
|
|
|
keywords_similarity_weight: 0.3,
|
|
|
|
|
top_n: 8,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const initialBeginValues = {
|
|
|
|
|
prologue: `Hi! I'm your assistant, what can I do for you?`,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const initialGenerateValues = {
|
2024-06-06 15:00:37 +08:00
|
|
|
// parameters: ModelVariableType.Precise,
|
|
|
|
|
// temperatureEnabled: true,
|
2024-06-06 11:01:14 +08:00
|
|
|
temperature: 0.1,
|
|
|
|
|
top_p: 0.3,
|
|
|
|
|
frequency_penalty: 0.7,
|
|
|
|
|
presence_penalty: 0.4,
|
|
|
|
|
max_tokens: 512,
|
|
|
|
|
prompt: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:
|
|
|
|
|
{cluster_content}
|
|
|
|
|
The above is the content you need to summarize.`,
|
|
|
|
|
cite: true,
|
|
|
|
|
};
|
2024-06-06 15:00:37 +08:00
|
|
|
|
|
|
|
|
export const initialFormValuesMap = {
|
|
|
|
|
[Operator.Begin]: initialBeginValues,
|
|
|
|
|
[Operator.Retrieval]: initialRetrievalValues,
|
|
|
|
|
[Operator.Generate]: initialGenerateValues,
|
|
|
|
|
[Operator.Answer]: {},
|
2024-06-25 16:17:12 +08:00
|
|
|
[Operator.Categorize]: {},
|
2024-06-06 15:00:37 +08:00
|
|
|
};
|
2024-06-27 09:20:19 +08:00
|
|
|
|
|
|
|
|
export const CategorizeAnchorPointPositions = [
|
|
|
|
|
{ top: 1, right: 34 },
|
|
|
|
|
{ top: 8, right: 18 },
|
|
|
|
|
{ top: 15, right: 10 },
|
|
|
|
|
{ top: 24, right: 4 },
|
|
|
|
|
{ top: 31, right: 1 },
|
|
|
|
|
{ top: 38, right: -2 },
|
|
|
|
|
{ top: 62, right: -2 }, //bottom
|
|
|
|
|
{ top: 71, right: 1 },
|
|
|
|
|
{ top: 79, right: 6 },
|
|
|
|
|
{ top: 86, right: 12 },
|
|
|
|
|
{ top: 91, right: 20 },
|
|
|
|
|
{ top: 98, right: 34 },
|
|
|
|
|
];
|
2024-06-27 14:57:40 +08:00
|
|
|
|
|
|
|
|
// key is the source of the edge, value is the target of the edge
|
|
|
|
|
// no connection lines are allowed between key and value
|
|
|
|
|
export const RestrictedUpstreamMap = {
|
2024-06-28 08:59:51 +08:00
|
|
|
[Operator.Begin]: [],
|
2024-06-27 14:57:40 +08:00
|
|
|
[Operator.Categorize]: [Operator.Begin, Operator.Categorize, Operator.Answer],
|
|
|
|
|
[Operator.Answer]: [],
|
|
|
|
|
[Operator.Retrieval]: [],
|
|
|
|
|
[Operator.Generate]: [],
|
2024-06-28 16:25:20 +08:00
|
|
|
[Operator.Message]: [],
|
2024-06-27 14:57:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const NodeMap = {
|
|
|
|
|
[Operator.Begin]: 'beginNode',
|
|
|
|
|
[Operator.Categorize]: 'categorizeNode',
|
|
|
|
|
[Operator.Retrieval]: 'ragNode',
|
|
|
|
|
[Operator.Generate]: 'ragNode',
|
|
|
|
|
[Operator.Answer]: 'ragNode',
|
2024-06-28 16:25:20 +08:00
|
|
|
[Operator.Message]: 'ragNode',
|
2024-06-27 14:57:40 +08:00
|
|
|
};
|