Skip to content

Let's use AI to Earn!

5.0 KB
Raw Blame
/**
 * ChatMessage 样式
 * 包含 Markdown 内容渲染和多步骤工作流展示样式
 */

// 消息步骤容器
.messageStep {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// 工作流区域样式
.workflowSection {
  animation: slideIn 0.15s ease-out;

  button {
    transition:
      transform 0.15s ease,
      background-color 0.15s ease,
      box-shadow 0.15s ease;

    &:active {
      transform: scale(0.98);
    }
  }
}

// 工作流详情列表 - 高度限制和滚动条
.workflowDetailList {
  max-height: 200px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;

  &::-webkit-scrollbar {
    width: 4px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 2px;
  }

  &::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 2px;

    &:hover {
      background: rgba(139, 92, 246, 0.5);
    }
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.markdownContent {
  /* 允许内部长单词/URL在必要时换行,避免溢出父容器 */
  overflow-wrap: anywhere;
  word-wrap: break-word;
  word-break: break-word;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;

  // 段落
  :global(p) {
    margin: 0 0 12px 0;
    line-height: 1.7;
    font-size: 14px;
  }

  :global(p:first-child) {
    margin-top: 0;
  }

  :global(p:last-child) {
    margin-bottom: 0;
  }

  // 标题
  :global(h1),
  :global(h2),
  :global(h3),
  :global(h4),
  :global(h5),
  :global(h6) {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.4;
    color: #1a1a1a;
  }

  :global(h1:first-child),
  :global(h2:first-child),
  :global(h3:first-child),
  :global(h4:first-child),
  :global(h5:first-child),
  :global(h6:first-child) {
    margin-top: 0;
  }

  :global(h1) {
    font-size: 1.5em;
  }

  :global(h2) {
    font-size: 1.3em;
  }

  :global(h3) {
    font-size: 1.15em;
  }

  :global(h4),
  :global(h5),
  :global(h6) {
    font-size: 1em;
  }

  // 列表
  :global(ul),
  :global(ol) {
    margin: 0 0 12px 0;
    padding-left: 20px;
  }

  :global(ul:last-child),
  :global(ol:last-child) {
    margin-bottom: 0;
  }

  :global(li) {
    margin-bottom: 4px;
    line-height: 1.7;
    font-size: 14px;
  }

  :global(li:last-child) {
    margin-bottom: 0;
  }

  :global(ul) {
    list-style-type: disc;
  }

  :global(ul ul) {
    list-style-type: circle;
    margin-top: 4px;
    margin-bottom: 0;
  }

  :global(ul ul ul) {
    list-style-type: square;
  }

  :global(ol) {
    list-style-type: decimal;
  }

  :global(ol ol) {
    margin-top: 4px;
    margin-bottom: 0;
  }

  // 代码块
  :global(code) {
    padding: 2px 6px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 4px;
    font-family: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    color: #7c3aed;
  }

  :global(pre) {
    margin: 12px 0;
    padding: 12px 16px;
    background: #1e1e1e;
    border-radius: 8px;
    overflow-x: auto;
  }

  :global(pre:last-child) {
    margin-bottom: 0;
  }

  :global(pre code) {
    padding: 0;
    background: transparent;
    color: #d4d4d4;
    font-size: 13px;
    line-height: 1.5;
  }

  // 引用
  :global(blockquote) {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 4px solid #a855f7;
    background: rgba(168, 85, 247, 0.05);
    border-radius: 0 8px 8px 0;
  }

  :global(blockquote:last-child) {
    margin-bottom: 0;
  }

  :global(blockquote p) {
    margin: 0;
    color: #4b5563;
    font-style: italic;
  }

  // 链接
  :global(a) {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 500;
    /* 支持长链接/无空格字符串换行,防止溢出气泡容器 */
    overflow-wrap: anywhere;
    word-wrap: break-word;
    /* break-all 可在必要时强制断行(对英语长链接生效) */
    word-break: break-all;
    hyphens: auto;
  }

  :global(a:hover) {
    text-decoration: underline;
    color: #6d28d9;
  }

  // 粗体 & 斜体
  :global(strong) {
    font-weight: 600;
    color: #1a1a1a;
  }

  :global(em) {
    font-style: italic;
  }

  // 分割线
  :global(hr) {
    margin: 16px 0;
    border: none;
    border-top: 1px solid #e5e7eb;
  }

  // 表格
  :global(table) {
    width: 100%;
    margin: 12px 0;
    border-collapse: collapse;
    font-size: 14px;
  }

  :global(table:last-child) {
    margin-bottom: 0;
  }

  :global(th),
  :global(td) {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    text-align: left;
  }

  :global(th) {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
  }

  :global(tr:nth-child(even)) {
    background: #fafafa;
  }

  // 图片
  :global(img) {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
  }

  // 删除线
  :global(del) {
    text-decoration: line-through;
    color: #9ca3af;
  }
}