flow.mocks.ts 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { WorkflowJSON } from '@flowgram.ai/free-layout-core';
  6. export const mockJSON: WorkflowJSON = {
  7. nodes: [
  8. {
  9. id: 'start_0',
  10. type: 'start',
  11. meta: {
  12. position: {
  13. x: 180,
  14. y: 381.75,
  15. },
  16. },
  17. data: {
  18. title: 'Start',
  19. },
  20. },
  21. {
  22. id: 'condition_0',
  23. type: 'condition',
  24. meta: {
  25. position: {
  26. x: 640,
  27. y: 363.25,
  28. },
  29. },
  30. data: {
  31. title: 'Condition',
  32. },
  33. },
  34. {
  35. id: 'end_0',
  36. type: 'end',
  37. meta: {
  38. position: {
  39. x: 2220,
  40. y: 381.75,
  41. },
  42. },
  43. data: {
  44. title: 'End',
  45. },
  46. },
  47. {
  48. id: 'loop_H8M3U',
  49. type: 'loop',
  50. meta: {
  51. position: {
  52. x: 1020,
  53. y: 547.96875,
  54. },
  55. },
  56. data: {
  57. title: 'Loop_2',
  58. },
  59. blocks: [
  60. {
  61. id: 'llm_CBdCg',
  62. type: 'llm',
  63. meta: {
  64. position: {
  65. x: 180,
  66. y: 0,
  67. },
  68. },
  69. data: {
  70. title: 'LLM_4',
  71. },
  72. },
  73. {
  74. id: 'llm_gZafu',
  75. type: 'llm',
  76. meta: {
  77. position: {
  78. x: 640,
  79. y: 0,
  80. },
  81. },
  82. data: {
  83. title: 'LLM_5',
  84. },
  85. },
  86. ],
  87. edges: [
  88. {
  89. sourceNodeID: 'llm_CBdCg',
  90. targetNodeID: 'llm_gZafu',
  91. },
  92. ],
  93. },
  94. {
  95. id: '159623',
  96. type: 'comment',
  97. meta: {
  98. position: {
  99. x: 640,
  100. y: 522.46875,
  101. },
  102. },
  103. data: {
  104. size: {
  105. width: 240,
  106. height: 150,
  107. },
  108. note: 'hi ~\n\nthis is a comment node\n\n- flowgram.ai',
  109. },
  110. },
  111. {
  112. id: 'group_V-_st',
  113. type: 'group',
  114. meta: {
  115. position: {
  116. x: 1020,
  117. y: 96.25,
  118. },
  119. },
  120. data: {
  121. title: 'LLM_Group',
  122. color: 'Violet',
  123. parentID: 'root',
  124. blockIDs: ['llm_0', 'llm_l_TcE'],
  125. },
  126. },
  127. {
  128. id: 'llm_0',
  129. type: 'llm',
  130. meta: {
  131. position: {
  132. x: 640,
  133. y: 0,
  134. },
  135. },
  136. data: {
  137. title: 'LLM_0',
  138. },
  139. },
  140. {
  141. id: 'llm_l_TcE',
  142. type: 'llm',
  143. meta: {
  144. position: {
  145. x: 180,
  146. y: 0,
  147. },
  148. },
  149. data: {
  150. title: 'LLM_1',
  151. },
  152. },
  153. ],
  154. edges: [
  155. {
  156. sourceNodeID: 'start_0',
  157. targetNodeID: 'condition_0',
  158. },
  159. {
  160. sourceNodeID: 'condition_0',
  161. targetNodeID: 'llm_l_TcE',
  162. sourcePortID: 'if_0',
  163. },
  164. {
  165. sourceNodeID: 'condition_0',
  166. targetNodeID: 'loop_H8M3U',
  167. sourcePortID: 'if_f0rOAt',
  168. },
  169. {
  170. sourceNodeID: 'llm_0',
  171. targetNodeID: 'end_0',
  172. },
  173. {
  174. sourceNodeID: 'loop_H8M3U',
  175. targetNodeID: 'end_0',
  176. },
  177. {
  178. sourceNodeID: 'llm_l_TcE',
  179. targetNodeID: 'llm_0',
  180. },
  181. ],
  182. };
  183. export const mockJSON2: WorkflowJSON = {
  184. nodes: [
  185. {
  186. id: 'start_0',
  187. type: 'start',
  188. meta: {
  189. position: {
  190. x: 0,
  191. y: 0,
  192. },
  193. },
  194. data: {
  195. title: 'Start changed',
  196. },
  197. },
  198. {
  199. id: 'condition_0',
  200. type: 'condition',
  201. meta: {
  202. position: {
  203. x: 235.74542284219706,
  204. y: -157.7680906713165,
  205. },
  206. },
  207. data: {
  208. title: 'Condition changed',
  209. },
  210. },
  211. {
  212. id: 'end_0',
  213. type: 'end',
  214. meta: {
  215. position: {
  216. x: 310.0959023539669,
  217. y: 190.25,
  218. },
  219. },
  220. data: {
  221. title: 'End',
  222. },
  223. },
  224. {
  225. id: 'loop_H8M3U',
  226. type: 'loop',
  227. meta: {
  228. position: {
  229. x: 1020,
  230. y: 547.96875,
  231. },
  232. },
  233. data: {
  234. title: 'Loop_2 changed',
  235. },
  236. blocks: [
  237. {
  238. id: 'llm_CBdCg',
  239. type: 'llm',
  240. meta: {
  241. position: {
  242. x: 180,
  243. y: 0,
  244. },
  245. },
  246. data: {
  247. title: 'LLM_4 chnaged',
  248. },
  249. },
  250. {
  251. id: 'llm_gZafu',
  252. type: 'llm changed',
  253. meta: {
  254. position: {
  255. x: 9.626852659110725,
  256. y: 121.49956408020925,
  257. },
  258. },
  259. data: {
  260. title: 'LLM_5',
  261. },
  262. },
  263. ],
  264. edges: [
  265. {
  266. sourceNodeID: 'llm_CBdCg',
  267. targetNodeID: 'llm_gZafu',
  268. },
  269. ],
  270. },
  271. {
  272. id: '159623',
  273. type: 'comment',
  274. meta: {
  275. position: {
  276. x: 300,
  277. y: 486.2002234088928,
  278. },
  279. },
  280. data: {
  281. size: {
  282. width: 240,
  283. height: 150,
  284. },
  285. note: 'hi ~\n\nthis is a comment node changed\n\n- flowgram.ai',
  286. },
  287. },
  288. {
  289. id: 'group_V-_st',
  290. type: 'group',
  291. meta: {
  292. position: {
  293. x: 869.4856146469051,
  294. y: 56.4254577157803,
  295. },
  296. },
  297. data: {
  298. title: 'LLM_Group changed',
  299. color: 'Violet',
  300. parentID: 'root',
  301. blockIDs: ['llm_0', 'llm_l_TcE'],
  302. },
  303. },
  304. {
  305. id: 'llm_0',
  306. type: 'llm',
  307. meta: {
  308. position: {
  309. x: 640,
  310. y: 0,
  311. },
  312. },
  313. data: {
  314. title: 'LLM_0 changed',
  315. },
  316. },
  317. {
  318. id: 'llm_l_TcE',
  319. type: 'llm',
  320. meta: {
  321. position: {
  322. x: 180,
  323. y: 0,
  324. },
  325. },
  326. data: {
  327. title: 'LLM_1',
  328. },
  329. },
  330. ],
  331. edges: [
  332. {
  333. sourceNodeID: 'start_0',
  334. targetNodeID: 'condition_0',
  335. },
  336. {
  337. sourceNodeID: 'condition_0',
  338. targetNodeID: 'llm_l_TcE',
  339. sourcePortID: 'if_0',
  340. },
  341. {
  342. sourceNodeID: 'condition_0',
  343. targetNodeID: 'loop_H8M3U',
  344. sourcePortID: 'if_f0rOAt',
  345. },
  346. {
  347. sourceNodeID: 'llm_0',
  348. targetNodeID: 'end_0',
  349. },
  350. {
  351. sourceNodeID: 'loop_H8M3U',
  352. targetNodeID: 'end_0',
  353. },
  354. {
  355. sourceNodeID: 'llm_l_TcE',
  356. targetNodeID: 'llm_0',
  357. },
  358. ],
  359. };
  360. export const mockSimpleJSON: WorkflowJSON = {
  361. nodes: [
  362. {
  363. id: 'start_0',
  364. type: 'start',
  365. meta: {
  366. position: { x: 0, y: 0 },
  367. },
  368. data: {
  369. title: 'start',
  370. },
  371. },
  372. {
  373. id: 'end_0',
  374. type: 'end',
  375. meta: {
  376. position: { x: 800, y: 0 },
  377. },
  378. data: {
  379. title: 'end',
  380. },
  381. },
  382. ],
  383. edges: [
  384. {
  385. sourceNodeID: 'start_0',
  386. targetNodeID: 'end_0',
  387. },
  388. ],
  389. };
  390. export const mockSimpleJSON2: WorkflowJSON = {
  391. nodes: [
  392. {
  393. id: 'start_0',
  394. type: 'start',
  395. meta: {
  396. position: { x: 1, y: 1 },
  397. },
  398. data: {
  399. title: 'start changed',
  400. },
  401. },
  402. {
  403. id: 'end_0',
  404. type: 'end',
  405. meta: {
  406. position: { x: 801, y: 1 },
  407. },
  408. data: {
  409. title: 'end changed',
  410. },
  411. },
  412. ],
  413. edges: [
  414. {
  415. sourceNodeID: 'start_0',
  416. targetNodeID: 'end_0',
  417. },
  418. ],
  419. };