Talk.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <main>
  3. <section>
  4. <div class="suggestions">
  5. <p>
  6. 嗨,早上好,试着问我
  7. </p>
  8. <div v-for="(item, key) in suggestions" :key="key">
  9. <a-typography-paragraph style="flex: 1; margin: 0; font-size: 14px; gba(255, 255, 255, 1);" :ellipsis="{rows: 1, css: true}">{{item}}</a-typography-paragraph>
  10. <p @click="chooseSuggestion(item)">试一试</p>
  11. </div>
  12. </div>
  13. <dialog-wrap :agentInfo="data" :userInfo="userInfo" :isSetting="false" :readonly="readonly" @setReadonly="setReadonly" />
  14. </section>
  15. <message-input :readonly="readonly" />
  16. </main>
  17. </template>
  18. <script>
  19. import { defineComponent, ref, inject } from 'vue';
  20. import MessageInput from './MessageInput.vue';
  21. import DialogWrap from './DialogWrap.vue';
  22. export default defineComponent({
  23. components: {
  24. MessageInput,
  25. DialogWrap
  26. },
  27. props: [],
  28. setup() {
  29. const { helper } = inject('$global');
  30. const readonly = ref(false);
  31. const suggestions = [
  32. '如何有效监控软件开发进度?',
  33. '软件开发中的安全漏洞如何预防?',
  34. '如何保证软件功能的完整性和稳定性?'
  35. ];
  36. const userInfo = {
  37. name: '奇橙',
  38. avatar: 'https://s21.ax1x.com/2024/04/18/pFzyA0O.png'
  39. };
  40. const data = {
  41. avatar: 'https://s21.ax1x.com/2024/04/18/pFzyA0O.png',
  42. title: '论文解读助手',
  43. name: '@奇橙',
  44. content: '你好,我是一名专业的论文检索助手,可以帮你查找并详细解读你需要的学术论文。',
  45. hot: 345,
  46. star: 34,
  47. id: '111'
  48. };
  49. const setReadonly = (status) => {
  50. readonly.value = status;
  51. };
  52. const chooseSuggestion = (text) => {
  53. if (!readonly.value) {
  54. helper.$bus.emit('send-message', text);
  55. }
  56. };
  57. return {
  58. suggestions,
  59. data,
  60. readonly,
  61. userInfo,
  62. setReadonly,
  63. chooseSuggestion
  64. }
  65. },
  66. });
  67. </script>
  68. <style scoped>
  69. main {
  70. margin: 20px 16px;
  71. display: flex;
  72. flex-direction: column;
  73. overflow: hidden;
  74. height: 100%;
  75. padding-bottom: 20px;
  76. >section {
  77. flex: 1;
  78. overflow-y: auto;
  79. .suggestions {
  80. background-color: rgba(255, 255, 255, 1);
  81. box-shadow: 0px 2px 14px -2px rgba(0, 0, 0, 0.1);
  82. padding: 16px;
  83. >p {
  84. color: rgba(16, 16, 16, 1);
  85. font-size: 18px;
  86. margin-bottom: 40px;
  87. font-weight: bold;
  88. }
  89. >div {
  90. height: 30px;
  91. align-items: center;
  92. display: flex;
  93. padding-bottom: 24px;
  94. margin-top: 24px;
  95. border-bottom: 1px solid rgba(229, 229, 229, 1);
  96. >p {
  97. border-radius: 15px;
  98. background-color: rgba(136, 176, 75, 0.1);
  99. color: rgba(136, 176, 75, 1);
  100. font-size: 14px;
  101. width: 70px;
  102. height: 30px;
  103. text-align: center;
  104. cursor: pointer;
  105. line-height: 30px;
  106. &:hover {
  107. background-color: rgba(136, 176, 75, 0.05);
  108. }
  109. }
  110. }
  111. }
  112. }
  113. }
  114. </style>