ModalAddIntel.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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">{{ $t('management.create_intelligent_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)">
  25. <icon-plus />&nbsp;{{ $t('management.create_btn') }}
  26. </a-button>
  27. </template>
  28. </CardDefault>
  29. </div>
  30. </a-modal>
  31. </template>
  32. <script setup>
  33. import { ref, computed } from 'vue';
  34. import CardDefault from './CardDefault.vue';
  35. import { getDefaultIntelligent } from '../../views/manage/common';
  36. import { useI18n } from 'vue-i18n';
  37. const { t } = useI18n();
  38. const props = defineProps({
  39. visible: {
  40. type: Boolean,
  41. default: false
  42. }
  43. });
  44. const emit = defineEmits(['update:visible', 'add_intelligent', 'createRAGFLOWIntelligent']);
  45. const showModal = computed(() => props.visible);
  46. const default_intelligent = computed(() => getDefaultIntelligent(t));
  47. const handleCancel = () => {
  48. emit('update:visible', false);
  49. };
  50. const addNewIntelligent = (item) => {
  51. // TODO: 根据item中的type区分新建智能体的类型
  52. if (item.type === 'agent-dialog') {
  53. // TODO: 新建RAGFLOW智能体
  54. emit('update:visible', false);
  55. emit('createRAGFLOWIntelligent');
  56. // } else if (item.type === 'advanced-chat') {
  57. // // TODO: 新建ARGFLOW智能体
  58. // emit('update:visible', false);
  59. // emit('add_intelligent', item);
  60. // } else if (item.type === 'agent-chat') {
  61. // } else if (item.type === 'workflow') {
  62. // }
  63. } else {
  64. emit('update:visible', false);
  65. emit('add_intelligent', item);
  66. }
  67. };
  68. </script>
  69. <style scoped lang="css">
  70. .model-title {
  71. font-size: 16px;
  72. font-weight: bold;
  73. }
  74. .section {
  75. display: grid;
  76. grid-template-columns: repeat(3, 1fr);
  77. justify-content: flex-start;
  78. gap: 20px 20px;
  79. }
  80. .section .add-btn {
  81. width: 100%;
  82. }
  83. .section .add-btn:hover {
  84. background-color: rgb(var(--arcoblue-6));
  85. color: var(--color-bg-1);
  86. }
  87. .arco-form-item-content-wrapper {
  88. border-color: var(--color-border-3);
  89. }
  90. </style>