This commit is contained in:
2025-10-18 05:08:53 +00:00
parent efa9d852ac
commit 62c08e7132
2 changed files with 16 additions and 13 deletions

View File

@ -16,6 +16,9 @@ RUN npm install
# 复制项目文件 # 复制项目文件
COPY . . COPY . .
# 构建项目
RUN npm run build
# 生产阶段 - 使用Node镜像运行Next.js应用 # 生产阶段 - 使用Node镜像运行Next.js应用
FROM node:20-alpine FROM node:20-alpine

View File

@ -1,5 +1,6 @@
import React, { useRef } from 'react'; import * as React from 'react';
import { Box, Paper, Typography, Avatar, useMediaQuery, useTheme } from '@mui/material'; const { useRef } = React;
import { Box, Paper, Typography, Avatar, useMediaQuery, useTheme, Theme } from '@mui/material';
import ReactMarkdown from 'react-markdown'; import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw'; import rehypeRaw from 'rehype-raw';
import remarkGfm from 'remark-gfm'; import remarkGfm from 'remark-gfm';
@ -85,39 +86,38 @@ const Message: React.FC<MessageProps> = ({ message, isLast = false }) => {
remarkPlugins={[remarkGfm]} remarkPlugins={[remarkGfm]}
components={{ components={{
// 自定义标题样式 // 自定义标题样式
h1: (props: any) => ( h1: (props: React.ComponentProps<'h1'>) => (
<h1 style={{ fontSize: '1.4rem', fontWeight: 'bold', margin: '12px 0 8px 0' }} {...props} /> <h1 style={{ fontSize: '1.4rem', fontWeight: 'bold', margin: '12px 0 8px 0' }} {...props} />
), ),
h2: (props: any) => ( h2: (props: React.ComponentProps<'h2'>) => (
<h2 style={{ fontSize: '1.2rem', fontWeight: 'bold', margin: '10px 0 6px 0' }} {...props} /> <h2 style={{ fontSize: '1.2rem', fontWeight: 'bold', margin: '10px 0 6px 0' }} {...props} />
), ),
h3: (props: any) => ( h3: (props: React.ComponentProps<'h3'>) => (
<h3 style={{ fontSize: '1.1rem', fontWeight: 'bold', margin: '8px 0 4px 0' }} {...props} /> <h3 style={{ fontSize: '1.1rem', fontWeight: 'bold', margin: '8px 0 4px 0' }} {...props} />
), ),
// 自定义列表样式 // 自定义列表样式
ul: (props: any) => ( ul: (props: React.ComponentProps<'ul'>) => (
<ul style={{ paddingLeft: '20px', margin: '6px 0' }} {...props} /> <ul style={{ paddingLeft: '20px', margin: '6px 0' }} {...props} />
), ),
ol: (props: any) => ( ol: (props: React.ComponentProps<'ol'>) => (
<ol style={{ paddingLeft: '20px', margin: '6px 0' }} {...props} /> <ol style={{ paddingLeft: '20px', margin: '6px 0' }} {...props} />
), ),
li: (props: any) => ( li: (props: React.ComponentProps<'li'>) => (
<li style={{ margin: '4px 0' }} {...props} /> <li style={{ margin: '4px 0' }} {...props} />
), ),
// 自定义代码块样式 // 自定义代码块样式
// 简化代码块处理,移除对 node 对象内部属性的访问 code: (props: React.ComponentProps<'code'>) => (
code: (props: any) => (
<code style={{ backgroundColor: '#f5f5f5', padding: '2px 4px', borderRadius: '3px', fontFamily: 'monospace' }} {...props} /> <code style={{ backgroundColor: '#f5f5f5', padding: '2px 4px', borderRadius: '3px', fontFamily: 'monospace' }} {...props} />
), ),
pre: (props: any) => ( pre: (props: React.ComponentProps<'pre'>) => (
<pre style={{ backgroundColor: '#f5f5f5', padding: '12px', borderRadius: '6px', overflowX: 'auto', fontFamily: 'monospace', fontSize: '0.9rem' }} {...props} /> <pre style={{ backgroundColor: '#f5f5f5', padding: '12px', borderRadius: '6px', overflowX: 'auto', fontFamily: 'monospace', fontSize: '0.9rem' }} {...props} />
), ),
// 自定义引用样式 // 自定义引用样式
blockquote: (props: any) => ( blockquote: (props: React.ComponentProps<'blockquote'>) => (
<blockquote style={{ borderLeft: '4px solid #ccc', margin: '10px 0', paddingLeft: '12px', color: '#666' }} {...props} /> <blockquote style={{ borderLeft: '4px solid #ccc', margin: '10px 0', paddingLeft: '12px', color: '#666' }} {...props} />
), ),
// 自定义链接样式 // 自定义链接样式
a: (props: any) => ( a: (props: React.ComponentProps<'a'>) => (
<a style={{ color: theme.palette.primary.main, textDecoration: 'underline' }} {...props} /> <a style={{ color: theme.palette.primary.main, textDecoration: 'underline' }} {...props} />
) )
}} }}