继续处理会话区多语言

This commit is contained in:
xintaofei
2026-03-07 14:33:47 +08:00
parent 89c91ac1eb
commit 17a03ef95c
9 changed files with 248 additions and 69 deletions

View File

@@ -5,6 +5,7 @@ import type { ComponentProps } from "react"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
import { ArrowDownIcon, DownloadIcon } from "lucide-react"
import { useTranslations } from "next-intl"
import { useCallback } from "react"
import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom"
@@ -42,32 +43,37 @@ export type MessageThreadEmptyStateProps = ComponentProps<"div"> & {
export const MessageThreadEmptyState = ({
className,
title = "No messages yet",
description = "Start a conversation to see messages here",
title,
description,
icon,
children,
...props
}: MessageThreadEmptyStateProps) => (
<div
className={cn(
"flex size-full flex-col items-center justify-center gap-3 p-8 text-center",
className
)}
{...props}
>
{children ?? (
<>
{icon && <div className="text-muted-foreground">{icon}</div>}
<div className="space-y-1">
<h3 className="font-medium text-sm">{title}</h3>
{description && (
<p className="text-muted-foreground text-sm">{description}</p>
)}
</div>
</>
)}
</div>
)
}: MessageThreadEmptyStateProps) => {
const t = useTranslations("Folder.chat.messageThread")
return (
<div
className={cn(
"flex size-full flex-col items-center justify-center gap-3 p-8 text-center",
className
)}
{...props}
>
{children ?? (
<>
{icon && <div className="text-muted-foreground">{icon}</div>}
<div className="space-y-1">
<h3 className="font-medium text-sm">{title ?? t("emptyTitle")}</h3>
{(description ?? t("emptyDescription")) && (
<p className="text-muted-foreground text-sm">
{description ?? t("emptyDescription")}
</p>
)}
</div>
</>
)}
</div>
)
}
export type MessageThreadScrollButtonProps = ComponentProps<typeof Button>

View File

@@ -323,6 +323,7 @@ export const ToolOutput = ({
errorText,
...props
}: ToolOutputProps) => {
const t = useTranslations("Folder.chat.tool")
if (!(output || errorText)) {
return null
}
@@ -348,7 +349,7 @@ export const ToolOutput = ({
return (
<div className={cn("space-y-2", className)} {...props}>
<h4 className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
{errorText ? "Error" : "Result"}
{errorText ? t("error") : t("result")}
</h4>
<div
className={cn(