ModalAddIntel.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <a-modal
  3. v-model:visible="showModal"
  4. title-align="start"
  5. :align-center="false"
  6. :esc-to-close="false"
  7. :footer="false"
  8. top="15vh"
  9. width="60vw"
  10. @before-cancel="handleCancel"
  11. >
  12. <template #title>
  13. <div class="model-title">新建智能体</div>
  14. </template>
  15. <div class="section">
  16. <CardDefault
  17. v-for="item in default_intelligent"
  18. :key="item.name"
  19. :name="item.name"
  20. :description="item.description"
  21. :labels="item.labels"
  22. >
  23. <template #footer>
  24. <a-button class="add-btn" @click="addNewIntelligent(item)"> <icon-plus /> 新建 </a-button>
  25. </template>
  26. </CardDefault>
  27. </div>
  28. </a-modal>
  29. </template>
  30. <script setup>
  31. import { ref, computed } from 'vue';
  32. import CardDefault from './CardDefault.vue';
  33. import { getDefaultIntelligent } from '../../views/manage/common';
  34. const props = defineProps({
  35. visible: {
  36. type: Boolean,
  37. default: false
  38. }
  39. });
  40. const emit = defineEmits(['update:visible', 'add_intelligent', 'createRAGFLOWIntelligent']);
  41. const showModal = computed(() => props.visible);
  42. const default_intelligent = getDefaultIntelligent();
  43. const handleCancel = () => {
  44. emit('update:visible', false);
  45. };
  46. const addNewIntelligent = (item) => {
  47. // TODO: 根据item中的type区分新建智能体的类型
  48. if (item.type === 'ragflow') {
  49. // TODO: 新建RAGFLOW智能体
  50. emit('update:visible', false);
  51. emit('createRAGFLOWIntelligent');
  52. // } else if (item.type === 'advanced-chat') {
  53. // // TODO: 新建ARGFLOW智能体
  54. // emit('update:visible', false);
  55. // emit('add_intelligent', item);
  56. // } else if (item.type === 'agent-chat') {
  57. // } else if (item.type === 'workflow') {
  58. // }
  59. } else {
  60. emit('update:visible', false);
  61. emit('add_intelligent', item);
  62. }
  63. };
  64. </script>
  65. <style scoped lang="css">
  66. .model-title {
  67. font-size: 16px;
  68. font-weight: bold;
  69. }
  70. .section {
  71. display: grid;
  72. grid-template-columns: repeat(3, 1fr);
  73. justify-content: flex-start;
  74. gap: 20px 20px;
  75. }
  76. .section .add-btn {
  77. width: 100%;
  78. }
  79. .section .add-btn:hover {
  80. background-color: rgb(var(--arcoblue-6));
  81. color: var(--color-bg-1);
  82. }
  83. .arco-form-item-content-wrapper {
  84. border-color: var(--color-neutral-4);
  85. }
  86. </style>