Left.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div class="w-[350px] p-5 flex flex-col bg-[#f5f7f9]">
  3. <h3 class="w-full h-full h-7 text-5 text-center leading-[28px] title">思维导图创作中心</h3>
  4. <!--下面表单部分-->
  5. <div class="flex-grow overflow-y-auto">
  6. <div class="mt-[30ppx]">
  7. <el-text tag="b">您的需求?</el-text>
  8. <el-input
  9. v-model="formData.prompt"
  10. maxlength="1024"
  11. rows="5"
  12. class="w-100% mt-15px"
  13. input-style="border-radius: 7px;"
  14. placeholder="请输入提示词,让AI帮你完善"
  15. show-word-limit
  16. type="textarea"
  17. />
  18. <el-button
  19. class="!w-full mt-[15px]"
  20. type="primary"
  21. :loading="isGenerating"
  22. @click="emits('submit', formData)"
  23. >
  24. 智能生成思维导图
  25. </el-button>
  26. </div>
  27. <div class="mt-[30px]">
  28. <el-text tag="b">使用已有内容生成?</el-text>
  29. <el-input
  30. v-model="generatedContent"
  31. maxlength="1024"
  32. rows="5"
  33. class="w-100% mt-15px"
  34. input-style="border-radius: 7px;"
  35. placeholder="例如:童话里的小屋应该是什么样子?"
  36. show-word-limit
  37. type="textarea"
  38. />
  39. <el-button
  40. class="!w-full mt-[15px]"
  41. type="primary"
  42. @click="emits('directGenerate', generatedContent)"
  43. :disabled="isGenerating"
  44. >
  45. 直接生成
  46. </el-button>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <script setup lang="ts">
  52. import { MindMapContentExample } from '@/views/ai/utils/constants'
  53. const emits = defineEmits(['submit', 'directGenerate'])
  54. defineProps<{
  55. isGenerating: boolean
  56. }>()
  57. // 提交的提示词字段
  58. const formData = reactive({
  59. prompt: ''
  60. })
  61. const generatedContent = ref(MindMapContentExample) // 已有的内容
  62. defineExpose({
  63. setGeneratedContent(newContent: string) {
  64. // 设置已有的内容,在生成结束的时候将结果赋值给该值
  65. generatedContent.value = newContent
  66. }
  67. })
  68. </script>
  69. <style lang="scss" scoped>
  70. .title {
  71. color: var(--el-color-primary);
  72. }
  73. </style>