"use client"; import { IconButton } from "./button"; import styles from "./home.module.css"; import SettingsIcon from "../icons/settings.svg"; import GithubIcon from "../icons/github.svg"; import ChatGptIcon from "../icons/chatgpt.svg"; import SendWhiteIcon from "../icons/send-white.svg"; import BrainIcon from "../icons/brain.svg"; import ExportIcon from "../icons/export.svg"; import BotIcon from "../icons/bot.svg"; import UserIcon from "../icons/user.svg"; import AddIcon from "../icons/add.svg"; export function ChatItem(props: { onClick?: () => void; title: string; count: number; time: string; selected: boolean; }) { return (
{props.title}
{props.count} 条对话
{props.time}
); } export function ChatList() { const listData = new Array(5).fill({ title: "这是一个标题", count: 10, time: new Date().toLocaleString(), }); const selectedIndex = 0; return (
{listData.map((item, i) => ( ))}
); } export function Chat() { const messages = [ { role: "user", content: "这是一条消息", date: new Date().toLocaleString(), }, { role: "bot", content: "这是一条回复".repeat(10), date: new Date().toLocaleString(), }, ]; const title = "这是一个标题"; const count = 10; return (
{title}
与 ChatGPT 的 {count} 条对话
} bordered />
} bordered />
{messages.map((message, i) => { const isUser = message.role === "user"; return (
{message.role === "user" ? : }
{message.content}
{!isUser && (
{message.date}
)}
); })}