File size: 4,832 Bytes
dee7bd1
dcce454
dee7bd1
 
 
 
 
ddd1aa2
dee7bd1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78dc980
e3322d7
 
 
916a392
457b4e6
e3322d7
 
 
 
 
 
2653e84
e3322d7
 
 
 
8441328
 
ddd1aa2
8441328
 
 
 
 
 
 
 
 
 
 
 
ddd1aa2
8441328
 
 
 
 
 
 
 
 
 
 
 
ddd1aa2
8441328
 
 
 
 
 
 
 
 
 
e3322d7
 
8441328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e3322d7
 
78dc980
 
 
 
 
 
dee7bd1
 
78dc980
8441328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78dc980
8441328
 
78dc980
c939fd2
78dc980
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import { Position } from 'reactflow';

export const initialNodes = [
  {
    sourcePosition: Position.Left,
    targetPosition: Position.Right,
    id: 'node-1',
    type: 'ragNode',
    position: { x: 0, y: 0 },
    // position: { x: 400, y: 100 },
    data: { label: 123 },
  },
  {
    sourcePosition: Position.Right,
    targetPosition: Position.Left,
    id: '1',
    data: { label: 'Hello' },
    position: { x: 0, y: 0 },
    // position: { x: 0, y: 50 },
    type: 'input',
  },
  {
    sourcePosition: Position.Right,
    targetPosition: Position.Left,
    id: '2',
    data: { label: 'World' },
    position: { x: 0, y: 0 },
    // position: { x: 200, y: 50 },
  },
];

export const initialEdges = [
  { id: '1-2', source: '1', target: '2', label: 'to the', type: 'step' },
];

export const dsl = {
  graph: {
    nodes: [
      {
        id: 'Begin',
        type: 'beginNode',
        position: {
          x: 50,
          y: 200,
        },
        data: {
          label: 'Begin',
          name: 'begin',
        },
        sourcePosition: 'left',
        targetPosition: 'right',
      },
      // {
      //   id: 'Answer:China',
      //   type: 'ragNode',
      //   position: {
      //     x: 150,
      //     y: 200,
      //   },
      //   data: {
      //     label: 'Answer',
      //   },
      //   sourcePosition: 'left',
      //   targetPosition: 'right',
      // },
      // {
      //   id: 'Retrieval:China',
      //   type: 'ragNode',
      //   position: {
      //     x: 250,
      //     y: 200,
      //   },
      //   data: {
      //     label: 'Retrieval',
      //   },
      //   sourcePosition: 'left',
      //   targetPosition: 'right',
      // },
      // {
      //   id: 'Generate:China',
      //   type: 'ragNode',
      //   position: {
      //     x: 100,
      //     y: 100,
      //   },
      //   data: {
      //     label: 'Generate',
      //   },
      //   sourcePosition: 'left',
      //   targetPosition: 'right',
      // },
    ],
    edges: [
      // {
      //   id: '7facb53d-65c9-43b3-ac55-339c445d3891',
      //   label: '',
      //   source: 'begin',
      //   target: 'Answer:China',
      //   markerEnd: {
      //     type: 'arrow',
      //   },
      // },
      // {
      //   id: '7ac83631-502d-410f-a6e7-bec6866a5e99',
      //   label: '',
      //   source: 'Generate:China',
      //   target: 'Answer:China',
      //   markerEnd: {
      //     type: 'arrow',
      //   },
      // },
      // {
      //   id: '0aaab297-5779-43ed-9281-2c4d3741566f',
      //   label: '',
      //   source: 'Answer:China',
      //   target: 'Retrieval:China',
      //   markerEnd: {
      //     type: 'arrow',
      //   },
      // },
      // {
      //   id: '3477f9f3-0a7d-400e-af96-a11ea7673183',
      //   label: '',
      //   source: 'Retrieval:China',
      //   target: 'Generate:China',
      //   markerEnd: {
      //     type: 'arrow',
      //   },
      // },
    ],
  },
  components: {
    begin: {
      obj: {
        component_name: 'Begin',
        params: {},
      },
      downstream: ['Answer:China'], // other edge target is downstream, edge source is current node id
      upstream: [], // edge source is upstream, edge target is current node id
    },
    // 'Answer:China': {
    //   obj: {
    //     component_name: 'Answer',
    //     params: {},
    //   },
    //   downstream: ['Retrieval:China'],
    //   upstream: ['begin', 'Generate:China'],
    // },
    // 'Retrieval:China': {
    //   obj: {
    //     component_name: 'Retrieval',
    //     params: {
    //       similarity_threshold: 0.2,
    //       keywords_similarity_weight: 0.3,
    //       top_n: 6,
    //       top_k: 1024,
    //       rerank_id: 'BAAI/bge-reranker-v2-m3',
    //       kb_ids: ['568aa82603b611efa9d9fa163e197198'],
    //     },
    //   },
    //   downstream: ['Generate:China'],
    //   upstream: ['Answer:China'],
    // },
    // 'Generate:China': {
    //   obj: {
    //     component_name: 'Generate',
    //     params: {
    //       llm_id: 'deepseek-chat',
    //       prompt:
    //         'You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, your answer must include the sentence "The answer you are looking for is not found in the knowledge base!" Answers need to consider chat history.\n      Here is the knowledge base:\n      {input}\n      The above is the knowledge base.',
    //       temperature: 0.2,
    //     },
    //   },
    //   downstream: ['Answer:China'],
    //   upstream: ['Retrieval:China'],
    // },
  },
  messages: [],
  reference: [],
  history: [],
  path: [],
  answer: [],
};