@@ -35,7 +35,7 @@ app.get('/', (_: Request, res: Response) => {
3535 res . send ( 'Hello, TypeScript Express!' ) ;
3636} ) ;
3737
38- // 定义所有请求体的 schema
38+ // Define schemas for all request bodies
3939const PaperScoreSummaryRequestSchema = z . object ( {
4040 latexSource : z . string ( ) ,
4141 paperScoreResult : PaperScoreResultSchema ,
@@ -76,23 +76,23 @@ app.post(
7676 asyncHandler ( async ( req : Request , res : Response ) => {
7777 const { latexSource, paperScoreResult } = PaperScoreSummaryRequestSchema . parse ( req . body ) ;
7878
79- // 获取 section candidates
79+ // Get section candidates
8080 const parsed = parseLatexDocument ( latexSource ) ;
8181 const sectionCandidates = parsed . sections . map ( ( section ) => section . title ) ;
8282
83- // 拼接 suggestions,生成 fullReview 的 summary(包含 importance level)
83+ // Join suggestions and generate summary for fullReview (including importance level)
8484 const fullReview = joinSuggestions ( paperScoreResult ) ;
8585 const summary = await paperScoreSummaryAgent . summary ( fullReview ) ;
8686
87- // 给 summary 里的每一个 weakness 匹配 section
87+ // Match each weakness in the summary to a section
8888 const promises = summary . weaknesses . map ( ( o ) => paperMatchWeaknessSectionsAgent . matchWeaknessSections ( o . weakness , sectionCandidates ) ) ;
8989 const results = await Promise . all ( promises ) ;
9090
91- // 返回结果
91+ // Return results
9292 const summaryWithSection = results
9393 . map ( ( result , index ) => {
94- // 因为 PaperScore 获得 section-level 的 weakness, anchorText 拿不到具体出现问题的句子
95- // 所以 anchorText 给 section 的第一句话就够了。
94+ // Since PaperScore gets section-level weaknesses, anchorText cannot get the specific problematic sentence
95+ // So using the first sentence of the section for anchorText is sufficient
9696 const matchedSection = parsed . sections . find ( ( section ) => section . title === result . section ) ;
9797 const content = ( matchedSection ?. content as string ) || '' ;
9898
@@ -109,14 +109,14 @@ app.post(
109109 . filter ( ( result ) => result . section !== 'unknown' )
110110 . filter ( ( result ) => result . anchorText !== '' ) ;
111111 const ret = {
112- results : summaryWithSection , // 为了符合 protobuf 的定义,一定要有一个 key
112+ results : summaryWithSection , // Must have a key to comply with protobuf definition
113113 } ;
114114 console . log ( ret ) ;
115115 res . send ( ret ) ;
116116 } ) ,
117117) ;
118118
119- // 解析论文,返回论文的标题,摘要,以及各个章节和内容
119+ // Parse paper and return title, abstract, and all sections with content
120120app . post (
121121 '/parse-paper' ,
122122 asyncHandler ( async ( req : Request , res : Response ) => {
0 commit comments