@@ -11,6 +11,7 @@ import {
1111import { useAgentStore , Message } from "../stores/agentStore" ;
1212import { agentApi } from "../lib/api" ;
1313import { DeepResearchProgress } from "./DeepResearchProgress" ;
14+ import { useTranslation } from "../i18n" ;
1415
1516// 静默状态 - 右侧垂直窄条
1617function CollapsedBar ( {
@@ -103,9 +104,11 @@ function CollapsedBar({
103104function DialogHeader ( {
104105 onMouseDown,
105106 onCollapse,
107+ t,
106108} : {
107109 onMouseDown : ( e : React . MouseEvent ) => void ;
108110 onCollapse : ( ) => void ;
111+ t : ReturnType < typeof useTranslation > [ "t" ] ;
109112} ) {
110113 return (
111114 < div
@@ -147,7 +150,7 @@ function DialogHeader({
147150 e . currentTarget . style . color = "var(--color-muted)" ;
148151 } }
149152 >
150- < span className = "text-sm" > 收起 </ span >
153+ < span className = "text-sm" > { t . common . collapse } </ span >
151154 < ChevronRight className = "w-4 h-4" />
152155 </ button >
153156 </ div >
@@ -158,9 +161,11 @@ function DialogHeader({
158161function ContextIndicator ( {
159162 target,
160163 onClear,
164+ t,
161165} : {
162166 target ?: { type : "concept" | "paper" ; id : string ; name : string } ;
163167 onClear : ( ) => void ;
168+ t : ReturnType < typeof useTranslation > [ "t" ] ;
164169} ) {
165170 if ( ! target ) return null ;
166171
@@ -189,7 +194,7 @@ function ContextIndicator({
189194 color : "var(--color-muted)" ,
190195 } }
191196 >
192- { target . type === "paper" ? "论文" : "概念" }
197+ { target . type === "paper" ? t . nav . papers : t . nav . concepts }
193198 </ span >
194199 </ div >
195200 < button
@@ -235,9 +240,11 @@ function MessageBubble({ msg, isUser }: { msg: Message; isUser: boolean }) {
235240function MessageList ( {
236241 messages,
237242 onResearchComplete,
243+ t,
238244} : {
239245 messages : Message [ ] ;
240246 onResearchComplete : ( sessionId : string , report : string ) => void ;
247+ t : ReturnType < typeof useTranslation > [ "t" ] ;
241248} ) {
242249 const listRef = useRef < HTMLDivElement > ( null ) ;
243250
@@ -259,13 +266,13 @@ function MessageList({
259266 className = "text-base font-medium"
260267 style = { { color : "var(--color-sepia)" } }
261268 >
262- 研究助手已就绪
269+ { t . researchAgent . ready }
263270 </ p >
264271 < div
265272 className = "flex flex-col gap-2 text-sm mt-5"
266273 style = { { color : "var(--color-muted)" } }
267274 >
268- { [ "分析论文引用关系" , "发现概念研究点" , "深入研究主题" ] . map (
275+ { [ t . researchAgent . analyzeCitations , t . researchAgent . discoverConcepts , t . researchAgent . deepDive ] . map (
269276 ( item , i ) => (
270277 < div
271278 key = { i }
@@ -304,9 +311,11 @@ function MessageList({
304311function ChatInput ( {
305312 onSend,
306313 isLoading,
314+ t,
307315} : {
308316 onSend : ( message : string ) => void ;
309317 isLoading : boolean ;
318+ t : ReturnType < typeof useTranslation > [ "t" ] ;
310319} ) {
311320 const [ input , setInput ] = useState ( "" ) ;
312321
@@ -332,7 +341,7 @@ function ChatInput({
332341 type = "text"
333342 value = { input }
334343 onChange = { ( e ) => setInput ( e . target . value ) }
335- placeholder = "输入研究问题..."
344+ placeholder = { t . researchAgent . placeholder }
336345 style = { {
337346 flex : 1 ,
338347 padding : "0.75rem 1rem" ,
@@ -365,6 +374,7 @@ function ChatInput({
365374// 主组件
366375export default function ResearchAgentBubble ( ) {
367376 const location = useLocation ( ) ;
377+ const { t } = useTranslation ( ) ;
368378
369379 // 在 Chat 页面和 Concepts 页面不显示这个浮框
370380 if ( location . pathname === "/chat" || location . pathname === "/concepts" ) {
@@ -470,7 +480,7 @@ export default function ResearchAgentBubble() {
470480 } catch {
471481 addMessage ( {
472482 role : "assistant" ,
473- content : "处理请求时遇到问题,请重试。" ,
483+ content : t . researchAgent . errorMsg ,
474484 } ) ;
475485 } finally {
476486 setLoading ( false ) ;
@@ -536,16 +546,19 @@ export default function ResearchAgentBubble() {
536546 < DialogHeader
537547 onMouseDown = { handleMouseDown }
538548 onCollapse = { ( ) => setIsExpanded ( false ) }
549+ t = { t }
539550 />
540551 < ContextIndicator
541552 target = { contextSummary . currentTarget }
542553 onClear = { handleClearContext }
554+ t = { t }
543555 />
544556 < MessageList
545557 messages = { messages }
546558 onResearchComplete = { handleResearchComplete }
559+ t = { t }
547560 />
548- < ChatInput onSend = { handleSend } isLoading = { isLoading } />
561+ < ChatInput onSend = { handleSend } isLoading = { isLoading } t = { t } />
549562 </ div >
550563 ) ;
551564}
0 commit comments