constants.ts 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import type { ComponentType } from 'react'
  2. import { BlockEnum } from '../types'
  3. import StartNode from './start/node'
  4. import StartPanel from './start/panel'
  5. import EndNode from './end/node'
  6. import EndPanel from './end/panel'
  7. import AnswerNode from './answer/node'
  8. import AnswerPanel from './answer/panel'
  9. import LLMNode from './llm/node'
  10. import LLMPanel from './llm/panel'
  11. import KnowledgeRetrievalNode from './knowledge-retrieval/node'
  12. import KnowledgeRetrievalPanel from './knowledge-retrieval/panel'
  13. import QuestionClassifierNode from './question-classifier/node'
  14. import QuestionClassifierPanel from './question-classifier/panel'
  15. import IfElseNode from './if-else/node'
  16. import IfElsePanel from './if-else/panel'
  17. import CodeNode from './code/node'
  18. import CodePanel from './code/panel'
  19. import TemplateTransformNode from './template-transform/node'
  20. import TemplateTransformPanel from './template-transform/panel'
  21. import HttpNode from './http/node'
  22. import HttpPanel from './http/panel'
  23. import ToolNode from './tool/node'
  24. import ToolPanel from './tool/panel'
  25. import VariableAssignerNode from './variable-assigner/node'
  26. import VariableAssignerPanel from './variable-assigner/panel'
  27. import AssignerNode from './assigner/node'
  28. import AssignerPanel from './assigner/panel'
  29. import ParameterExtractorNode from './parameter-extractor/node'
  30. import ParameterExtractorPanel from './parameter-extractor/panel'
  31. import IterationNode from './iteration/node'
  32. import IterationPanel from './iteration/panel'
  33. import DocExtractorNode from './document-extractor/node'
  34. import DocExtractorPanel from './document-extractor/panel'
  35. import ListFilterNode from './list-operator/node'
  36. import ListFilterPanel from './list-operator/panel'
  37. export const NodeComponentMap: Record<string, ComponentType<any>> = {
  38. [BlockEnum.Start]: StartNode,
  39. [BlockEnum.End]: EndNode,
  40. [BlockEnum.Answer]: AnswerNode,
  41. [BlockEnum.LLM]: LLMNode,
  42. [BlockEnum.KnowledgeRetrieval]: KnowledgeRetrievalNode,
  43. [BlockEnum.QuestionClassifier]: QuestionClassifierNode,
  44. [BlockEnum.IfElse]: IfElseNode,
  45. [BlockEnum.Code]: CodeNode,
  46. [BlockEnum.TemplateTransform]: TemplateTransformNode,
  47. [BlockEnum.HttpRequest]: HttpNode,
  48. [BlockEnum.Tool]: ToolNode,
  49. [BlockEnum.VariableAssigner]: VariableAssignerNode,
  50. [BlockEnum.Assigner]: AssignerNode,
  51. [BlockEnum.VariableAggregator]: VariableAssignerNode,
  52. [BlockEnum.ParameterExtractor]: ParameterExtractorNode,
  53. [BlockEnum.Iteration]: IterationNode,
  54. [BlockEnum.DocExtractor]: DocExtractorNode,
  55. [BlockEnum.ListFilter]: ListFilterNode,
  56. }
  57. export const PanelComponentMap: Record<string, ComponentType<any>> = {
  58. [BlockEnum.Start]: StartPanel,
  59. [BlockEnum.End]: EndPanel,
  60. [BlockEnum.Answer]: AnswerPanel,
  61. [BlockEnum.LLM]: LLMPanel,
  62. [BlockEnum.KnowledgeRetrieval]: KnowledgeRetrievalPanel,
  63. [BlockEnum.QuestionClassifier]: QuestionClassifierPanel,
  64. [BlockEnum.IfElse]: IfElsePanel,
  65. [BlockEnum.Code]: CodePanel,
  66. [BlockEnum.TemplateTransform]: TemplateTransformPanel,
  67. [BlockEnum.HttpRequest]: HttpPanel,
  68. [BlockEnum.Tool]: ToolPanel,
  69. [BlockEnum.VariableAssigner]: VariableAssignerPanel,
  70. [BlockEnum.VariableAggregator]: VariableAssignerPanel,
  71. [BlockEnum.Assigner]: AssignerPanel,
  72. [BlockEnum.ParameterExtractor]: ParameterExtractorPanel,
  73. [BlockEnum.Iteration]: IterationPanel,
  74. [BlockEnum.DocExtractor]: DocExtractorPanel,
  75. [BlockEnum.ListFilter]: ListFilterPanel,
  76. }
  77. export const CUSTOM_NODE_TYPE = 'custom'