initial-data.ts 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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: 'agent_0',
  45. type: 'agent',
  46. data: {
  47. title: 'Agent',
  48. },
  49. blocks: [
  50. {
  51. id: 'agentLLM_0',
  52. type: 'agentLLM',
  53. blocks: [
  54. {
  55. id: 'llm_5',
  56. type: 'llm',
  57. meta: {
  58. defaultExpanded: false,
  59. },
  60. data: {
  61. title: 'LLM',
  62. inputsValues: {
  63. modelType: {
  64. type: 'constant',
  65. content: 'gpt-3.5-turbo',
  66. },
  67. temperature: {
  68. type: 'constant',
  69. content: 0.5,
  70. },
  71. systemPrompt: {
  72. type: 'constant',
  73. content: '# Role\nYou are an AI assistant.\n',
  74. },
  75. prompt: {
  76. type: 'constant',
  77. content: '',
  78. },
  79. },
  80. inputs: {
  81. type: 'object',
  82. required: ['modelType', 'temperature', 'prompt'],
  83. properties: {
  84. modelType: {
  85. type: 'string',
  86. },
  87. temperature: {
  88. type: 'number',
  89. },
  90. systemPrompt: {
  91. type: 'string',
  92. extra: { formComponent: 'prompt-editor' },
  93. },
  94. prompt: {
  95. type: 'string',
  96. extra: { formComponent: 'prompt-editor' },
  97. },
  98. },
  99. },
  100. outputs: {
  101. type: 'object',
  102. properties: {
  103. result: { type: 'string' },
  104. },
  105. },
  106. },
  107. },
  108. ],
  109. },
  110. {
  111. id: 'agentMemory_0',
  112. type: 'agentMemory',
  113. blocks: [
  114. {
  115. id: 'memory_0',
  116. type: 'memory',
  117. meta: {
  118. defaultExpanded: false,
  119. },
  120. data: {
  121. title: 'Memory',
  122. },
  123. },
  124. ],
  125. },
  126. {
  127. id: 'agentTools_0',
  128. type: 'agentTools',
  129. blocks: [
  130. {
  131. id: 'tool_0',
  132. type: 'tool',
  133. data: {
  134. title: 'Tool0',
  135. },
  136. },
  137. {
  138. id: 'tool_1',
  139. type: 'tool',
  140. data: {
  141. title: 'Tool1',
  142. },
  143. },
  144. ],
  145. },
  146. ],
  147. },
  148. {
  149. id: 'llm_0',
  150. type: 'llm',
  151. blocks: [],
  152. data: {
  153. title: 'LLM',
  154. inputsValues: {
  155. modelType: {
  156. type: 'constant',
  157. content: 'gpt-3.5-turbo',
  158. },
  159. temperature: {
  160. type: 'constant',
  161. content: 0.5,
  162. },
  163. systemPrompt: {
  164. type: 'constant',
  165. content: '# Role\nYou are an AI assistant.\n',
  166. },
  167. prompt: {
  168. type: 'constant',
  169. content: '',
  170. },
  171. },
  172. inputs: {
  173. type: 'object',
  174. required: ['modelType', 'temperature', 'prompt'],
  175. properties: {
  176. modelType: {
  177. type: 'string',
  178. },
  179. temperature: {
  180. type: 'number',
  181. },
  182. systemPrompt: {
  183. type: 'string',
  184. extra: { formComponent: 'prompt-editor' },
  185. },
  186. prompt: {
  187. type: 'string',
  188. extra: { formComponent: 'prompt-editor' },
  189. },
  190. },
  191. },
  192. outputs: {
  193. type: 'object',
  194. properties: {
  195. result: { type: 'string' },
  196. },
  197. },
  198. },
  199. },
  200. {
  201. id: 'switch_0',
  202. type: 'switch',
  203. data: {
  204. title: 'Switch',
  205. },
  206. blocks: [
  207. {
  208. id: 'case_0',
  209. type: 'case',
  210. data: {
  211. title: 'Case_0',
  212. inputsValues: {
  213. condition: { type: 'constant', content: true },
  214. },
  215. inputs: {
  216. type: 'object',
  217. required: ['condition'],
  218. properties: {
  219. condition: {
  220. type: 'boolean',
  221. },
  222. },
  223. },
  224. },
  225. blocks: [],
  226. },
  227. {
  228. id: 'case_1',
  229. type: 'case',
  230. data: {
  231. title: 'Case_1',
  232. inputsValues: {
  233. condition: { type: 'constant', content: true },
  234. },
  235. inputs: {
  236. type: 'object',
  237. required: ['condition'],
  238. properties: {
  239. condition: {
  240. type: 'boolean',
  241. },
  242. },
  243. },
  244. },
  245. },
  246. {
  247. id: 'case_default_1',
  248. type: 'caseDefault',
  249. data: {
  250. title: 'Default',
  251. },
  252. blocks: [],
  253. },
  254. ],
  255. },
  256. {
  257. id: 'loop_0',
  258. type: 'loop',
  259. data: {
  260. title: 'Loop',
  261. batchFor: {
  262. type: 'ref',
  263. content: ['start_0', 'array_obj'],
  264. },
  265. },
  266. blocks: [
  267. {
  268. id: 'if_0',
  269. type: 'if',
  270. data: {
  271. title: 'If',
  272. inputsValues: {
  273. condition: { type: 'constant', content: true },
  274. },
  275. inputs: {
  276. type: 'object',
  277. required: ['condition'],
  278. properties: {
  279. condition: {
  280. type: 'boolean',
  281. },
  282. },
  283. },
  284. },
  285. blocks: [
  286. {
  287. id: 'if_true',
  288. type: 'ifBlock',
  289. data: {
  290. title: 'true',
  291. },
  292. blocks: [],
  293. },
  294. {
  295. id: 'if_false',
  296. type: 'ifBlock',
  297. data: {
  298. title: 'false',
  299. },
  300. blocks: [
  301. {
  302. id: 'break_0',
  303. type: 'breakLoop',
  304. data: {
  305. title: 'BreakLoop',
  306. },
  307. },
  308. ],
  309. },
  310. ],
  311. },
  312. ],
  313. },
  314. {
  315. id: 'tryCatch_0',
  316. type: 'tryCatch',
  317. data: {
  318. title: 'TryCatch',
  319. },
  320. blocks: [
  321. {
  322. id: 'tryBlock_0',
  323. type: 'tryBlock',
  324. blocks: [],
  325. },
  326. {
  327. id: 'catchBlock_0',
  328. type: 'catchBlock',
  329. data: {
  330. title: 'Catch Block 1',
  331. inputsValues: {
  332. condition: { type: 'constant', content: true },
  333. },
  334. inputs: {
  335. type: 'object',
  336. required: ['condition'],
  337. properties: {
  338. condition: {
  339. type: 'boolean',
  340. },
  341. },
  342. },
  343. },
  344. blocks: [],
  345. },
  346. {
  347. id: 'catchBlock_1',
  348. type: 'catchBlock',
  349. data: {
  350. title: 'Catch Block 2',
  351. inputsValues: {
  352. condition: { type: 'constant', content: true },
  353. },
  354. inputs: {
  355. type: 'object',
  356. required: ['condition'],
  357. properties: {
  358. condition: {
  359. type: 'boolean',
  360. },
  361. },
  362. },
  363. },
  364. blocks: [],
  365. },
  366. ],
  367. },
  368. {
  369. id: 'end_0',
  370. type: 'end',
  371. blocks: [],
  372. data: {
  373. title: 'End',
  374. inputsValues: {
  375. success: { type: 'constant', content: true, schema: { type: 'boolean' } },
  376. },
  377. },
  378. },
  379. ],
  380. };