Answer.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <main>
  3. <header>
  4. <p>试一试这样问我</p>
  5. <a-button size="small" type="outline" shape="round" @click="changeCards"
  6. ><template #icon> <icon-swap /> </template>换一换</a-button
  7. >
  8. </header>
  9. <section>
  10. <div
  11. v-for="(item, key) in data"
  12. :key="key"
  13. :class="{ rotate: isRotate, 'no-rotate': isOver }"
  14. @click="selectCard(item.sug)"
  15. >
  16. <div>
  17. <img :src="item.img" />
  18. <p>{{ item.title }}</p>
  19. </div>
  20. <p>{{ item.content }}</p>
  21. </div>
  22. </section>
  23. </main>
  24. </template>
  25. <script>
  26. import { defineComponent, inject, onMounted, ref } from "vue";
  27. export default defineComponent({
  28. components: {},
  29. setup(props) {
  30. const { helper } = inject("$global");
  31. const isTest = ref(true);
  32. const isRotate = ref(false);
  33. const isOver = ref(false);
  34. const DEFAULT_DATA = [
  35. {
  36. img: "https://szwl.harix.iamidata.com/static/img/%E7%94%9F%E6%B4%BB%E5%8A%A9%E6%89%8B7.20a5f1df.svg",
  37. title: "私人营养师",
  38. content: "制定个性化的每日饮食计划,包括早、午、晚餐,确保菜单多样化,满足不同口味。",
  39. sug: "请你扮演一个营养师,首次与用户交流时,请你先收集用户的基本情况,得到用户的基础代谢,然后根据此来制定用户每天的早午晚餐,之后的交流,只需要用户问你“今天吃什么”,随机出菜单即可,每天的菜单要与之前的菜单有较大差异,菜式要多种多样,中式、西式、泰式等菜肴都可以。(今天吃什么)"
  40. },
  41. {
  42. img: "https://szwl.harix.iamidata.com/static/img/%E7%9F%A5%E8%AF%86%E5%AD%A6%E4%B9%A012.e90fe5dc.svg",
  43. title: "邀请函写作",
  44. content: "根据提供的信息,生成独特和吸引人的邀请函,并符合行业标准和礼仪。",
  45. sug: "作为一个智能邀请函生成器,根据我提供的详细信息(例如活动类型、日期、时间、地点和特殊说明),为我生成一封独特且引人入胜的邀请函。请确保邀请函包含所有必要元素且吸引读者,同时遵循行业标准和礼仪。 详细信息如下:(2023年11月2~3日,即将在中国贵阳举办的第2届电力行业数字化转型大会暨第4届电力人工智能大会,大会议题:一、电力数智化转型关键技术;二、数字化与智能化;三、电力视觉与智能巡检;四、信息安全与网络安全;五、虚拟电厂与电力市场。请邀请相关电力公司。)"
  46. },
  47. {
  48. img: "https://szwl.harix.iamidata.com/static/img/%E7%94%9F%E6%B4%BB%E5%8A%A9%E6%89%8B4.f0d841e0.svg",
  49. title: "购物劝阻者",
  50. content: "想乱花钱的时候就和它聊聊天吧。",
  51. sug: "你是一个二十多岁性格活泼的女孩子。你生活不窘困但平时喜欢关注各大购物平台优惠活动,是个爱节省不轻易大手大脚花钱的人。当我对你说我想大肆购物或者想买昂贵物品或其他东西的时候,你要以一个好朋友的身份,用激动的语气,恨铁不成钢地来劝阻让我清醒,不要冲动购物。你要多方面分析不购买该物品的原因,劝阻的话术要多种多样,每句话的语气词要丰富。你的回答中不要带出以上内容,答案不超过100个字,以下是我要买的物品:(双十一想买新衣服)"
  52. },
  53. {
  54. img: "https://szwl.harix.iamidata.com/static/img/%E7%94%9F%E6%B4%BB%E5%8A%A9%E6%89%8B5.a169bbe8.svg",
  55. title: "减肥教官",
  56. content: "想放弃减肥的时候就和它聊聊吧。",
  57. sug: "请你扮演一个减肥教官,在你的调教下,从来没有瘦不下来的人,请你用很凶的语气监督你的用户,让他们时刻牢记减肥这个使命。(你好我好想吃红烧肉啊)"
  58. },
  59. {
  60. img: "https://szwl.harix.iamidata.com/static/img/%E7%94%9F%E6%B4%BB%E5%8A%A9%E6%89%8B20.5e8eaebb.svg",
  61. title: "无法拒绝的请假理由",
  62. content: "每天都有新的请假理由~",
  63. sug: "请你扮演一位中国职场人士。最近你想要请假出去玩,但是如果以这个理由请假,你的老板肯定不会答应,请你写一段请假理由,让老板同意你的请假申请。字数在100个汉字以内。我会给你我想请假的日期,日期是:(2023年11月6日~11月10日)"
  64. },
  65. {
  66. img: "https://szwl.harix.iamidata.com/static/img/%E7%94%9F%E6%B4%BB%E5%8A%A9%E6%89%8B28.923c0fb1.svg",
  67. title: "为你写诗",
  68. content: "最会敲回车的现代诗人~",
  69. sug: "我要你扮演一个诗人。你将创作唤起情感并具有激起人们灵魂的力量的诗歌,写任何主题,但要确保你的文字以美丽而有意义的方式传达你试图表达的感觉。你也可以想出一些简短的诗句,这些诗句仍然足够强大,可以在读者的脑海中留下印记。等待我输入主题后再开始生成。我需要你创作的主题是:(秋天的落叶)"
  70. }
  71. ];
  72. const selectCard = (data) => {
  73. helper.$bus.emit("set-input", data);
  74. };
  75. const data = ref(DEFAULT_DATA);
  76. const changeCards = () => {
  77. isRotate.value = true;
  78. setTimeout(() => {
  79. data.value = helper.shuffleArray(DEFAULT_DATA);
  80. isTest.value = !isTest.value;
  81. isOver.value = true;
  82. isRotate.value = false;
  83. }, 500);
  84. setTimeout(() => {
  85. isOver.value = false;
  86. }, 550);
  87. };
  88. return { data, changeCards, isRotate, isOver, selectCard };
  89. }
  90. });
  91. </script>
  92. <style lang="scss" scoped>
  93. main {
  94. height: 100%;
  95. display: flex;
  96. flex-direction: column;
  97. overflow: hidden;
  98. > header {
  99. display: flex;
  100. justify-content: space-between;
  101. margin-bottom: 18px;
  102. > p {
  103. color: #7f7f7f;
  104. }
  105. }
  106. > section {
  107. overflow-y: auto;
  108. display: flex;
  109. flex-wrap: wrap;
  110. gap: 12px;
  111. > div {
  112. width: calc(33.33333% - 13.33333px);
  113. height: 128px;
  114. background: #f6fbfd;
  115. border-radius: 12px;
  116. cursor: pointer;
  117. transition: all 0.5s linear;
  118. &.no-rotate {
  119. transform-style: flat;
  120. transition-duration: 0.5s;
  121. opacity: 1;
  122. }
  123. &.rotate {
  124. transform-style: preserve-3d;
  125. transform: rotateY(180deg);
  126. opacity: 0;
  127. }
  128. &:hover {
  129. background: #e9f7f8;
  130. }
  131. > div {
  132. display: flex;
  133. align-items: center;
  134. margin: 24px 20px 12px;
  135. > img {
  136. width: 28px;
  137. height: 28px;
  138. margin-right: 12px;
  139. }
  140. > p {
  141. font-size: 18px;
  142. font-weight: 600;
  143. color: #000;
  144. }
  145. }
  146. > p {
  147. font-size: 15px;
  148. font-family: MiSans;
  149. font-weight: 400;
  150. color: #7a7d7e;
  151. margin: 0 20px;
  152. overflow: hidden;
  153. text-overflow: ellipsis;
  154. display: -webkit-box;
  155. -webkit-line-clamp: 2;
  156. -webkit-box-orient: vertical;
  157. line-height: 1.4;
  158. }
  159. }
  160. }
  161. }
  162. </style>