feat: 对话语言国际化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { memo, useEffect, useRef } from 'react';
|
||||
import type { ChatMessageItem } from './types';
|
||||
import { useI18n } from '../../i18n';
|
||||
|
||||
type ChatMessageListProps = {
|
||||
messages: ChatMessageItem[];
|
||||
@@ -8,6 +9,7 @@ type ChatMessageListProps = {
|
||||
|
||||
function ChatMessageList({ messages, loading }: ChatMessageListProps) {
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
const { t } = useI18n();
|
||||
|
||||
useEffect(() => {
|
||||
const container = containerRef.current;
|
||||
@@ -20,12 +22,12 @@ function ChatMessageList({ messages, loading }: ChatMessageListProps) {
|
||||
<div ref={containerRef} className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pr-1">
|
||||
{loading ? (
|
||||
<div className="rounded-[18px] border border-dashed border-[#BEDBFF] bg-[#EFF6FF] px-4 py-3 text-sm text-[#525866] dark:border-[#2a2a2d] dark:bg-[#1f1f22] dark:text-gray-400">
|
||||
正在加载会话内容...
|
||||
{t('conversation.messageList.loading')}
|
||||
</div>
|
||||
) : null}
|
||||
{!loading && messages.length === 0 ? (
|
||||
<div className="rounded-[18px] border border-dashed border-[#BEDBFF] bg-[#EFF6FF] px-4 py-6 text-sm leading-7 text-[#525866] dark:border-[#2a2a2d] dark:bg-[#1f1f22] dark:text-gray-400">
|
||||
输入你的问题开始一段新对话,现有会话和流式响应都会直接显示在这里。
|
||||
{t('conversation.messageList.emptyHint')}
|
||||
</div>
|
||||
) : null}
|
||||
{messages.map((message) => (
|
||||
@@ -81,7 +83,7 @@ function ChatMessageList({ messages, loading }: ChatMessageListProps) {
|
||||
</div>
|
||||
) : null}
|
||||
{message.isStreaming ? (
|
||||
<div className="mt-3 text-xs text-[#2B7FFF]">正在生成回复...</div>
|
||||
<div className="mt-3 text-xs text-[#2B7FFF]">{t('conversation.messageList.streaming')}</div>
|
||||
) : null}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user