You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mock.tsx 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import { Position } from '@xyflow/react';
  2. export const initialNodes = [
  3. {
  4. sourcePosition: Position.Left,
  5. targetPosition: Position.Right,
  6. id: 'node-1',
  7. type: 'ragNode',
  8. position: { x: 0, y: 0 },
  9. // position: { x: 400, y: 100 },
  10. data: { label: 123 },
  11. },
  12. {
  13. sourcePosition: Position.Right,
  14. targetPosition: Position.Left,
  15. id: '1',
  16. data: { label: 'Hello' },
  17. position: { x: 0, y: 0 },
  18. // position: { x: 0, y: 50 },
  19. type: 'input',
  20. },
  21. {
  22. sourcePosition: Position.Right,
  23. targetPosition: Position.Left,
  24. id: '2',
  25. data: { label: 'World' },
  26. position: { x: 0, y: 0 },
  27. // position: { x: 200, y: 50 },
  28. },
  29. ];
  30. export const initialEdges = [
  31. { id: '1-2', source: '1', target: '2', label: 'to the', type: 'step' },
  32. ];
  33. export const dsl = {
  34. graph: {
  35. nodes: [
  36. {
  37. id: 'Begin',
  38. type: 'beginNode',
  39. position: {
  40. x: 50,
  41. y: 200,
  42. },
  43. data: {
  44. label: 'Begin',
  45. name: 'begin',
  46. },
  47. sourcePosition: 'left',
  48. targetPosition: 'right',
  49. },
  50. // {
  51. // id: 'Answer:China',
  52. // type: 'ragNode',
  53. // position: {
  54. // x: 150,
  55. // y: 200,
  56. // },
  57. // data: {
  58. // label: 'Answer',
  59. // },
  60. // sourcePosition: 'left',
  61. // targetPosition: 'right',
  62. // },
  63. // {
  64. // id: 'Retrieval:China',
  65. // type: 'ragNode',
  66. // position: {
  67. // x: 250,
  68. // y: 200,
  69. // },
  70. // data: {
  71. // label: 'Retrieval',
  72. // },
  73. // sourcePosition: 'left',
  74. // targetPosition: 'right',
  75. // },
  76. // {
  77. // id: 'Generate:China',
  78. // type: 'ragNode',
  79. // position: {
  80. // x: 100,
  81. // y: 100,
  82. // },
  83. // data: {
  84. // label: 'Generate',
  85. // },
  86. // sourcePosition: 'left',
  87. // targetPosition: 'right',
  88. // },
  89. ],
  90. edges: [
  91. // {
  92. // id: '7facb53d-65c9-43b3-ac55-339c445d3891',
  93. // label: '',
  94. // source: 'begin',
  95. // target: 'Answer:China',
  96. // markerEnd: {
  97. // type: 'arrow',
  98. // },
  99. // },
  100. // {
  101. // id: '7ac83631-502d-410f-a6e7-bec6866a5e99',
  102. // label: '',
  103. // source: 'Generate:China',
  104. // target: 'Answer:China',
  105. // markerEnd: {
  106. // type: 'arrow',
  107. // },
  108. // },
  109. // {
  110. // id: '0aaab297-5779-43ed-9281-2c4d3741566f',
  111. // label: '',
  112. // source: 'Answer:China',
  113. // target: 'Retrieval:China',
  114. // markerEnd: {
  115. // type: 'arrow',
  116. // },
  117. // },
  118. // {
  119. // id: '3477f9f3-0a7d-400e-af96-a11ea7673183',
  120. // label: '',
  121. // source: 'Retrieval:China',
  122. // target: 'Generate:China',
  123. // markerEnd: {
  124. // type: 'arrow',
  125. // },
  126. // },
  127. ],
  128. },
  129. components: {
  130. begin: {
  131. obj: {
  132. component_name: 'Begin',
  133. params: {},
  134. },
  135. downstream: ['Answer:China'], // other edge target is downstream, edge source is current node id
  136. upstream: [], // edge source is upstream, edge target is current node id
  137. },
  138. // 'Answer:China': {
  139. // obj: {
  140. // component_name: 'Answer',
  141. // params: {},
  142. // },
  143. // downstream: ['Retrieval:China'],
  144. // upstream: ['begin', 'Generate:China'],
  145. // },
  146. // 'Retrieval:China': {
  147. // obj: {
  148. // component_name: 'Retrieval',
  149. // params: {
  150. // similarity_threshold: 0.2,
  151. // keywords_similarity_weight: 0.3,
  152. // top_n: 6,
  153. // top_k: 1024,
  154. // rerank_id: 'BAAI/bge-reranker-v2-m3',
  155. // kb_ids: ['568aa82603b611efa9d9fa163e197198'],
  156. // },
  157. // },
  158. // downstream: ['Generate:China'],
  159. // upstream: ['Answer:China'],
  160. // },
  161. // 'Generate:China': {
  162. // obj: {
  163. // component_name: 'Generate',
  164. // params: {
  165. // llm_id: 'deepseek-chat',
  166. // prompt:
  167. // '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.',
  168. // temperature: 0.2,
  169. // },
  170. // },
  171. // downstream: ['Answer:China'],
  172. // upstream: ['Retrieval:China'],
  173. // },
  174. },
  175. messages: [],
  176. reference: [],
  177. history: [],
  178. path: [],
  179. answer: [],
  180. };