memory.ts 788 B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { nanoid } from 'nanoid';
  6. import { defaultFormMeta } from '../default-form-meta';
  7. import { FlowNodeRegistry } from '../../typings';
  8. import iconMemory from '../../assets/icon-memory.svg';
  9. let index = 0;
  10. export const MemoryNodeRegistry: FlowNodeRegistry = {
  11. type: 'memory',
  12. info: {
  13. icon: iconMemory,
  14. description: 'Memory.',
  15. },
  16. meta: {
  17. addDisable: true,
  18. deleteDisable: true, // memory 不能单独删除,只能通过 agent
  19. copyDisable: true,
  20. draggable: false,
  21. },
  22. formMeta: defaultFormMeta,
  23. onAdd() {
  24. return {
  25. id: `memory_${nanoid(5)}`,
  26. type: 'memory',
  27. data: {
  28. title: `Memory_${++index}`,
  29. },
  30. };
  31. },
  32. };