qwe
Some checks failed
Docker Build and Deploy / build-and-push (push) Has been cancelled
Docker Build and Deploy / deploy-hk (push) Has been cancelled

This commit is contained in:
zch1234qq
2025-10-21 09:17:52 +08:00
parent ecc8347146
commit 4afe6529fb
7 changed files with 1529 additions and 32 deletions

View File

@ -2,11 +2,11 @@ import React from 'react';
interface ChatMessageProps {
content: string;
sender: 'user' | 'bot';
role: 'user' | 'assistant';
timestamp: Date;
}
export const ChatMessage: React.FC<ChatMessageProps> = ({ content, sender, timestamp }) => {
export const ChatMessage: React.FC<ChatMessageProps> = ({ content, role, timestamp }) => {
// 格式化时间戳
const formattedTime = timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
@ -14,14 +14,14 @@ export const ChatMessage: React.FC<ChatMessageProps> = ({ content, sender, times
const messageParts = content.split('\n');
return (
<div className={`flex items-end mb-4 ${sender === 'user' ? 'justify-end' : 'justify-start'}`}>
{sender === 'bot' && (
<div className={`flex items-end mb-4 ${role === 'user' ? 'justify-end' : 'justify-start'}`}>
{role === 'assistant' && (
<div className="user-avatar mr-2">
<span>AI</span>
</div>
)}
<div className={`p-3 rounded-lg ${sender === 'user' ? 'message-user' : 'message-bot'}`}>
<div className={`p-3 rounded-lg ${role === 'user' ? 'message-user' : 'message-bot'}`}>
{messageParts.map((part, index) => (
<React.Fragment key={index}>
{part}
@ -30,7 +30,7 @@ export const ChatMessage: React.FC<ChatMessageProps> = ({ content, sender, times
))}
</div>
{sender === 'user' && (
{role === 'user' && (
<div className="user-avatar ml-2">
<span></span>
</div>