initial-data.ts 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { FlowDocumentJSON } from './typings';
  6. export const initialData: FlowDocumentJSON = {
  7. nodes: [
  8. {
  9. id: 'start_0',
  10. type: 'start',
  11. blocks: [],
  12. data: {
  13. title: 'Start',
  14. outputs: {
  15. type: 'object',
  16. properties: {
  17. query: {
  18. type: 'string',
  19. default: 'Hello Flow.',
  20. },
  21. enable: {
  22. type: 'boolean',
  23. default: true,
  24. },
  25. array_obj: {
  26. type: 'array',
  27. items: {
  28. type: 'object',
  29. properties: {
  30. int: {
  31. type: 'number',
  32. },
  33. str: {
  34. type: 'string',
  35. },
  36. },
  37. },
  38. },
  39. },
  40. },
  41. },
  42. },
  43. {
  44. id: 'llm_0',
  45. type: 'llm',
  46. blocks: [],
  47. data: {
  48. title: 'LLM',
  49. inputsValues: {
  50. modelType: {
  51. type: 'constant',
  52. content: 'gpt-3.5-turbo',
  53. },
  54. temperature: {
  55. type: 'constant',
  56. content: 0.5,
  57. },
  58. systemPrompt: {
  59. type: 'constant',
  60. content: '# Role\nYou are an AI assistant.\n',
  61. },
  62. prompt: {
  63. type: 'constant',
  64. content: '',
  65. },
  66. },
  67. inputs: {
  68. type: 'object',
  69. required: ['modelType', 'temperature', 'prompt'],
  70. properties: {
  71. modelType: {
  72. type: 'string',
  73. },
  74. temperature: {
  75. type: 'number',
  76. },
  77. systemPrompt: {
  78. type: 'string',
  79. extra: { formComponent: 'prompt-editor' },
  80. },
  81. prompt: {
  82. type: 'string',
  83. extra: { formComponent: 'prompt-editor' },
  84. },
  85. },
  86. },
  87. outputs: {
  88. type: 'object',
  89. properties: {
  90. result: { type: 'string' },
  91. },
  92. },
  93. },
  94. },
  95. {
  96. id: 'switch_0',
  97. type: 'switch',
  98. data: {
  99. title: 'Switch',
  100. },
  101. blocks: [
  102. {
  103. id: 'case_0',
  104. type: 'case',
  105. data: {
  106. title: 'Case_0',
  107. inputsValues: {
  108. condition: { type: 'constant', content: true },
  109. },
  110. inputs: {
  111. type: 'object',
  112. required: ['condition'],
  113. properties: {
  114. condition: {
  115. type: 'boolean',
  116. },
  117. },
  118. },
  119. },
  120. blocks: [],
  121. },
  122. {
  123. id: 'case_1',
  124. type: 'case',
  125. data: {
  126. title: 'Case_1',
  127. inputsValues: {
  128. condition: { type: 'constant', content: true },
  129. },
  130. inputs: {
  131. type: 'object',
  132. required: ['condition'],
  133. properties: {
  134. condition: {
  135. type: 'boolean',
  136. },
  137. },
  138. },
  139. },
  140. },
  141. {
  142. id: 'case_default_1',
  143. type: 'caseDefault',
  144. data: {
  145. title: 'Default',
  146. },
  147. blocks: [],
  148. },
  149. ],
  150. },
  151. {
  152. id: 'loop_0',
  153. type: 'loop',
  154. data: {
  155. title: 'Loop',
  156. batchFor: {
  157. type: 'ref',
  158. content: ['start_0', 'array_obj'],
  159. },
  160. },
  161. blocks: [
  162. {
  163. id: 'if_0',
  164. type: 'if',
  165. data: {
  166. title: 'If',
  167. inputsValues: {
  168. condition: { type: 'constant', content: true },
  169. },
  170. inputs: {
  171. type: 'object',
  172. required: ['condition'],
  173. properties: {
  174. condition: {
  175. type: 'boolean',
  176. },
  177. },
  178. },
  179. },
  180. blocks: [
  181. {
  182. id: 'if_true',
  183. type: 'ifBlock',
  184. data: {
  185. title: 'true',
  186. },
  187. blocks: [],
  188. },
  189. {
  190. id: 'if_false',
  191. type: 'ifBlock',
  192. data: {
  193. title: 'false',
  194. },
  195. blocks: [
  196. {
  197. id: 'break_0',
  198. type: 'breakLoop',
  199. data: {
  200. title: 'BreakLoop',
  201. },
  202. },
  203. ],
  204. },
  205. ],
  206. },
  207. ],
  208. },
  209. {
  210. id: 'tryCatch_0',
  211. type: 'tryCatch',
  212. data: {
  213. title: 'TryCatch',
  214. },
  215. blocks: [
  216. {
  217. id: 'tryBlock_0',
  218. type: 'tryBlock',
  219. blocks: [],
  220. },
  221. {
  222. id: 'catchBlock_0',
  223. type: 'catchBlock',
  224. data: {
  225. title: 'Catch Block 1',
  226. inputsValues: {
  227. condition: { type: 'constant', content: true },
  228. },
  229. inputs: {
  230. type: 'object',
  231. required: ['condition'],
  232. properties: {
  233. condition: {
  234. type: 'boolean',
  235. },
  236. },
  237. },
  238. },
  239. blocks: [],
  240. },
  241. {
  242. id: 'catchBlock_1',
  243. type: 'catchBlock',
  244. data: {
  245. title: 'Catch Block 2',
  246. inputsValues: {
  247. condition: { type: 'constant', content: true },
  248. },
  249. inputs: {
  250. type: 'object',
  251. required: ['condition'],
  252. properties: {
  253. condition: {
  254. type: 'boolean',
  255. },
  256. },
  257. },
  258. },
  259. blocks: [],
  260. },
  261. ],
  262. },
  263. {
  264. id: 'end_0',
  265. type: 'end',
  266. blocks: [],
  267. data: {
  268. title: 'End',
  269. outputs: {
  270. type: 'object',
  271. properties: {
  272. result: {
  273. type: 'string',
  274. },
  275. },
  276. },
  277. },
  278. },
  279. ],
  280. };