ChatBaseCard.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <script setup>
  2. import { computed, unref } from 'vue';
  3. import { useMessage } from 'naive-ui';
  4. import { useClipboard } from '@vueuse/core'
  5. import MarkdownIt from 'markdown-it';
  6. import hljs from 'highlight.js';
  7. import mila from 'markdown-it-link-attributes';
  8. import mdKatex from 'markdown-it-katex';
  9. import { SvgIcon } from '@/components';
  10. import { chatApi } from "@/api/chat"
  11. const props = defineProps({
  12. id: {
  13. type: [String, Number],
  14. default: ''
  15. },
  16. content: {
  17. type: String,
  18. default: ''
  19. },
  20. loading: {
  21. type: Boolean,
  22. default: false
  23. },
  24. delayLoading: {
  25. type: Boolean,
  26. default: false
  27. },
  28. isSatisfied: {
  29. type: Number,
  30. default: 2
  31. },
  32. toggleVisibleIcons: {
  33. type: Boolean,
  34. default: false
  35. },
  36. loadingText: {
  37. type: String,
  38. default: "内容生成中..."
  39. }
  40. })
  41. </script>
  42. <template>
  43. <div class="answer-inner">
  44. <div :class="[ 'answer-card', 'px-[20px]', 'py-[20px]']">
  45. <div class="chat-answer_icon relative flex-shrink-0">
  46. <SvgIcon name="common-logo" class="chat-logo " size="30" :style="{ scale: loading ? 0 : 1 }" />
  47. <div style="color: #2454FF" class="la-ball-circus la-dark la-sm flex-shrink-0" v-show="loading">
  48. <div v-for="item in 5" :key="item"></div>
  49. </div>
  50. </div>
  51. <div class="flex-1 pt-[4px] ml-[16px] text-[15px]">
  52. <template v-if="loading && delayLoading">
  53. <p class="font-bold text-[#1A2029] leading-[24px]">{{ loadingText }}</p>
  54. </template>
  55. <slot></slot>
  56. <slot name="text"></slot>
  57. </div>
  58. </div>
  59. <slot name="button"/>
  60. </div>
  61. </template>
  62. <style lang="scss">
  63. .chat-logo {
  64. position: absolute;
  65. transition: all 1s;
  66. }
  67. .answer-inner {
  68. margin-bottom: 20px;
  69. .answer-card {
  70. @include flex(x, start, start);
  71. border-radius: 8px;
  72. background: #fff;
  73. }
  74. .answer-btn-group {
  75. @include flex(x, center, end);
  76. padding-top: 6px;
  77. .btn {
  78. @include flex(x, center, center);
  79. @include layout(28px, 28px, 4px);
  80. color: #89909B;
  81. cursor: pointer;
  82. &:hover, &_active {
  83. background: #DBEFFF;
  84. color: #2454FF;
  85. }
  86. }
  87. .line {
  88. @include layout(1px, 12px, 0);
  89. margin: 0 5px;
  90. background: #D3D0E1;
  91. }
  92. }
  93. }
  94. </style>