WelcomePanel.vue 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <script setup lang="ts">
  2. defineOptions({
  3. name: 'AiAssistantWelcomePanel',
  4. })
  5. defineProps<{
  6. disabled?: boolean
  7. }>()
  8. const emit = defineEmits<{
  9. send: [text: string]
  10. fill: [text: string]
  11. }>()
  12. interface Example {
  13. icon: string
  14. text: string
  15. /** 带占位符的示例只填入输入框,由用户补全后发送 */
  16. needsInput: boolean
  17. }
  18. const examples: Example[] = [
  19. { icon: 'i-ph:warning-circle', text: '查一下站点 【SN】 最近 7 天的告警和事件', needsInput: true },
  20. { icon: 'i-ph:chart-bar', text: '统计昨天停机站点按国家分布', needsInput: false },
  21. { icon: 'i-ph:chart-line', text: '分析站点 【SN】 本月的功率流,生成趋势图', needsInput: true },
  22. { icon: 'i-ph:book-open', text: '告警码 【告警码】 是什么意思,通常怎么处理', needsInput: true },
  23. { icon: 'i-ph:calendar', text: '对比生产服和测试服的 TOU 模版 【模版 ID】', needsInput: true },
  24. { icon: 'i-ph:file-doc', text: '帮我把上传的 Excel 整理成一份 Word 报告', needsInput: false },
  25. ]
  26. function pick(e: Example) {
  27. if (e.needsInput) emit('fill', e.text)
  28. else emit('send', e.text)
  29. }
  30. </script>
  31. <template>
  32. <div class="mx-auto px-4 py-8 text-left max-w-180">
  33. <div class="text-xl font-semibold mb-2 flex gap-2 items-center">
  34. <span class="i-ph:sparkle text-2xl" />
  35. AI 助手
  36. </div>
  37. <div class="text-sm text-neutral-500 leading-6 mb-6">
  38. 可以查询站点、告警、停机、功率流、日志、录波、TOU 模版、SIM 卡数据,解答产品问题,分析上传的文件并生成报告。
  39. </div>
  40. <div class="gap-3 grid grid-cols-1 lg:grid-cols-3 sm:grid-cols-2">
  41. <button
  42. v-for="e in examples"
  43. :key="e.text"
  44. type="button"
  45. class="example-card text-sm leading-5 p-3 text-left rounded-lg flex flex-col gap-2 transition-colors items-start disabled:opacity-50 disabled:cursor-not-allowed"
  46. :disabled="disabled"
  47. @click="pick(e)"
  48. >
  49. <span class="text-lg" :class="e.icon" />
  50. <span>{{ e.text }}</span>
  51. <span v-if="e.needsInput" class="text-xs text-neutral-500">填写后发送</span>
  52. </button>
  53. </div>
  54. <div class="text-xs text-neutral-500 mt-6">
  55. 数据来自 FWH 平台,结果仅供参考;涉及修改数据的操作会先请你确认。
  56. </div>
  57. </div>
  58. </template>
  59. <style scoped>
  60. .example-card {
  61. border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  62. background: transparent;
  63. color: inherit;
  64. cursor: pointer;
  65. }
  66. .example-card:not(:disabled):hover {
  67. border-color: var(--primary-color);
  68. background: color-mix(in srgb, var(--primary-color) 6%, transparent);
  69. }
  70. </style>