Files
potaserandClaude Opus 5 509f5ff11b feat(i18n): 后端共享 i18n 翻译模块
供后端所有模块使用的翻译函数与字典(t / I18N_MAP)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 20:25:58 +08:00

754 lines
102 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# gfa_core/i18n.py — 后端共享 i18n 模块
"""
共享翻译函数和字典,供后端所有模块使用。
Usage:
from gfa_core.i18n import t, I18N_MAP
msg = t("session-created", lang) # 简单查找
msg = t("stage-missing-pep", lang, stage=stage, sp=sp) # 参数替换
"""
from __future__ import annotations
# ── 翻译字典 ──────────────────────────────────────────
# 格式:{ "key": {"zh": "中文文本", "en": "English text"} }
# 新增条目按命名规范添加(见文件末尾规范注释)
I18N_MAP: dict[str, dict[str, str]] = {
# ── 通用 ──
"status-completed": {"zh": "✅ 所有分析阶段已完成!", "en": "✅ All analysis stages completed!"},
"status-auto-plan": {"zh": "📋 自动规划剩余分析阶段", "en": "📋 Auto-planned remaining analysis stages"},
"status-completed-label": {"zh": "**已完成**", "en": "**Completed**"},
"status-none": {"zh": "无", "en": "None"},
"status-pending": {"zh": "**待执行**", "en": "**Pending**"},
"status-stage-count": {"zh": "个阶段)", "en": "stage(s))"},
"confirm-execute-stages": {"zh": "请确认是否按顺序执行以上分析阶段?", "en": "Confirm to execute the above analysis stages in order?"},
# ── session / 会话 ──
"session-created": {"zh": "会话创建成功", "en": "Conversation created"},
"session-message-added": {"zh": "消息添加成功", "en": "Message added"},
"session-title-updated": {"zh": "标题更新成功", "en": "Title updated"},
"session-deleted": {"zh": "会话已删除", "en": "Conversation deleted"},
"session-archived": {"zh": "会话已归档", "en": "Conversation archived"},
"session-linked": {"zh": "已关联到分析任务", "en": "Linked to analysis task"},
"session-not-found": {"zh": "会话不存在", "en": "Conversation not found"},
"session-store-not-init": {"zh": "会话存储尚未初始化", "en": "Conversation store not initialized"},
"session-user-not-found": {"zh": "用户不存在", "en": "User not found"},
"session-invalid-pagination": {"zh": "无效的消息分页参数", "en": "Invalid message pagination"},
# ── 通用 HTTPException 模板 ──
"err-create-session": {"zh": "创建会话失败: {exc}", "en": "Failed to create conversation: {exc}"},
"err-add-message": {"zh": "添加消息失败: {exc}", "en": "Failed to add message: {exc}"},
"err-list-conversations": {"zh": "获取会话列表失败: {exc}", "en": "Failed to list conversations: {exc}"},
"err-get-messages": {"zh": "获取消息失败: {exc}", "en": "Failed to get messages: {exc}"},
"err-update-title": {"zh": "更新标题失败: {exc}", "en": "Failed to update title: {exc}"},
"err-delete-session": {"zh": "删除会话失败: {exc}", "en": "Failed to delete conversation: {exc}"},
"err-archive-session": {"zh": "归档会话失败: {exc}", "en": "Failed to archive conversation: {exc}"},
"err-link-job": {"zh": "关联任务失败: {exc}", "en": "Failed to link job: {exc}"},
# ── guidance 阶段指导(迁移自 orchestrator._MSG) ──
"guidance-motif": {"zh": "请提供基因家族蛋白序列文件(.fa/.fasta),用于MEME保守基序预测。",
"en": "Please provide gene family protein sequence file (.fa/.fasta) for MEME conserved motif prediction."},
"guidance-genome-prepare": {"zh": "请提供config.xlsx及基因组/GFF/CDS/PEP等原始文件,用于完整数据准备。",
"en": "Please provide config.xlsx and genome/GFF/CDS/PEP files for complete data preparation."},
"guidance-domain": {"zh": "请提供基因家族蛋白序列文件,用于Pfam/InterPro结构域注释。",
"en": "Please provide gene family protein sequence file for Pfam/InterPro domain annotation."},
"guidance-structure": {"zh": "请提供基因家族的GFF注释文件和基因组序列。",
"en": "Please provide gene family GFF annotation file and genome sequence."},
"guidance-promoter": {"zh": "请提供基因家族成员的启动子序列(上游2000bp)或全基因组序列+GFF。",
"en": "Please provide gene family promoter sequences (upstream 2000bp) or whole genome + GFF."},
"guidance-synteny": {"zh": "请提供物种基因组序列(.fasta)和GFF注释文件。",
"en": "Please provide species genome sequence (.fasta) and GFF annotation file."},
"guidance-interspecies-synteny": {"zh": "请提供多个物种的基因组序列和GFF注释文件,以及物种间的同源关系。",
"en": "Please provide genome sequences and GFF annotation files for multiple species, along with inter-species orthology."},
"guidance-karyotype": {"zh": "请提供染色体长度信息和基因位置信息。",
"en": "Please provide chromosome length and gene position information."},
"guidance-ppi": {"zh": "请提供拟南芥同源基因映射文件(ortholog_pairs.txt,格式:拟南芥ID\\t苦荞ID),用于STRING数据库互作预测。如未提供,请先运行同源基因识别分析。",
"en": "Please provide Arabidopsis ortholog mapping file (ortholog_pairs.txt, format: AtID\\tTargetID) for STRING interaction prediction. If unavailable, run ortholog identification first."},
"guidance-ortholog": {"zh": "请提供目标物种和参考物种(如拟南芥At)的蛋白序列文件,用于同源基因识别。",
"en": "Please provide target and reference species (e.g., Arabidopsis At) protein FASTA for ortholog identification."},
"guidance-kaks": {"zh": "请提供物种间同源基因对(ortholog pairs,格式:基因A\\t基因B)或共线性分析结果。",
"en": "Please provide inter-species ortholog pairs (format: GeneA\\tGeneB) or synteny analysis results."},
"guidance-expression": {"zh": "请提供RNA-seq表达矩阵(FPKM/TPM/Count)或原始测序数据。",
"en": "Please provide RNA-seq expression matrix (FPKM/TPM/Count) or raw sequencing data."},
"guidance-enrichment": {"zh": "请提供差异表达基因列表(DEGs)或目标基因集。",
"en": "Please provide differentially expressed gene list (DEGs) or target gene set."},
"guidance-pep": {"zh": "请提供基因家族蛋白序列文件,用于理化性质分析。",
"en": "Please provide gene family protein sequence file for physicochemical property analysis."},
"guidance-combo": {"zh": "请提供基因家族HMM文件和蛋白序列文件,将自动执行标准11阶段分析。",
"en": "Please provide gene family HMM file and protein FASTA; standard 11-stage analysis will be executed automatically."},
"guidance-rna-seq-qc": {"zh": "请提供RNA-seq原始测序数据(FASTQ格式)。",
"en": "Please provide RNA-seq raw sequencing data (FASTQ format)."},
"guidance-rna-seq-mapping": {"zh": "请提供质控后的clean reads(FASTQ格式)和参考基因组。",
"en": "Please provide QC-filtered clean reads (FASTQ format) and reference genome."},
"guidance-rna-seq-quantification": {"zh": "请提供比对后的BAM文件或参考基因组注释GFF。",
"en": "Please provide aligned BAM file or reference genome annotation GFF."},
"guidance-rnaseq-sample-qc": {"zh": "请提供featureCounts计数矩阵和样本分组表,用于VST、PCA、样本相关性和聚类。",
"en": "Please provide featureCounts count matrix and sample grouping table for VST, PCA, sample correlation and clustering."},
"guidance-trend": {"zh": "请提供多时相表达矩阵(如不同发育阶段/处理时间点)。",
"en": "Please provide multi-temporal expression matrix (e.g., different developmental stages/treatment time points)."},
"guidance-rnaseq-wgcna": {"zh": "请提供VST/log2表达矩阵或count矩阵和样本性状表,用于共表达网络构建。",
"en": "Please provide VST/log2 expression matrix or count matrix and sample trait table for co-expression network construction."},
"guidance-rnaseq-go-enrich": {"zh": "请提供差异表达结果和gene2go背景文件,或先执行背景注释。",
"en": "Please provide differential expression results and gene2go background file, or run background annotation first."},
"guidance-rnaseq-kegg-enrich": {"zh": "请提供差异表达结果和gene2ko背景文件,或先执行背景注释。",
"en": "Please provide differential expression results and gene2ko background file, or run background annotation first."},
"guidance-rnaseq-fgsea": {"zh": "请提供差异表达排序统计量和gene2ko/KEGG背景,用于fgsea排序富集。",
"en": "Please provide differential expression ranking statistics and gene2ko/KEGG background for fgsea ranked enrichment."},
"guidance-rnaseq-candidate-family": {"zh": "请提供差异表达结果和目标物种蛋白FASTA;若已有InterProScan TSV会优先复用。",
"en": "Please provide differential expression results and target species protein FASTA; existing InterProScan TSV will be reused if available."},
"guidance-wgcna": {"zh": "请提供表达矩阵(样本数≥6),用于共表达网络构建。",
"en": "Please provide expression matrix (samples ≥ 6) for co-expression network construction."},
# ── 意图识别 / 自然语言响应 ──
"intent-rnaseq-execute": {"zh": "我将帮您执行RNA-seq", "en": "I will help you execute RNA-seq"},
"intent-confirm-start": {"zh": "分析。请确认参数后开始。", "en": "analysis. Please confirm parameters to start."},
"intent-rnaseq-async": {"zh": "RNA-seq分析将通过前端异步执行。", "en": "RNA-seq analysis will be executed asynchronously via frontend."},
"intent-planning-v2-plan": {"zh": " 分析。PlanningAgentV2 已根据当前状态生成完整执行计划。", "en": " analysis. PlanningAgentV2 has generated a complete execution plan based on current state."},
"intent-will-execute": {"zh": "我将帮您执行", "en": "I will help you execute"},
"intent-analysis-suffix": {"zh": "分析。", "en": "analysis."},
"intent-rnaseq-async-generic":{"zh": "RNA-seq {stage} 分析将通过前端异步执行。", "en": "RNA-seq {stage} analysis will be executed asynchronously via frontend."},
"intent-upload-or-confirm": {"zh": "请上传进行", "en": "Please upload"},
"intent-required-files": {"zh": "分析所需的文件,或确认使用系统内置数据。", "en": " required files, or confirm to use built-in data."},
"intent-unknown": {"zh": "无法识别您的分析意图,请描述您想要执行的分析类型。", "en": "Unable to recognize your analysis intent. Please describe the type of analysis you want to perform."},
"replan-guidance": {"zh": "该建议基于本次分析结果和最佳实践,旨在降低假阳性并补充关键证据链。请确认是否按此计划重新执行?",
"en": "This recommendation is based on current analysis results and best practices, aiming to reduce false positives and strengthen the evidence chain. Confirm to re-execute per this plan?"},
# ── 文件操作 ──
"file-not-found-in-job": {"zh": "没有在当前 job 的安全目录中找到文件:{filename}", "en": "File not found in current job directory: {filename}"},
"file-read-failed": {"zh": "读取文件失败: {exc}", "en": "Failed to read file: {exc}"},
"file-path-not-exist": {"zh": "路径不存在: {path}", "en": "Path does not exist: {path}"},
"file-uploaded": {"zh": "✅ 已上传到 input/{job_id}/: {files}", "en": "✅ Uploaded to input/{job_id}/: {files}"},
"file-select-required": {"zh": "请选择文件", "en": "Please select a file"},
"file-no-preview": {"zh": "没有找到可预览的文件。", "en": "No previewable file found."},
"file-binary-no-preview": {"zh": "无法预览此文件(可能是二进制/图片/PDF)", "en": "Cannot preview this file (binary/image/PDF)"},
"file-large-truncated": {"zh": "\n\n... (文件较大,仅显示部分)", "en": "\n\n... (file too large, showing partial content)"},
"file-loaded-count": {"zh": "已加载 {count} 个文件", "en": "Loaded {count} file(s)"},
"file-load-failed": {"zh": "加载失败: {exc}", "en": "Load failed: {exc}"},
"file-load-error-item": {"zh": "{path}: {exc}", "en": "{path}: {exc}"},
# ── 阶段名称(stage-name-{id},统一入口) ──
"stage-name-wgs_qc": {"zh": "WGS质控", "en": "WGS QC"},
"stage-name-wgs_index": {"zh": "WGS参考索引", "en": "WGS Reference Index"},
"stage-name-wgs_align": {"zh": "WGS序列比对", "en": "WGS Alignment"},
"stage-name-wgs_markdup": {"zh": "WGS去重复", "en": "WGS Mark Duplicates"},
"stage-name-wgs_bam_qc": {"zh": "WGS BAM质控", "en": "WGS BAM QC"},
"stage-name-wgs_haplotype_calling": {"zh": "WGS单样本变异检测", "en": "WGS Haplotype Calling"},
"stage-name-wgs_gvcf_combine": {"zh": "WGS GVCF合并", "en": "WGS GVCF Combine"},
"stage-name-wgs_joint_genotyping": {"zh": "WGS联合分型", "en": "WGS Joint Genotyping"},
"stage-name-wgs_variant_select": {"zh": "WGS变异类型选择", "en": "WGS Variant Select"},
"stage-name-wgs_variant_filter": {"zh": "WGS变异硬过滤", "en": "WGS Variant Hard Filter"},
"stage-name-wgs_impute": {"zh": "WGS基因型填充", "en": "WGS Imputation"},
"stage-name-wgs_maf_missing_filter": {"zh": "WGS MAF与缺失率过滤", "en": "WGS MAF & Missingness Filter"},
"stage-name-pop_pca": {"zh": "群体PCA分析", "en": "Population PCA"},
"stage-name-pop_phylogeny": {"zh": "群体系统树分析", "en": "Population Phylogeny"},
"stage-name-pop_structure": {"zh": "群体结构分析", "en": "Population Structure"},
"stage-name-pop_ld_decay": {"zh": "群体LD衰减分析", "en": "Population LD Decay"},
"stage-name-pop_snp_density": {"zh": "SNP密度分析", "en": "SNP Density"},
"stage-name-gwas_fmt": {"zh": "GWAS VCF排序与HapMap转换", "en": "GWAS VCF Sort & HapMap Convert"},
"stage-name-gwas_kinship": {"zh": "GWAS TASSEL亲缘关系矩阵", "en": "GWAS TASSEL Kinship Matrix"},
"stage-name-gwas_trait": {"zh": "GWAS表型数据准备", "en": "GWAS Trait Data Preparation"},
"stage-name-gwas_cov": {"zh": "GWAS群体结构协变量准备", "en": "GWAS Population Covariate Preparation"},
"stage-name-gwas_mlm": {"zh": "GWAS TASSEL MLM/CMLM", "en": "GWAS TASSEL MLM/CMLM"},
"stage-name-gwas_plot": {"zh": "GWAS MLM结果绘图", "en": "GWAS MLM Result Plot"},
"stage-name-gwas_emmax": {"zh": "GWAS EMMAX关联分析", "en": "GWAS EMMAX Association"},
"stage-name-gwas_emplot": {"zh": "GWAS EMMAX结果绘图", "en": "GWAS EMMAX Result Plot"},
"stage-name-gwas_glm": {"zh": "GWAS TASSEL GLM", "en": "GWAS TASSEL GLM"},
"stage-name-identify": {"zh": "基因家族鉴定", "en": "Gene Family Identification"},
"stage-name-identify_refine": {"zh": "修订鉴定成员", "en": "Refine Identify Members"},
"stage-name-subfamily_confirm": {"zh": "确认亚家族分类", "en": "Confirm Subfamily Classification"},
"stage-name-phylogeny": {"zh": "系统发育分析", "en": "Phylogenetic Analysis"},
"stage-name-reference_classification": {"zh": "参考亚家族分类", "en": "Reference Subfamily Classification"},
"stage-name-motif": {"zh": "Motif分析", "en": "Motif Analysis"},
"stage-name-domain": {"zh": "结构域分析", "en": "Domain Analysis"},
"stage-name-structure": {"zh": "基因结构分析", "en": "Gene Structure Analysis"},
"stage-name-promoter": {"zh": "启动子分析", "en": "Promoter Analysis"},
"stage-name-tfbs": {"zh": "TF结合位点预测", "en": "TF Binding Site Prediction"},
"stage-name-synteny": {"zh": "种内共线性分析", "en": "Intra-species Synteny"},
"stage-name-karyotype": {"zh": "核型分析", "en": "Karyotype Analysis"},
"stage-name-interspecies_synteny": {"zh": "物种间共线性", "en": "Inter-species Synteny"},
"stage-name-expression": {"zh": "表达分析", "en": "Expression Analysis"},
"stage-name-kaks": {"zh": "Ka/Ks分析", "en": "Ka/Ks Analysis"},
"stage-name-ppi": {"zh": "PPI分析", "en": "PPI Analysis"},
"stage-name-pep": {"zh": "蛋白特征分析", "en": "Protein Feature Analysis"},
"stage-name-ortholog": {"zh": "直系同源基因鉴定", "en": "Ortholog Identification"},
"stage-name-msa": {"zh": "多序列比对", "en": "Multiple Sequence Alignment"},
"stage-name-enrichment": {"zh": "富集分析", "en": "Enrichment Analysis"},
"stage-name-combo": {"zh": "组合图", "en": "Combination Plot"},
"stage-name-gene_family_report": {"zh": "基因家族结果报告", "en": "Gene Family Report"},
"stage-name-genome_prepare": {"zh": "基因组准备", "en": "Genome Preparation"},
"stage-name-ncbi_fetch_sequences": {"zh": "NCBI序列下载", "en": "NCBI Sequence Download"},
"stage-name-sequence_extract_by_id": {"zh": "按ID提取序列", "en": "Extract Sequences by ID"},
"stage-name-msa_region_plot": {"zh": "MSA区间绘图", "en": "MSA Region Plot"},
"stage-name-synteny_plot_revise": {"zh": "种内共线性Circos重绘", "en": "Intra-species Synteny Circos Revise"},
"stage-name-promoter_plot_revise": {"zh": "启动子自定义绘图", "en": "Promoter Custom Plot"},
"stage-name-prepare_organize": {"zh": "数据文件整理", "en": "Organize Data Files"},
"stage-name-prepare_normalize_gff": {"zh": "GFF ID规范化", "en": "GFF ID Normalization"},
"stage-name-prepare_longest_transcript": {"zh": "提取最长转录本", "en": "Extract Longest Transcript"},
"stage-name-prepare_extract_pep": {"zh": "从GFF提取PEP", "en": "Extract PEP from GFF"},
"stage-name-prepare_extract_cds": {"zh": "从GFF提取CDS", "en": "Extract CDS from GFF"},
"stage-name-prepare_filter_fasta": {"zh": "按ID提取FASTA", "en": "Extract FASTA by ID"},
"stage-name-prepare_simplify_ncbi": {"zh": "NCBI ID简化", "en": "Simplify NCBI IDs"},
"stage-name-rnaseq_qc": {"zh": "RNA-seq质控", "en": "RNA-seq QC"},
"stage-name-rnaseq_align": {"zh": "RNA-seq比对", "en": "RNA-seq Alignment"},
"stage-name-rnaseq_quant": {"zh": "RNA-seq定量", "en": "RNA-seq Quantification"},
"stage-name-rnaseq_sample_qc": {"zh": "RNA-seq样本质量评估", "en": "RNA-seq Sample QC"},
"stage-name-rnaseq_de": {"zh": "差异表达分析(自动生成FPKM表达图)", "en": "Differential Expression (auto FPKM plot)"},
"stage-name-rnaseq_wgcna": {"zh": "RNA-seq WGCNA分析", "en": "RNA-seq WGCNA Analysis"},
"stage-name-annotation": {"zh": "背景注释", "en": "Background Annotation"},
"stage-name-annotation_go": {"zh": "GO背景自动注释", "en": "GO Background Auto-Annotation"},
"stage-name-annotation_kegg": {"zh": "KEGG/KO背景自动注释", "en": "KEGG/KO Background Auto-Annotation"},
"stage-name-rnaseq_go_enrich": {"zh": "RNA-seq GO富集分析", "en": "RNA-seq GO Enrichment"},
"stage-name-rnaseq_kegg_enrich": {"zh": "RNA-seq KEGG富集分析", "en": "RNA-seq KEGG Enrichment"},
"stage-name-rnaseq_enrich": {"zh": "RNA-seq富集分析", "en": "RNA-seq Enrichment"},
"stage-name-rnaseq_fgsea": {"zh": "RNA-seq fgsea分析", "en": "RNA-seq fgsea Analysis"},
"stage-name-rnaseq_candidate_family": {"zh": "RNA-seq候选家族筛选", "en": "RNA-seq Candidate Family Screening"},
# ── 任务状态 ──
"task-waiting-resource": {"zh": "等待资源可用", "en": "Waiting for resources"},
"task-waiting-dots": {"zh": "等待资源可用...", "en": "Waiting for resources..."},
"task-executing-stage": {"zh": "正在执行 {stage}...", "en": "Executing {stage}..."},
"task-submitted-celery": {"zh": "任务已提交到 Celery,等待 worker 获取资源", "en": "Task submitted to Celery, waiting for worker"},
"task-queued": {"zh": "任务已进入资源调度队列", "en": "Task entered resource scheduling queue"},
"task-submitted": {"zh": "任务已提交,等待 Celery worker 接收", "en": "Task submitted, waiting for Celery worker"},
"task-running": {"zh": "任务运行中", "en": "Task running"},
"task-completed": {"zh": "任务完成", "en": "Task completed"},
"task-failed": {"zh": "任务失败", "en": "Task failed"},
"task-not-found": {"zh": "任务不存在", "en": "Task not found"},
"task-ended-cannot-cancel": {"zh": "任务已结束,无法取消", "en": "Task ended, cannot cancel"},
"task-cancelled": {"zh": "任务已取消", "en": "Task cancelled"},
"task-marked-cancel": {"zh": "任务已标记为取消", "en": "Task marked for cancellation"},
"task-submitting-to-plantcare": {"zh": "正在提交序列到 PlantCARE...", "en": "Submitting sequences to PlantCARE..."},
"task-running-mcscanx": {"zh": "正在进行共线性分析(MCScanX)...", "en": "Running synteny analysis (MCScanX)..."},
"task-running-fastp": {"zh": "正在进行RNA-seq质控分析(fastp)... 这可能需要15-30分钟,请耐心等待...", "en": "Running RNA-seq QC (fastp)... this may take 15-30 minutes, please wait..."},
"task-submitted-plantcare": {"zh": "已提交 PlantCARE,等待邮件结果(可能需要10-60分钟)...", "en": "Submitted to PlantCARE, waiting for email results (may take 10-60 min)..."},
"task-waiting-plantcare-email": {"zh": "已提交 PlantCARE,正在等待邮件...", "en": "Submitted to PlantCARE, waiting for email..."},
# ── 执行状态/阶段消息 ──
"exec-stage-failed": {"zh": "{stage} 执行失败", "en": "{stage} execution failed"},
"exec-stage-timeout": {"zh": "{stage} 等待超时,最后状态: {last_status}", "en": "{stage} timed out, last status: {last_status}"},
"exec-stage-submit-failed": {"zh": "{stage} 提交失败", "en": "{stage} submission failed"},
"exec-ok-tree-revised": {"zh": "✅ 进化树图修订完成。", "en": "✅ Tree plot revision completed."},
"exec-ok-synteny-circos": {"zh": "✅ 种内共线性 Circos 图修订完成。", "en": "✅ Synteny Circos plot revision completed."},
"exec-ok-promoter-plot": {"zh": "✅ 启动子自定义绘图完成。", "en": "✅ Promoter custom plot completed."},
"exec-ok-msa-region-plot": {"zh": "✅ MSA区间绘图完成。", "en": "✅ MSA region plot completed."},
"exec-err-no-valid-output": {"zh": "❌ {stage} 未生成有效输出", "en": "❌ {stage} did not generate valid output"},
"exec-ok-auto-annotation": {"zh": "✅ 自动背景注释已完成", "en": "✅ Auto background annotation completed"},
# ── execution context / preflight ──
"preflight-missing-subfamily": {"zh": "执行前上下文检查失败:缺少确认或上传的亚家族标签", "en": "Pre-execution context check failed: missing confirmed or uploaded subfamily labels"},
"preflight-semantic-failed": {"zh": "执行前语义预检失败", "en": "Pre-execution semantic preflight failed"},
# ── 清理 ──
"cleanup-no-old-dirs": {"zh": "✅ 清理完成:未发现超过 {days} 天的任务目录", "en": "✅ Cleanup done: no directories older than {days} days found"},
"cleanup-deleted": {"zh": "✅ 清理完成,已删除:\n", "en": "✅ Cleanup done, deleted:\n"},
# ── 亚家族 ──
"subfamily-label-mismatch": {"zh": "{filename} 未覆盖当前 {species}/{family} 目标成员集合。", "en": "{filename} does not cover the current {species}/{family} target member set."},
"subfamily-reconfirm": {"zh": "请重新确认亚家族标签,或检查当前成员集合是否已更新。", "en": "Please re-confirm subfamily labels, or check if the current member set has been updated."},
"subfamily-missing-ref": {"zh": "缺少参考物种 {species}.{family}.subfamily。", "en": "Missing reference species {species}.{family}.subfamily."},
"subfamily-upload-ref": {"zh": "请上传 {species}.{family}.subfamily 作为参考亚家族标签。", "en": "Please upload {species}.{family}.subfamily as reference subfamily labels."},
"subfamily-no-identify": {"zh": "{species}/{family} 尚未完成基因家族成员鉴定,不能进行亚家族确认或传统基因家族分析。", "en": "{species}/{family} has not completed gene family member identification; subfamily confirmation or traditional gene family analysis cannot proceed."},
"subfamily-run-identify": {"zh": "请先执行 identify。", "en": "Please run identify first."},
"subfamily-predicted-unconfirmed": {"zh": "检测到 {species}/{family} 已有亚家族分类预测文件,但还没有保存确认标签。", "en": "Subfamily classification prediction file exists for {species}/{family}, but confirmed labels have not been saved."},
"subfamily-open-confirm": {"zh": "请先打开亚家族确认表并保存。", "en": "Please open the subfamily confirmation table and save it."},
"subfamily-not-classified": {"zh": "{species}/{family} 尚未进行目标物种+参考物种的亚家族分类。", "en": "{species}/{family} has not undergone target+reference species subfamily classification."},
"subfamily-run-classification": {"zh": "请先执行亚家族分类并确认标签,或上传目标物种亚家族文件。", "en": "Please run subfamily classification and confirm labels, or upload target species subfamily file."},
# ── planning_v2 ──
"planning-pop-vcf-needed": {"zh": "{stage_id} 需要在执行确认弹窗中选择群体 VCF", "en": "{stage_id} requires selecting a population VCF in the confirmation dialog"},
"planning-pop-vcf-confirm": {"zh": "请确认群体VCF绝对路径;执行时会重新校验文件和科学身份。", "en": "Please confirm the absolute path of the population VCF; it will be re-validated during execution."},
"planning-gwas-fmt-vcf-needed": {"zh": "gwas_fmt 需要在执行确认弹窗中选择外部 VCF", "en": "gwas_fmt requires selecting an external VCF in the confirmation dialog"},
"planning-gwas-fmt-vcf-confirm": {"zh": "请在执行确认弹窗填写外部 VCF 的绝对路径;提交执行时仍会严格校验文件及 VCF 内容。", "en": "Please provide the absolute path of the external VCF in the confirmation dialog; strict validation will be enforced upon submission."},
"planning-preflight-failed": {"zh": "❌ 预检验证失败: {error_msg}", "en": "❌ Preflight validation failed: {error_msg}"},
"planning-preflight-passed": {"zh": "✅ 预检验证通过", "en": "✅ Preflight validation passed"},
"planning-preflight-warnings": {"zh": " ({count}个警告)", "en": " ({count} warning(s))"},
"planning-preflight-plan-summary": {"zh": " | 已生成执行计划: {stages}个阶段, 预估{time}分钟", "en": " | Execution plan generated: {stages} stage(s), estimated {time} minutes"},
"planning-preflight-learning": {"zh": " | 已应用{count}个阶段的学习推荐参数", "en": " | Applied learning recommendations for {count} stage(s)"},
"planning-single-wgs-manifest": {"zh": "确认该任务只有一套完整的 WGS 上游 Manifest", "en": "Confirm that this job has only one complete set of WGS upstream manifests"},
"planning-context-index-failed": {"zh": "项目上下文索引构建失败: {exc}", "en": "Project context index build failed: {exc}"},
"planning-context-index-fallback": {"zh": "将退回旧版文件检查逻辑;如重复误报缺输入,请检查 job 目录结构和 manifest", "en": "Falling back to legacy file check; if false positives persist, check job directory structure and manifests"},
"planning-stage-not-executable": {"zh": "阶段 {stage_id} 暂未接入标准执行器", "en": "Stage {stage_id} is not yet registered with a standard executor"},
"planning-stage-not-executable-sugg": {"zh": "请选择已接入执行器的分析阶段,或先为该阶段补充 pipeline_backend.run_stage 分支和标准 manifest", "en": "Please select a supported analysis stage, or add a pipeline_backend.run_stage branch and standard manifest for this stage first"},
"planning-stage-completed": {"zh": "阶段 {stage_id} 已完成", "en": "Stage {stage_id} completed"},
"planning-stage-skip": {"zh": "该阶段已完成,可跳过执行", "en": "Stage already completed; execution can be skipped"},
"planning-dep-incomplete": {"zh": "依赖阶段 {dep} 未完成 (状态: {status})", "en": "Dependency {dep} incomplete (status: {status})"},
"planning-dep-auto-add": {"zh": "将自动添加 {dep} 阶段到执行计划", "en": "Will auto-add {dep} to execution plan"},
"planning-input-gwas-fmt-resolved": {"zh": "gwas_fmt 输入 external_vcf 已解析", "en": "gwas_fmt input external_vcf resolved"},
"planning-input-resolved": {"zh": "{stage_id} 输入 {role} 已解析", "en": "{stage_id} input {role} resolved"},
"planning-input-upstream": {"zh": "{stage_id} 所需输入 {role} ({kind}) 将由上游阶段 {producer} 生成", "en": "{stage_id} input {role} ({kind}) will be generated by upstream stage {producer}"},
"planning-input-upstream-sugg": {"zh": "规划器会先执行 {producer},再执行 {stage_id}。", "en": "Planner will run {producer} before {stage_id}."},
"planning-input-missing": {"zh": "缺少 {stage_id} 所需输入: {role} ({kind})", "en": "Missing required input for {stage_id}: {role} ({kind})"},
"planning-input-missing-type": {"zh": "缺少 {type} 类型输入文件", "en": "Missing {type} type input file"},
"planning-input-multi-target-spp": {"zh": "{stage_id} 检测到多个可用目标物种蛋白,需要确认目标物种", "en": "{stage_id} detected multiple available target species proteins; target species must be confirmed"},
"planning-input-multi-target-sugg": {"zh": "请在执行确认弹窗中选择 target species;系统不应在 Multi prefix 下静默任选一个物种。", "en": "Please select target species in confirmation dialog; the system should not silently pick one under a multi-species prefix."},
"planning-wgs-run-upstream": {"zh": "先执行上游 WGS 阶段,再重新绑定其 Manifest", "en": "Run upstream WGS stages first, then re-bind their manifests"},
"planning-wgs-fix-manifest": {"zh": "修复 wgs_qc 或 wgs_index 权威 Manifest 后重试", "en": "Fix wgs_qc or wgs_index authoritative manifests and retry"},
"planning-wgs-align-resolved": {"zh": "wgs_align 输入已从权威 Manifest 解析", "en": "wgs_align inputs resolved from authoritative manifests"},
"planning-low-cpu": {"zh": "CPU 核数较少: {count}", "en": "Low CPU core count: {count}"},
"planning-low-cpu-sugg": {"zh": "建议至少 4 核 CPU", "en": "Recommend at least 4 CPU cores"},
"planning-low-disk": {"zh": "磁盘空间不足: {gb:.1f} GB", "en": "Insufficient disk space: {gb:.1f} GB"},
"planning-low-disk-sugg": {"zh": "建议至少 10 GB 磁盘空间", "en": "Recommend at least 10 GB disk space"},
"planning-learning-recommend": {"zh": "基于 {count} 次成功执行推荐", "en": "Recommendations based on {count} successful executions"},
"planning-learning-insufficient": {"zh": "历史数据不足,使用默认参数", "en": "Insufficient historical data; using default parameters"},
"planning-desc-tool": {"zh": "执行工具型任务:", "en": "Execute utility tasks: "},
"planning-desc-repair": {"zh": "执行受控修复任务:{stages}", "en": "Execute controlled repair: {stages}"},
"planning-desc-rnaseq": {"zh": "执行RNA-seq的{stages}分析", "en": "Execute RNA-seq {stages} analysis"},
"planning-desc-rnaseq-de": {"zh": ";差异分析成功后会自动触发 Expression(使用FPKM) 绘图", "en": "; upon successful DE, Expression (FPKM-based) plotting will be auto-triggered"},
"planning-desc-gene-family": {"zh": "执行{gene_family}基因家族的{stages}分析", "en": "Execute {gene_family} gene family {stages} analysis"},
"planning-desc-unsupported": {"zh": "以下阶段暂未接入标准执行器: {stages}", "en": "These stages are not yet registered with standard executors: {stages}"},
"planning-desc-all-done": {"zh": "所有阶段已完成", "en": "All stages completed"},
"planning-input-target-proteome": {"zh": "请在 config.xlsx 中配置目标物种 pep,或上传目标物种蛋白 FASTA;若只有 genome+gff,请先执行数据准备。", "en": "Configure target species pep in config.xlsx, or upload target species protein FASTA; if only genome+gff is available, run data preparation first."},
"planning-input-family-members-pep": {"zh": "请先完成 identify,或确认 final/{prefix}.final_members.pep.fa / scoped phylogeny 输入存在。", "en": "Complete identify first, or confirm final/{prefix}.final_members.pep.fa / scoped phylogeny input exists."},
"planning-input-family-members-id": {"zh": "请先完成 identify,或提供 final_members.id。", "en": "Complete identify first, or provide final_members.id."},
"planning-input-target-gff": {"zh": "请在 config.xlsx 中配置目标物种 GFF/GFF3,或先执行数据准备生成 {Species}_final.gff3。", "en": "Configure target species GFF/GFF3 in config.xlsx, or run data preparation to generate {Species}_final.gff3."},
"planning-input-target-genome": {"zh": "请在 config.xlsx 中配置目标物种 genome FASTA,或先执行数据准备生成 {Species}.genome.fasta。", "en": "Configure target species genome FASTA in config.xlsx, or run data preparation to generate {Species}.genome.fasta."},
"planning-input-tf-motif-db": {"zh": "请确认项目 data/tfbs/jaspar2026/combined/JASPAR2026_CORE_plants_non-redundant.meme 存在,或配置 PlantTFDB/JASPAR MEME 资源。", "en": "Confirm that data/tfbs/jaspar2026/combined/JASPAR2026_CORE_plants_non-redundant.meme exists, or configure PlantTFDB/JASPAR MEME resources."},
"planning-input-tree": {"zh": "请先完成 phylogeny,或提供 final/{prefix}.tree.nwk。", "en": "Complete phylogeny first, or provide final/{prefix}.tree.nwk."},
"planning-input-pfam-db": {"zh": "请确认项目 data/hmm/Pfam-A.hmm 及 hmmpress 索引存在。", "en": "Confirm that data/hmm/Pfam-A.hmm and hmmpress indexes exist."},
# ── diagnosis ──
"diag-gene2go-mismatch": {"zh": "当前 gene2go 背景与 DE 基因 ID 体系不一致。应提示用户确认本地自动注释,生成与当前蛋白/DE ID 匹配的 gene2go 后再做 GO 富集。", "en": "Current gene2go background does not match the DE gene ID system. Prompt the user to confirm local auto-annotation to generate gene2go matching current protein/DE IDs before GO enrichment."},
"diag-max-iterations": {"zh": "已达到最大迭代次数({max_iterations}),停止自动修复。", "en": "Maximum iterations ({max_iterations}) reached; stopping auto-repair."},
"diag-complete": {"zh": "🔍 诊断完成: {error_type}", "en": "🔍 Diagnosis complete: {error_type}"},
"diag-unknown-error": {"zh": "无法自动诊断,请检查错误日志", "en": "Unable to auto-diagnose; please check error logs"},
"diag-unknown-reason": {"zh": "未知错误不能自动修复,需要用户查看日志后确认下一步。", "en": "Unknown error cannot be auto-repaired; user needs to check logs and confirm next steps."},
"diag-genome-prepare-running": {"zh": "genome_prepare 当前仍在运行,拒绝执行 job-local 修复以避免覆盖正在生成的产物。", "en": "genome_prepare is still running; refusing job-local fix to avoid overwriting in-progress outputs."},
"diag-no-safe-fix": {"zh": "没有可安全副本修复的问题;需要用户手动处理或补充确认信息。", "en": "No issues can be safely fixed via copy; manual handling or additional confirmation is needed."},
"diag-fix-prepared": {"zh": "已准备当前 job 的修复副本;尚未执行。", "en": "Fix copy prepared for current job; not yet executed."},
"diag-stage-running-refuse": {"zh": "{job_id}/{stage} 当前仍在运行,拒绝执行修复副本以避免覆盖正在生成的产物。", "en": "{job_id}/{stage} is still running; refusing fix copy to avoid overwriting in-progress outputs."},
"diag-cannot-build-fix-cmd": {"zh": "无法构建修复副本执行命令", "en": "Unable to build fix copy execution command"},
"diag-fix-copy-success": {"zh": "修复副本执行完成", "en": "Fix copy execution completed"},
"diag-fix-copy-failed": {"zh": "修复副本执行失败", "en": "Fix copy execution failed"},
"diag-pep-not-found": {"zh": "未找到可清理的蛋白 FASTA:final/{prefix}.final_members.pep.fa", "en": "Cleanable protein FASTA not found: final/{prefix}.final_members.pep.fa"},
"diag-pep-stop-codon-removed": {"zh": "已生成去除 '*' stop marker 的 job-local 蛋白 FASTA。后续 phylogeny/motif/domain/pep 将优先使用该文件。", "en": "Generated job-local protein FASTA with '*' stop markers removed. Subsequent phylogeny/motif/domain/pep will preferentially use this file."},
"diag-gff-overlap-report": {"zh": "已生成 GFF/成员 ID 重叠诊断报告;该问题不能静默改 ID。", "en": "GFF/member ID overlap diagnostic report generated; this issue cannot be silently fixed by renaming IDs."},
"diag-pfam-import-failed": {"zh": "无法导入 identify Pfam fallback 工具: {exc}", "en": "Failed to import identify Pfam fallback tool: {exc}"},
"diag-pfam-infer-failed": {"zh": "未能从 issue/config/prefix 推断 Required_Pfams;请在 config.xlsx 的 Analysis.Required_Pfams 填写 PFxxxxx,或上传 HMM。", "en": "Could not infer Required_Pfams from issue/config/prefix; please fill in PFxxxxx in Analysis.Required_Pfams in config.xlsx, or upload an HMM."},
"diag-pfam-local-failed": {"zh": "本地 Pfam/HMM fallback 失败: {exc}", "en": "Local Pfam/HMM fallback failed: {exc}"},
"diag-pfam-hmm-generated": {"zh": "已基于 config/family/Pfam 本地资源生成 identify 可用的 job-local 查询 HMM。", "en": "Generated job-local query HMM usable for identify based on local config/family/Pfam resources."},
"diag-ref-prot-infer-failed": {"zh": "无法从文件名推断 Species/Family: {name}", "en": "Cannot infer Species/Family from filename: {name}"},
"diag-ref-prot-exists": {"zh": "标准家族参考蛋白已存在: {expected}", "en": "Standard family reference protein already exists: {expected}"},
"diag-ref-prot-created": {"zh": "已创建标准家族参考蛋白 {name} ({link_type})。", "en": "Created standard family reference protein {name} ({link_type})."},
"diag-manifest-exists": {"zh": "Manifest 已存在: {path}", "en": "Manifest already exists: {path}"},
"diag-manifest-stage-running": {"zh": "{job_id}/{stage} 当前仍在运行,拒绝恢复 manifest。", "en": "{job_id}/{stage} is still running; refusing manifest restore."},
"diag-manifest-not-supported": {"zh": "暂不支持 {stage} 的 manifest 自动恢复;需要先定义该阶段核心产物契约。", "en": "Auto manifest restore for {stage} is not yet supported; core product contract must be defined first."},
"diag-manifest-insufficient-products": {"zh": "{stage} final 核心产物不足,不能安全恢复 manifest。", "en": "{stage} final core products are insufficient; manifest cannot be safely restored."},
"diag-manifest-restored": {"zh": "已根据 final 核心产物恢复 {stage} manifest。", "en": "Restored {stage} manifest from final core products."},
"diag-ortholog-running": {"zh": "{job_id}/ortholog 当前仍在运行,拒绝执行 intermediate 落盘修复。", "en": "{job_id}/ortholog is still running; refusing intermediate disk fix."},
"diag-ortholog-no-reusable": {"zh": "ortholog/ 下没有可复用的 *_pairs.txt,无法执行 intermediate 落盘修复。", "en": "No reusable *_pairs.txt found under ortholog/; intermediate disk fix cannot be executed."},
"diag-ortholog-fix-failed": {"zh": "ortholog intermediate 落盘修复失败: {exc}", "en": "Ortholog intermediate disk fix failed: {exc}"},
"diag-ortholog-no-manifest": {"zh": "ortholog intermediate 落盘修复未生成 manifest", "en": "Ortholog intermediate disk fix did not generate a manifest"},
"diag-gff-empty-not-found": {"zh": "未能定位空 final GFF。", "en": "Could not locate empty final GFF."},
"diag-gff-no-nonempty-species": {"zh": "{species} 没有可用的非空原始 GFF。", "en": "{species} has no available non-empty original GFF."},
"diag-gff-cannot-identify-species": {"zh": "无法从诊断证据中识别物种。", "en": "Cannot identify species from diagnostic evidence."},
"diag-gff-missing-genome": {"zh": "{species} 缺少可用于 gffread 的 genome 或非空 GFF。", "en": "{species} lacks a genome or non-empty GFF usable for gffread."},
"diag-gff-ready-for-gffread": {"zh": "已确认可用 genome+GFF,可在确认后执行 gffread 提取 pep/cds。", "en": "Confirmed usable genome+GFF; gffread can be executed after confirmation to extract pep/cds."},
"diag-cmd-empty": {"zh": "缺少可执行命令。请在 fix_data.cmd 中提供原阶段命令,DiagnosisAgent 会替换为 patched script。", "en": "Missing executable command. Please provide the original stage command in fix_data.cmd; DiagnosisAgent will replace it with the patched script."},
"diag-cmd-no-script-path": {"zh": "原命令中未找到阶段脚本路径,无法保证使用 patched script 执行。", "en": "Stage script path not found in original command; cannot guarantee execution with patched script."},
"diag-fix-notification-title": {"zh": "🔧 自动修复通知", "en": "🔧 Auto-fix notification"},
"diag-param-changed": {"zh": "参数变更:", "en": "Parameters changed:"},
"diag-re-executing": {"zh": "正在重新执行...", "en": "Re-executing..."},
"diag-llm-infer-failed": {"zh": "LLM 推断 {stage} 失败根因:{category}", "en": "LLM inference for {stage} failure root cause: {category}"},
"diag-fix-cpu-reduce": {"zh": "将CPU从{current_cpu}减少到{new_cpu}", "en": "Reduce CPU from {current_cpu} to {new_cpu}"},
"diag-fix-params-renamed": {"zh": "修复了{count}个参数名称", "en": "Fixed {count} parameter name(s)"},
"diag-fix-missing-deps": {"zh": "需要前置执行依赖阶段: {deps}", "en": "Prerequisite dependency stages needed: {deps}"},
# ── interpretation evidence risks ──
"evidence-species-incomplete": {"zh": "存在未成功完成数据准备的物种,后续分析不能视为输入完整。", "en": "Some species have not completed data preparation; downstream analysis should not be considered input-complete."},
"evidence-config-preflight-fail": {"zh": "config.xlsx 预检未通过,物种角色或输入文件需复核。", "en": "config.xlsx preflight check failed; species roles or input files need review."},
"evidence-candidates-lt-final": {"zh": "manifest 中 candidates={candidates} 小于 final_members={final_members},报告不得表述为从{candidates}个候选筛出{final_members}个。", "en": "Manifest candidates={candidates} is less than final_members={final_members}; report must not claim {final_members} were screened from {candidates} candidates."},
"evidence-id-count-mismatch": {"zh": "成员ID文件计数({id_count})与manifest final_members({final_members})不一致。", "en": "Member ID file count ({id_count}) does not match manifest final_members ({final_members})."},
"evidence-fasta-count-mismatch": {"zh": "蛋白FASTA序列数({fasta_count})与manifest final_members({final_members})不一致。", "en": "Protein FASTA sequence count ({fasta_count}) does not match manifest final_members ({final_members})."},
"evidence-tip-count-mismatch": {"zh": "Newick tip数({tips})与manifest序列数({seq_count})不一致,系统发育图或树文件需复核。", "en": "Newick tip count ({tips}) does not match manifest sequence count ({seq_count}); tree file needs review."},
"evidence-msa-gap-high": {"zh": "MSA gap比例为{gap:.2f}%,深层拓扑和远缘分支解释需谨慎。", "en": "MSA gap ratio is {gap:.2f}%; deep topology and distant branch interpretation should be cautious."},
"evidence-motif-txt-empty": {"zh": "motif_prot_txt 为空,无法从原始位置表验证每个基因的motif排列。", "en": "motif_prot_txt is empty; cannot verify per-gene motif arrangement from the raw position table."},
"evidence-motif-low-coverage": {"zh": "最保守motif覆盖率约{coverage:.1%},不宜直接声称所有成员共享该motif。", "en": "Most conserved motif coverage is ~{coverage:.1%}; should not directly claim all members share this motif."},
"evidence-structure-partial": {"zh": "structure 阶段为 partial_success,结构结论应标记为可用但不完整。", "en": "Structure stage is partial_success; structural conclusions should be marked as usable but incomplete."},
"evidence-structure-coverage-note": {"zh": "structure_coverage_rate={coverage},manifest 的 genes_with_structure 可能按mRNA/转录本层级计数;报告应优先采用structure.tsv的基因级计数。", "en": "structure_coverage_rate={coverage}; manifest genes_with_structure may count at mRNA/transcript level; report should use gene-level counts from structure.tsv."},
"evidence-expression-fewer-genes": {"zh": "表达矩阵包含{expr_genes}个家族基因,少于鉴定成员{family_genes}个;缺失示例: {missing}。", "en": "Expression matrix contains {expr_genes} family genes, fewer than {family_genes} identified members; missing examples: {missing}."},
"evidence-domain-significant-parse-error": {"zh": "manifest记录显著hits为0,但domtblout按E<=1e-5解析得到{hits}个显著hits;当前domain manifest/report统计存在解析错误,应以原始domtblout复核。", "en": "Manifest records 0 significant hits, but domtblout parsing at E<=1e-5 yields {hits} significant hits; domain manifest/report stats have parsing errors; should verify against raw domtblout."},
"evidence-domain-zero-significant": {"zh": "hmmscan产生{total}个raw hits,但显著hits为0;结构域结论应解释阈值、数据库和identify阶段SBP HMM的一致性。", "en": "hmmscan produced {total} raw hits, but significant hits are 0; domain conclusions should explain threshold, database, and identify-stage SBP HMM consistency."},
"evidence-domain-sbp-few": {"zh": "SBP结构域仅在{sbp_count}/{query_count}个蛋白中达到显著阈值,短序列或截短成员需要单独标注。", "en": "SBP domain reaches significance in only {sbp_count}/{query_count} proteins; short sequences or truncated members need separate annotation."},
"evidence-ref-class-no-confirmed": {"zh": "reference_classification 未形成可确认亚家族分类;需检查参考亚家族表、参考序列ID映射和联合FASTA。", "en": "reference_classification did not produce confirmable subfamily classification; check reference subfamily table, reference sequence ID mapping, and joint FASTA."},
"evidence-promoter-coverage": {"zh": "启动子元件覆盖{genes_with}/{family_count}个家族成员,至少{missing}个成员缺少可解释启动子元件记录。", "en": "Promoter elements cover {genes_with}/{family_count} family members; at least {missing} members lack interpretable promoter element records."},
"evidence-promoter-core-only": {"zh": "最高频元件为TATA/CAAT等核心启动子元件,不能单独作为胁迫或激素响应结论;需结合ABRE、MYB/MYC、LTR等功能元件和表达数据解释。", "en": "Top elements are core promoter elements (TATA/CAAT); cannot be used alone as stress or hormone response evidence; combine with ABRE, MYB/MYC, LTR, and expression data."},
"evidence-synteny-background": {"zh": "synteny manifest 的 gene_count={background} 是全基因组背景规模,不应当解读为{prefix}家族成员数。", "en": "synteny manifest gene_count={background} is genome-wide background scale; should not be interpreted as {prefix} family member count."},
"evidence-synteny-no-pairs": {"zh": "种内共线性文件未检测到涉及{family_label}成员的基因对,不能据此声称家族扩张由片段复制驱动。", "en": "Intra-species collinearity file detected no gene pairs involving {family_label} members; cannot claim family expansion driven by segmental duplication."},
"evidence-karyotype-no-genes": {"zh": "核型阶段未定位到家族基因,不能进行染色体分布解释。", "en": "No family genes mapped in karyotype stage; chromosome distribution interpretation is not possible."},
"evidence-interspecies-no-target-collinearity": {"zh": "种间MCScanX collinearity中未检测到{target_label} {family_label}成员参与的共线性基因对,当前结果只能说明全基因组目标-参考共线性背景,不能直接支撑{family_label}保守共线性结论。", "en": "No collinear gene pairs involving {target_label} {family_label} members detected in inter-species MCScanX; results only show genome-wide target-reference collinearity background, cannot support {family_label} conserved collinearity."},
"evidence-interspecies-no-direct-pair": {"zh": "虽然检测到目标或参考{family_label}成员参与collinearity,但未发现二者在同一共线性基因对中直接配对;保守共线性结论应降级为候选线索。", "en": "Target or reference {family_label} members participate in collinearity, but no direct pairing in the same collinear gene pair found; conserved collinearity should be downgraded to candidate clue."},
"evidence-ppi-zero": {"zh": "PPI阶段报告Input Genes或Total Interactions为0,不能作为{family_label}蛋白互作证据;需修正物种映射/同源转换后重跑。", "en": "PPI stage reports Input Genes or Total Interactions as 0; cannot serve as {family_label} protein interaction evidence; fix species mapping/homology conversion and re-run."},
"evidence-pep-pi-outlier": {"zh": "蛋白pI出现超出生物物理常见范围的数值(avg_pi={avg_pi}, max_pi={max_pi}),pI算法或字段解析需要复核,不能直接发表为理化性质结论。", "en": "Protein pI values exceed common biophysical ranges (avg_pi={avg_pi}, max_pi={max_pi}); pI algorithm or field parsing needs review; cannot be directly published as physicochemical conclusions."},
"evidence-kaks-saturated": {"zh": "检测到Ks=99或接近99的基因对。这通常是yn00同义替换饱和/估计边界信号;原始结果应保留,但该基因对的分化时间和选择压力解释需要在深度解读中降级为谨慎解释。", "en": "Ks=99 or near-99 gene pairs detected; this is typically yn00 synonymous saturation/boundary signal; keep raw results but downgrade divergence time and selection pressure interpretation to cautious."},
"evidence-kaks-anomalous": {"zh": "mean_ks={mean_ks:.2f}且发散时间达到异常大数量级,Ka/Ks结果很可能存在序列配对、比对或单位换算问题;不能直接解释为正选择。", "en": "mean_ks={mean_ks:.2f} and divergence time is anomalously large; Ka/Ks results likely have sequence pairing, alignment, or unit conversion issues; cannot directly interpret as positive selection."},
"evidence-kaks-all-positive": {"zh": "所有成功基因对均表现Ka/Ks>1时,应先排除饱和替换、远缘同源和CDS比对质量问题,再讨论正选择。", "en": "When all successful gene pairs show Ka/Ks>1, first exclude saturation, distant homology, and CDS alignment quality issues before discussing positive selection."},
"evidence-rnaseq-qc-zero-reads": {"zh": "QC manifest中所有样本raw_reads/clean_reads为0;FastQC/Cutadapt产物存在时说明流程执行完成,但reads计数字段未被解析,报告中不要据此声称测序量为0。", "en": "All sample raw_reads/clean_reads are 0 in QC manifest; FastQC/Cutadapt products exist meaning the pipeline completed, but read count fields were not parsed; do not claim zero sequencing in reports."},
"evidence-rnaseq-align-zero": {"zh": "Align manifest中total_reads/aligned_reads为0;应优先查看HISAT2日志判断真实比对率,不能把0作为生物学或数据质量结论。", "en": "Align manifest total_reads/aligned_reads are 0; check HISAT2 logs for real alignment rate; cannot use 0 as biological or data quality conclusion."},
"evidence-rnaseq-sample-qc-note": {"zh": "样本数为{samples},PCA/相关性可以用于质控,但离群样本判断需要结合原始QC、比对率和实验批次。", "en": "{samples} samples; PCA/correlation can be used for QC, but outlier judgment needs combined original QC, alignment rate, and experimental batch."},
"evidence-rnaseq-wgcna-note": {"zh": "WGCNA样本数为{samples},可以作为候选模块探索,但模块-性状相关和hub基因不宜作为强因果结论。", "en": "WGCNA has {samples} samples; can be used for candidate module exploration, but module-trait correlations and hub genes should not be treated as strong causal conclusions."},
# ── main.py user-visible messages ──
"main-auto-annotation-both-missing": {"zh": "当前 GO/KEGG 富集背景缺失或与 DE 基因 ID 不匹配,需要启动本地自动注释。", "en": "GO/KEGG enrichment background missing or mismatched with DE gene IDs; need to start local auto-annotation."},
"main-auto-annotation-kegg-missing": {"zh": "当前 KEGG 富集背景缺失,需要启动本地自动注释生成 gene2ko。", "en": "KEGG enrichment background missing; need to start local auto-annotation to generate gene2ko."},
"main-auto-annotation-go-mismatch": {"zh": "当前 GO 背景与 DE 基因 ID 不匹配,需要启动本地自动注释生成匹配的 gene2go。", "en": "GO background does not match DE gene IDs; need to start local auto-annotation to generate matching gene2go."},
"main-auto-annotation-go-missing": {"zh": "当前 GO 富集背景缺失,需要启动本地自动注释生成 gene2go。", "en": "GO enrichment background missing; need to start local auto-annotation to generate gene2go."},
"main-family-conflict": {"zh": "基因家族冲突:请求为 {requested},但当前 job config.xlsx 的 Analysis.Family 为 {config_family}。请修改 config 或新建 job 后再运行。", "en": "Gene family conflict: requested {requested}, but current job config.xlsx Analysis.Family is {config_family}. Please modify config or create a new job."},
"main-family-parse-error": {"zh": "基因家族解析错误:{requested} 是物种代码,不是 gene family。", "en": "Gene family parse error: {requested} is a species code, not a gene family."},
"main-identify-select-target": {"zh": "请选择本次 identify 要鉴定的物种;reference 仅作为参考来源,不参与目标鉴定。", "en": "Please select the species to identify in this run; reference species are for reference only and will not be identified."},
"main-species-unresolved": {"zh": "{role} 物种名称无法从 config.xlsx 映射到 Species_Code: {unresolved};请在 config 中补充 Species_Code 及拉丁名/别名后再执行。", "en": "{role} species names could not be mapped to Species_Code from config.xlsx: {unresolved}; please add Species_Code, Latin name, or alias in config before running."},
"main-species-confirmed": {"zh": "已根据本次亚家族分类请求确定待分类物种;reference 仅作为参考来源。", "en": "Classification target species confirmed based on this subfamily classification request; reference species are for reference only."},
"main-species-not-confirmed": {"zh": "基因家族分析尚未确认目标物种;请先核对并确认 config.xlsx。", "en": "Gene family analysis has not confirmed target species; please check and confirm config.xlsx first."},
"main-role-target": {"zh": "目标物种", "en": "Target species"},
"main-role-reference": {"zh": "参考物种", "en": "Reference species"},
"main-role-comparative": {"zh": "比较物种", "en": "Comparative species"},
"main-role-analysis-target": {"zh": "本轮分析对象", "en": "Analysis target"},
"main-role-not-configured": {"zh": "未登记", "en": "Not configured"},
"main-species-role-conflict": {"zh": "{species}:config.xlsx 为{config_role},本轮为{requested_role}", "en": "{species}: config.xlsx = {config_role}, current run = {requested_role}"},
"main-species-internal-conflict": {"zh": "检测到 config.xlsx 内部物种角色冲突:{details}。请发送打开 config.xlsx,修正并重新确认物种角色后再继续。", "en": "Detected internal species role conflict in config.xlsx: {details}. Please open config.xlsx, correct and re-confirm species roles."},
"main-species-role-drift": {"zh": "检测到系统意图解析发生角色漂移:{details}。config.xlsx 未被修改,系统已阻止按错误范围执行,请重新提交当前分析请求。", "en": "Detected role drift in intent parsing: {details}. config.xlsx unchanged; execution blocked. Please re-submit current analysis request."},
"main-species-inconsistent-role": {"zh": "检测到本轮请求与项目物种角色不一致:{details}。系统已阻止执行,请按 config.xlsx 中已确认的角色重新描述分析范围;如需修改项目物种角色,请发送打开 config.xlsx。", "en": "Detected inconsistency between current request and project species roles: {details}. Execution blocked. Please re-describe analysis scope per confirmed config.xlsx roles; to change project roles, open config.xlsx."},
"main-subfamily-missing-labels": {"zh": "请求要求使用亚家族标签,但缺少 {sp}.{family}.confirmed_subfamily.tsv 或 {sp}.{family}.subfamily。", "en": "Request requires subfamily labels, but {sp}.{family}.confirmed_subfamily.tsv or {sp}.{family}.subfamily is missing."},
"main-subfamily-missing-suggestion": {"zh": "请先完成参考亚家族分类并保存确认标签,或上传目标物种亚家族文件。", "en": "Please complete reference subfamily classification and save confirmed labels, or upload target species subfamily file."},
"main-stage-missing-pep": {"zh": "{stage} 缺少 {sp} 的基因家族成员蛋白文件。", "en": "{stage} is missing gene family member protein file for {sp}."},
"main-stage-missing-pep-sugg": {"zh": "请先完成 {sp}/{family} 的 identify,生成 Target.{sp}.{family}.final_members.pep.fa。", "en": "Please complete identify for {sp}/{family} first to generate Target.{sp}.{family}.final_members.pep.fa."},
"main-unknown-label": {"zh": "未知", "en": "Unknown"},
"main-unknown-species": {"zh": "未知物种", "en": "Unknown species"},
"main-species-role-conflict": {"zh": "{species}:config.xlsx 为{config_role},本轮为{requested_role}", "en": "{species}: config.xlsx = {config_role}, current run = {requested_role}"},
"main-species-internal-conflict-prefix": {"zh": "检测到 config.xlsx 内部物种角色冲突:", "en": "Detected internal species role conflict in config.xlsx: "},
"main-species-role-drift-prefix": {"zh": "检测到系统意图解析发生角色漂移:", "en": "Detected role drift in intent parsing: "},
"main-species-inconsistent-role-prefix": {"zh": "检测到本轮请求与项目物种角色不一致:", "en": "Detected inconsistency between current request and project species roles: "},
"main-open-config-suggestion": {"zh": "如需修改项目物种角色,请发送打开 config.xlsx。", "en": "To modify project species roles, please send open config.xlsx."},
"main-species-unresolved": {"zh": "{role} 物种名称无法从 config.xlsx 映射到 Species_Code: {unresolved};请在 config 中补充 Species_Code 及拉丁名/别名后再执行。", "en": "{role} species names could not be mapped to Species_Code from config.xlsx: {unresolved}; please add Species_Code, Latin name, or alias in config before running."},
"main-intent-ncbi-download": {"zh": "我理解你想从 NCBI 下载序列;输入为 {query}。", "en": "I understand you want to download sequences from NCBI; input: {query}."},
"main-intent-clean-fasta": {"zh": "我理解你想清理FASTA序列ID/header;", "en": "I understand you want to clean FASTA sequence IDs/headers; "},
"main-intent-extract-by-id": {"zh": "我理解你想按ID从本地FASTA提取序列;", "en": "I understand you want to extract sequences from local FASTA by ID; "},
"main-intent-msa-conserved": {"zh": "我理解你想自动寻找 MSA 保守窗口并绘图;", "en": "I understand you want to automatically find MSA conserved windows and plot; "},
"main-intent-msa-region": {"zh": "我理解你想对 MSA alignment 指定区间进行局部绘图。", "en": "I understand you want to plot a specific region of the MSA alignment."},
"main-intent-msa-region-prompt": {"zh": "我理解你想对 MSA alignment 第 ... 列进行局部绘图。", "en": "I understand you want to plot specific columns of the MSA alignment."},
"main-intent-promoter-custom": {"zh": "我理解你想基于已有 PlantCARE/promoter 结果进行启动子自定义筛选绘图,不重新跑启动子预测。", "en": "I understand you want to create custom promoter plots from existing PlantCARE/promoter results without re-running prediction."},
"main-intent-extract-process": {"zh": "我理解你想按ID从本地FASTA提取或处理序列。", "en": "I understand you want to extract or process sequences from local FASTA by ID."},
"main-intent-unknown": {"zh": "抱歉,我没有理解你想做什么分析。请说明要执行的分析阶段(鉴定、进化树、Motif、结构域、基因结构等)。", "en": "Sorry, I did not understand what analysis you want. Please specify the analysis stage (identification, phylogeny, Motif, domain, gene structure, etc.)."},
"main-preflight-multi-target-spp": {"zh": "Identify 阶段检测到多个目标物种蛋白,需要确认 target species,不自动开始执行。", "en": "Identify stage detected multiple target species proteins; target species must be confirmed before auto-starting execution."},
"main-preflight-select-target": {"zh": "请在弹窗中选择 target species;系统会据此自动生成内部 prefix。", "en": "Please select target species in the dialog; the system will auto-generate the internal prefix accordingly."},
"main-preflight-check-config": {"zh": "请检查 config.xlsx、input、final 或先运行可生成该输入的上游阶段。", "en": "Please check config.xlsx, input, final, or run the upstream stage that generates this input first."},
"main-preflight-check-genome": {"zh": "请检查 config.xlsx 中目标物种 genome FASTA,或先运行 genome_prepare 生成目标物种 genome 输入。", "en": "Please check target species genome FASTA in config.xlsx, or run genome_prepare first to generate target genome input."},
"main-preflight-check-tfbs": {"zh": "请确认 data/tfbs/jaspar2026/combined/JASPAR2026_CORE_plants_non-redundant.meme 存在,或配置 PlantTFDB/JASPAR MEME 资源。", "en": "Please confirm data/tfbs/jaspar2026/combined/JASPAR2026_CORE_plants_non-redundant.meme exists, or configure PlantTFDB/JASPAR MEME resources."},
"main-ext-stage-build-failed": {"zh": "拓展分析阶段构建失败: {exc}", "en": "Extension stage build failed: {exc}"},
"main-ext-stage-trial-failed": {"zh": "拓展分析阶段试运行失败: {exc}", "en": "Extension stage trial run failed: {exc}"},
"main-ext-stage-confirm-failed": {"zh": "拓展分析阶段确认失败: {exc}", "en": "Extension stage confirmation failed: {exc}"},
"main-ext-stage-validate-params-failed": {"zh": "拓展分析阶段参数检查失败: {exc}", "en": "Extension stage parameter validation failed: {exc}"},
"main-ext-stage-validate-failed": {"zh": "拓展分析阶段验证失败: {exc}", "en": "Extension stage validation failed: {exc}"},
"main-ext-stage-repair-failed": {"zh": "拓展分析阶段修订失败: {exc}", "en": "Extension stage repair failed: {exc}"},
"main-ext-stage-repair-candidates-failed": {"zh": "拓展分析阶段修订候选读取失败: {exc}", "en": "Extension stage repair candidate read failed: {exc}"},
"main-ext-stage-repair-promote-failed": {"zh": "拓展分析阶段修订候选发布失败: {exc}", "en": "Extension stage repair candidate publish failed: {exc}"},
"main-ext-stage-publish-failed": {"zh": "拓展分析阶段发布失败: {exc}", "en": "Extension stage publish failed: {exc}"},
"main-ext-stage-frontend-gate-failed": {"zh": "拓展分析阶段前端门控记录失败: {exc}", "en": "Extension stage frontend gate record failed: {exc}"},
"main-ext-stage-frontend-e2e-gate-failed": {"zh": "拓展分析阶段前端展示门控失败: {exc}", "en": "Extension stage frontend e2e gate failed: {exc}"},
"main-ext-stage-nl-runtime-gate-failed": {"zh": "拓展分析阶段自然语言运行门控失败: {exc}", "en": "Extension stage NL runtime gate failed: {exc}"},
"main-ext-stage-nl-runtime-repair-failed": {"zh": "拓展分析阶段自然语言运行门控修订失败: {exc}", "en": "Extension stage NL runtime gate repair failed: {exc}"},
"main-ext-stage-execute-failed": {"zh": "拓展分析阶段执行失败: {exc}", "en": "Extension stage execution failed: {exc}"},
"main-methodology-module-unavailable": {"zh": "方法学配置模块不可用,请检查 GF_MAS_ROOT", "en": "Methodology configuration module unavailable; please check GF_MAS_ROOT"},
"main-methodology-config-read-failed": {"zh": "读取方法学配置失败: {e}", "en": "Failed to read methodology configuration: {e}"},
"main-methodology-rag-trigger-failed": {"zh": "无法触发 RAG MinerU+LLM 方法学提取: {e}", "en": "Failed to trigger RAG MinerU+LLM methodology extraction: {e}"},
"main-methodology-task-list-failed": {"zh": "无法读取 RAG 方法学任务列表: {e}", "en": "Failed to read RAG methodology task list: {e}"},
"main-methodology-task-status-failed": {"zh": "无法读取 RAG 方法学任务状态: {e}", "en": "Failed to read RAG methodology task status: {e}"},
"main-methodology-config-failed": {"zh": "无法读取 RAG 方法学配置: {e}", "en": "Failed to read RAG methodology configuration: {e}"},
"main-methodology-plan-failed": {"zh": "无法读取 RAG 方法学方案: {e}", "en": "Failed to read RAG methodology plan: {e}"},
"main-methodology-sandbox-example-failed": {"zh": "无法读取 RAG 方法学 sandbox 示例: {e}", "en": "Failed to read RAG methodology sandbox example: {e}"},
"main-methodology-sandbox-build-failed": {"zh": "无法构建 RAG 方法学 sandbox: {e}", "en": "Failed to build RAG methodology sandbox: {e}"},
"main-methodology-sandbox-query-failed": {"zh": "无法查询 RAG 方法学 sandbox: {e}", "en": "Failed to query RAG methodology sandbox: {e}"},
"main-methodology-plan-not-found": {"zh": "方法学方案文件不存在: {path}", "en": "Methodology plan file not found: {path}"},
"main-methodology-plan-read-failed": {"zh": "无法读取 RAG 方法学方案: {exc}", "en": "Failed to read RAG methodology plan: {exc}"},
"main-methodology-missing-plan": {"zh": "缺少 plan、plan_path、methodology_job_id 或已绑定 job plan", "en": "Missing plan, plan_path, methodology_job_id, or already bound job plan"},
"main-methodology-no-orchestrator": {"zh": "方法学执行不再使用独立后端编排器;请通过 /api/agent/plan 生成多智能体规划后再逐阶段提交 /api/execute。", "en": "Methodology execution no longer uses a standalone backend orchestrator; please generate a multi-agent plan via /api/agent/plan and submit stages via /api/execute."},
# ── main.py general messages ──
"main-file-read-failed": {"zh": "读取文件失败: {exc}", "en": "Failed to read file: {exc}"},
"main-file-not-found-in-job": {"zh": "没有在当前 job 的安全目录中找到文件:{filename}", "en": "File not found in current job directory: {filename}"},
"main-no-fasta-header": {"zh": "没有从 {filename} 读取到 FASTA header。", "en": "No FASTA header read from {filename}."},
"main-no-preview-file": {"zh": "没有找到可预览的文件。", "en": "No previewable files found."},
"main-no-result-prefix": {"zh": "没有识别到结果前缀,例如 At.SPL。", "en": "Could not identify result prefix, e.g. At.SPL."},
"main-no-ncbi-result": {"zh": "没有在当前 workspace 中找到 {prefix} 的 NCBI 下载结果。", "en": "No NCBI download result found for {prefix} in current workspace."},
"main-annotation-just-ended": {"zh": "自动背景注释进程刚结束,等待后端写入最终注释状态。", "en": "Auto background annotation process just ended; waiting for backend to write final annotation status."},
"main-annotation-syncing": {"zh": "自动背景注释状态同步中,正在等待后端最终结果...", "en": "Auto background annotation status syncing; waiting for backend final result..."},
"main-annotation-interrupted": {"zh": "自动背景注释已中断:progress 仍为 running,但没有检测到对应的运行进程。请重新执行该阶段。", "en": "Auto background annotation interrupted: progress is still running but no corresponding process detected. Please re-run this stage."},
"main-annotation-failed": {"zh": "自动背景注释失败", "en": "Auto background annotation failed"},
"main-annotation-done-continue": {"zh": "自动背景注释已完成,正在继续执行富集分析...", "en": "Auto background annotation completed; continuing with enrichment analysis..."},
"main-annotation-progress": {"zh": "自动背景注释进行中:{processed}/{total},已注释 {annotated},失败 {failed}", "en": "Auto background annotation in progress: {processed}/{total}, annotated {annotated}, failed {failed}"},
"main-waiting-resource": {"zh": "等待资源可用", "en": "Waiting for resource"},
"main-waiting-resource-dots": {"zh": "等待资源可用...", "en": "Waiting for resource..."},
"main-submitting-plantcare": {"zh": "正在提交序列到 PlantCARE...", "en": "Submitting sequences to PlantCARE..."},
"main-running-mcscanx": {"zh": "正在进行共线性分析(MCScanX)...", "en": "Running synteny analysis (MCScanX)..."},
"main-plantcare-waiting": {"zh": "已提交 PlantCARE,等待邮件结果(可能需要10-60分钟)...", "en": "Submitted to PlantCARE; waiting for email results (may take 10-60 minutes)..."},
"main-plantcare-waiting-email": {"zh": "已提交 PlantCARE,正在等待邮件...", "en": "Submitted to PlantCARE; waiting for email..."},
"main-task-queued": {"zh": "任务已进入资源调度队列", "en": "Task entered resource scheduling queue"},
"main-task-submitted-celery": {"zh": "任务已提交到 Celery,等待 worker 获取资源", "en": "Task submitted to Celery; waiting for worker"},
"main-task-done": {"zh": "任务完成", "en": "Task completed"},
"main-task-failed": {"zh": "任务失败", "en": "Task failed"},
"main-task-submitted-wait": {"zh": "任务已提交,等待 Celery worker 接收", "en": "Task submitted; waiting for Celery worker"},
"main-task-running": {"zh": "任务运行中", "en": "Task running"},
"main-task-not-exist": {"zh": "任务不存在", "en": "Task not found"},
"main-task-ended": {"zh": "任务已结束,无法取消", "en": "Task ended; cannot cancel"},
"main-task-cancelled": {"zh": "任务已取消", "en": "Task cancelled"},
"main-task-marked-cancel": {"zh": "任务已标记为取消", "en": "Task marked for cancellation"},
"main-ok-tree-revised": {"zh": "✅ 进化树图修订完成。", "en": "✅ Tree plot revision completed."},
"main-ok-synteny-circos": {"zh": "✅ 种内共线性 Circos 图修订完成。", "en": "✅ Synteny Circos plot revision completed."},
"main-ok-promoter-plot": {"zh": "✅ 启动子自定义绘图完成。", "en": "✅ Promoter custom plot completed."},
"main-ok-msa-region-plot": {"zh": "✅ MSA区间绘图完成。", "en": "✅ MSA region plot completed."},
"main-ok-stage-done": {"zh": "✅ {stage} 分析已完成", "en": "✅ {stage} analysis completed"},
"main-err-stage-no-output": {"zh": "❌ {stage} 未生成有效输出", "en": "❌ {stage} did not generate valid output"},
"main-ok-annotation-done": {"zh": "✅ 自动背景注释已完成", "en": "✅ Auto background annotation completed"},
"main-gwas-need-fmt": {"zh": "先完成同一 job、同一 genotype scope 的 gwas_fmt 阶段。", "en": "Complete the gwas_fmt stage under the same job and genotype scope first."},
"main-gwas-select-phenotype": {"zh": "请选择 phenotype 的样本列和性状列。", "en": "Please select phenotype sample column and trait column."},
"main-gwas-admixture-k": {"zh": "ADMIXTURE K 必须至少为2。", "en": "ADMIXTURE K must be at least 2."},
"main-gwas-qfam-no-source": {"zh": "Q/FAM 缺少可验证的源 genotype scope。", "en": "Q/FAM lacks verifiable source genotype scope."},
"main-gwas-qfam-mismatch": {"zh": "Q/FAM 与当前 genotype scope 不一致。", "en": "Q/FAM does not match current genotype scope."},
"main-gwas-need-four-upstream": {"zh": "先完成同一 job 和精确 scientific scope 的四个 GWAS 上游阶段。", "en": "Complete the four GWAS upstream stages under the same job and exact scientific scope first."},
"main-gwas-need-mlm": {"zh": "先完成同一 job 和精确五范围的 gwas_mlm 阶段。", "en": "Complete the gwas_mlm stage under the same job and exact five-scope first."},
"main-gwas-need-fmt-trait": {"zh": "先完成同一 job 和精确 genotype/phenotype scope 的 gwas_fmt 与 gwas_trait 阶段。", "en": "Complete gwas_fmt and gwas_trait stages under the same job and exact genotype/phenotype scope first."},
"main-gwas-need-emmax": {"zh": "先完成同一 job 和精确 scientific scope 的 gwas_emmax 阶段。", "en": "Complete the gwas_emmax stage under the same job and exact scientific scope first."},
"main-gwas-need-fmt-trait-cov": {"zh": "先完成同一 job 和精确 scientific scope 的 gwas_fmt、gwas_trait 与 gwas_cov 阶段。", "en": "Complete gwas_fmt, gwas_trait, and gwas_cov stages under the same job and exact scientific scope first."},
"main-diag-closed": {"zh": "DiagnosisAgent 已关闭", "en": "DiagnosisAgent closed"},
"main-diag-failed": {"zh": "诊断失败: {e}", "en": "Diagnosis failed: {e}"},
"main-diag-job-stage-failed": {"zh": "Job/stage 诊断失败: {e}", "en": "Job/stage diagnosis failed: {e}"},
"main-diag-no-auto-fix": {"zh": "该诊断没有可自动执行的修复动作,已清理确认请求。", "en": "This diagnosis has no auto-executable fix actions; confirmation request cleared."},
"main-diag-old-confirm-cleared": {"zh": "该阶段已有成功 manifest,旧诊断确认请求已清理。", "en": "Stage already has a successful manifest; old diagnosis confirmation request cleared."},
"main-diag-no-auto-fix-manual": {"zh": "该诊断结果没有可自动执行的修复动作;请按建议人工处理或重新运行已修复的流程。", "en": "No auto-executable fix actions for this diagnosis; please handle manually per suggestions or re-run the fixed pipeline."},
"main-diag-fix-applied": {"zh": "修复方案已应用,将在下次轮询时继续执行", "en": "Fix applied; will continue execution on next poll"},
"main-diag-fix-skipped": {"zh": "已跳过修复,将在下次轮询时继续下一阶段", "en": "Fix skipped; will continue to next stage on next poll"},
"main-autofill-no-samples": {"zh": "样品表中没有可用于设计审查的样本。", "en": "No samples available for design review in sample table."},
"main-autofill-no-config": {"zh": "未找到 config.autofill.draft.xlsx 或 config.xlsx", "en": "config.autofill.draft.xlsx or config.xlsx not found"},
"main-autofill-no-samples-yaml": {"zh": "未找到 samples.autofill.draft.yaml 或 samples.yaml", "en": "samples.autofill.draft.yaml or samples.yaml not found"},
"main-ident-no-members-id": {"zh": "未找到 identified_members.id,无法生成成员确认表。", "en": "identified_members.id not found; cannot generate member confirmation table."},
"main-ident-no-interpro": {"zh": "未找到 InterProScan domain_review.tsv,已使用 identified_members + HMM/BLAST 证据生成成员确认表。", "en": "InterProScan domain_review.tsv not found; using identified_members + HMM/BLAST evidence to generate member confirmation table."},
"main-subfamily-confirm-note": {"zh": "确认后会生成 confirmed_subfamily.tsv;后续树图、structure、motif、domain、combo、promoter 会优先使用确认后的亚家族标签。", "en": "Upon confirmation, confirmed_subfamily.tsv will be generated; subsequent tree, structure, motif, domain, combo, and promoter will use confirmed subfamily labels."},
"main-subfamily-confirmed": {"zh": "亚家族标签已确认。联合确认会同步拆分生成各目标物种的 confirmed_subfamily.tsv;成员集合变化时需要重跑 phylogeny。", "en": "Subfamily labels confirmed. Joint confirmation will split and generate confirmed_subfamily.tsv per target species; phylogeny must be re-run when member sets change."},
"main-promoter-no-filtered": {"zh": "未找到已有 promoter filtered 表,请先完成启动子分析。", "en": "No existing promoter filtered table found; please complete promoter analysis first."},
"main-promoter-read-failed": {"zh": "读取启动子元件失败: {exc}", "en": "Failed to read promoter elements: {exc}"},
"main-ref-downloading": {"zh": "参考物种注释包仍在后台下载", "en": "Reference species annotation package still downloading in background"},
"main-ref-downloading-bg": {"zh": "正在后台下载参考物种注释包", "en": "Downloading reference species annotation package in background"},
"main-ref-download-started": {"zh": "参考物种注释包下载任务已启动", "en": "Reference species annotation package download started"},
"main-ref-download-done": {"zh": "参考物种注释包下载完成", "en": "Reference species annotation package download completed"},
"main-ref-download-incomplete": {"zh": "参考物种注释包下载未满足必需文件", "en": "Reference species annotation package download missing required files"},
"main-ref-download-submitted": {"zh": "参考物种注释包下载任务已提交", "en": "Reference species annotation package download submitted"},
"main-old-rnaseq-deprecated": {"zh": "旧版 /api/rnaseq/run 需要 stage 和 sample;当前 RNA-seq 流程请使用 /api/execute。", "en": "Legacy /api/rnaseq/run requires stage and sample; for current RNA-seq pipeline, please use /api/execute."},
"main-done": {"zh": "完成", "en": "Done"},
"main-path-not-exist": {"zh": "路径不存在: {path}", "en": "Path does not exist: {path}"},
"main-files-loaded": {"zh": "已加载 {count} 个文件", "en": "{count} file(s) loaded"},
"main-load-failed": {"zh": "加载失败: {e}", "en": "Load failed: {e}"},
"main-load-file-error": {"zh": "{path}: {e}", "en": "{path}: {e}"},
"main-kg-html-not-found": {"zh": "kg.html not found", "en": "kg.html not found"},
"main-kg-omics-not-found": {"zh": "knowledge_graph_with_omics.json not found", "en": "knowledge_graph_with_omics.json not found"},
"main-kg-json-not-found": {"zh": "knowledge_graph.json not found", "en": "knowledge_graph.json not found"},
"main-kg-json-env": {"zh": "未找到知识图谱 JSON。请设置环境变量 KNOWLEDGE_GRAPH_JSON...", "en": "Knowledge graph JSON not found. Please set environment variable KNOWLEDGE_GRAPH_JSON..."},
"main-kg-read-failed": {"zh": "读取知识图谱文件失败: {exc}", "en": "Failed to read knowledge graph file: {exc}"},
"main-rag-qa-failed": {"zh": "gene-family-mas-v2 QA 查询失败: {e}。请检查 GENE_FAMILY_MAS_API/DUAL_KB_QA_BASE_URL 指向的服务是否已启动。", "en": "gene-family-mas-v2 QA query failed: {e}. Please check whether the service pointed to by GENE_FAMILY_MAS_API/DUAL_KB_QA_BASE_URL is running."},
"main-meth-data-not-ready": {"zh": "方法学方案数据未就绪,请先确认 config.xlsx。", "en": "Methodology plan data not ready; please confirm config.xlsx first."},
"main-meth-species-unmapped": {"zh": "方法学方案中的物种名称未能映射到 config.xlsx 的 Species_Code,已阻止生成执行计划。", "en": "Species names in methodology plan could not be mapped to config.xlsx Species_Code; execution plan generation blocked."},
"main-meth-no-required-pfams": {"zh": "方法学 identify 缺少 requiredPfams,未启动普通 Pfam 推断。", "en": "Methodology identify missing requiredPfams; generic Pfam inference not started."},
"main-meth-reproduce": {"zh": "按已保存方法学方案复现文献流程", "en": "Reproduce literature pipeline per saved methodology plan"},
"main-meth-no-job": {"zh": "当前请求未传入有效 job_id,或当前 job 未绑定 methodology_plan.json...", "en": "Current request has no valid job_id, or current job is not bound to methodology_plan.json..."},
"main-meth-no-plan": {"zh": "当前 job 缺少可验证的基因家族分析计划,无法生成或打开正式报告。", "en": "Current job lacks a verifiable gene family analysis plan; cannot generate or open formal report."},
"main-meth-report-action": {"zh": "生成或打开基因家族结果报告", "en": "Generate or open gene family result report"},
"main-unspecified": {"zh": "未指定", "en": "Unspecified"},
"main-stage-completed-fastp": {"zh": "正在进行RNA-seq质控分析(fastp)... 这可能需要15-30分钟,请耐心等待...", "en": "Running RNA-seq QC (fastp)... this may take 15-30 minutes, please wait..."},
"main-detected-queue-recovery": {"zh": "检测到队列 {queue_name} 曾无 worker,已尝试恢复;任务仍在等待 worker 接收。", "en": "Queue {queue_name} previously had no workers; recovery attempted; task still waiting for worker."},
"main-fasta-extracted": {"zh": "已从 {filename} 的 FASTA header 中抽取 {title}。", "en": "Extracted {title} from FASTA headers in {filename}."},
"main-fasta-count": {"zh": "共 {count} 个;未识别到该字段的 header 数:{missing}。", "en": "Total {count}; unrecognized field headers: {missing}."},
"main-source-file": {"zh": "来源文件:{path}", "en": "Source file: {path}"},
"main-ncbi-result-found": {"zh": "已找到 {prefix} 的 NCBI 下载结果,workspace: {workspace}。", "en": "Found NCBI download results for {prefix}, workspace: {workspace}."},
"main-gene-id-count": {"zh": "共 {count} 个基因 ID:", "en": "Total {count} gene IDs:"},
"main-file-columns-preview": {"zh": "{filename} 的前 {cols} 列:\n\n{body}\n\n来源文件:{path}", "en": "First {cols} columns of {filename}:\n\n{body}\n\nSource file: {path}"},
"main-file-lines-preview": {"zh": "{filename} 的前 {count} 行:\n\n```text\n{body}\n```\n\n来源文件:{path}", "en": "First {count} lines of {filename}:\n\n```text\n{body}\n```\n\nSource file: {path}"},
# ── pipeline_backend ──
"pipe-parse-ref-assembly": {"zh": "正在解析推荐参考物种装配", "en": "Parsing recommended reference species assembly"},
"pipe-download-ncbi-ref": {"zh": "正在下载 NCBI 参考注释包", "en": "Downloading NCBI reference annotation package"},
"pipe-decompress-ref": {"zh": "正在解压参考 PEP/CDS", "en": "Decompressing reference PEP/CDS"},
"pipe-validate-pep-cds": {"zh": "正在校验 PEP/CDS ID 对齐", "en": "Validating PEP/CDS ID alignment"},
"pipe-ref-download-done": {"zh": "参考物种注释包下载完成", "en": "Reference species annotation package download completed"},
"pipe-subfamily-need-identify": {"zh": "❌ 亚家族证据阶段需要先完成 identify 成员初筛确认,生成 curated_members 后才能继续:{exc}", "en": "❌ Subfamily evidence stage requires identify member screening and curated_members generation first: {exc}"},
"pipe-need-subfamily-confirm": {"zh": "❌ 常规基因家族分析需要先完成亚家族确认,生成 final_members 后才能继续:{exc}", "en": "❌ Standard gene family analysis requires subfamily confirmation and final_members generation first: {exc}"},
"pipe-no-member-pep": {"zh": "❌ 未找到可用的成员蛋白 FASTA。", "en": "❌ No usable member protein FASTA found."},
"pipe-cleanup-no-old": {"zh": "✅ 清理完成:未发现超过 {days} 天的任务目录", "en": "✅ Cleanup done: no directories older than {days} days found"},
"pipe-cleanup-done": {"zh": "✅ 清理完成,已删除:\n", "en": "✅ Cleanup done, deleted:\n"},
"pipe-select-file": {"zh": "请选择文件", "en": "Please select a file"},
"pipe-upload-done": {"zh": "✅ 已上传到 input/{job_id}/: {files}", "en": "✅ Uploaded to input/{job_id}/: {files}"},
"pipe-file-not-exist": {"zh": "文件不存在", "en": "File not found"},
"pipe-file-truncated": {"zh": "\n\n... (文件较大,仅显示部分)", "en": "\n\n... (file too large, showing partial content)"},
"pipe-file-binary-preview": {"zh": "无法预览此文件(可能是二进制/图片/PDF)", "en": "Cannot preview this file (binary/image/PDF)"},
# ── report ──
"report-no-section-boundary": {"zh": "报告模板没有章节边界:{path}", "en": "Report template has no section boundaries: {path}"},
"report-unreplaced-placeholders": {"zh": "报告模板仍含未替换占位符", "en": "Report template still contains unreplaced placeholders"},
"report-no-results": {"zh": "暂无可生成的基因家族分析结果", "en": "No gene family analysis results available for report generation"},
"report-title-with-prefix": {"zh": "{prefix} 基因家族分析结果解读报告", "en": "{prefix} Gene Family Analysis Interpretation Report"},
"report-table-header": {"zh": "| 分析阶段 | 运行状态 | 模板支持 | 纳入报告 |", "en": "| Analysis Stage | Status | Template Support | Included |"},
"report-status-success": {"zh": "成功", "en": "Success"},
"report-status-partial": {"zh": "部分完成", "en": "Partial"},
"report-status-failed": {"zh": "失败", "en": "Failed"},
"report-status-pending": {"zh": "未完成", "en": "Pending"},
"report-unspecified": {"zh": "未指定", "en": "Unspecified"},
"report-api-orchestrated": {"zh": "API 编排", "en": "API Orchestrated"},
"report-fallback-script": {"zh": "候补脚本", "en": "Fallback Script"},
"report-is": {"zh": "是", "en": "Yes"},
"report-no": {"zh": "否", "en": "No"},
"report-fig-meaning": {"zh": "结果图展示该阶段的主要计算产物。", "en": "The result figure shows the main computational products of this stage."},
"report-fig-reading": {"zh": "结合图题、坐标轴、图例和成员标签阅读。", "en": "Read in conjunction with figure title, axes, legend, and member labels."},
"report-fig-result": {"zh": "本阶段代表结果见图,具体事实以本节确定性数据为准。", "en": "Representative results are shown in the figure; specific facts should reference the definitive data in this section."},
# ── interpretation submodules ──
"interp-pattern-member-confidence": {"zh": "家族成员集合可信度", "en": "Gene family member set confidence"},
"interp-pattern-core-domain": {"zh": "核心结构域支持", "en": "Core domain support"},
"interp-pattern-domain-motif": {"zh": "结构域与motif共同支持保守性", "en": "Domain and motif jointly support conservation"},
"interp-pattern-expression": {"zh": "表达调控线索", "en": "Expression regulation clues"},
"interp-claim-member-traceable": {"zh": "当前成员集合具有可追溯的家族鉴定证据。", "en": "The current member set has traceable family identification evidence."},
"interp-claim-no-expansion": {"zh": "目标物种发生家族扩张或收缩。", "en": "Target species underwent family expansion or contraction."},
"interp-validate-boundary-members": {"zh": "复核边界成员的HMM/BLAST来源和蛋白序列完整性。", "en": "Review HMM/BLAST sources and protein sequence integrity of boundary members."},
"interp-claim-domain-support": {"zh": "成员集合具有核心结构域层面的支持。", "en": "Member set has core domain-level support."},
"interp-claim-no-full-conservation": {"zh": "所有成员结构域完全保守。", "en": "All member domains are fully conserved."},
"interp-validate-truncation": {"zh": "检查未检出核心结构域的成员是否为截短或注释异常。", "en": "Check whether members without detected core domains are truncated or annotation anomalies."},
"interp-claim-domain-motif-conservation": {"zh": "结构域和motif共同支持蛋白架构保守性。", "en": "Domain and motif jointly support protein architecture conservation."},
"interp-critic-no-local-evidence": {"zh": "未绑定本地证据,不能进入本项目主要发现。", "en": "Not bound to local evidence; cannot enter main findings of this project."},
"interp-critic-high-risk": {"zh": "存在high级风险,结论可信度已自动降级。", "en": "High-level risk exists; conclusion confidence has been auto-downgraded."},
"interp-critic-weak-evidence": {"zh": "当前证据不足以支撑强机制动词,需改为候选或一致性表述。", "en": "Current evidence insufficient for strong mechanistic language; use candidate or consistency phrasing."},
"interp-report-supported": {"zh": "可表述为:{claim_text};该表述由本地证据支撑...", "en": "Can be stated as: {claim_text}; supported by local evidence..."},
"interp-report-candidate": {"zh": "可表述为:{claim_text};该结论应写成候选或筛查线索...", "en": "Can be stated as: {claim_text}; this conclusion should be phrased as candidate or screening clue..."},
"interp-report-lit-background": {"zh": "可表述为:{claim_text};相关文献可用于交代生物学背景...", "en": "Can be stated as: {claim_text}; relevant literature can be used for biological background..."},
"interp-narr-local-evidence": {"zh": " 本地证据:{evidence_text}。", "en": " Local evidence: {evidence_text}."},
"interp-narr-boundary": {"zh": " 边界:{limitation}。", "en": " Boundary: {limitation}."},
"interp-narr-next-step": {"zh": " 下一步:{next_step}。", "en": " Next step: {next_step}."},
"interp-narr-conclusion-boundary": {"zh": "当前结论必须限制在本地证据支持范围内。", "en": "Current conclusions must be limited to locally supported evidence."},
"interp-narr-candidate-discovery": {"zh": "候选科学发现", "en": "Candidate scientific discoveries"},
"interp-slot-object-scope": {"zh": "本阶段分析对象和规模", "en": "Objects and scale of this stage"},
"interp-slot-key-features": {"zh": "关键数据特征", "en": "Key data features"},
"interp-slot-patterns": {"zh": "组内/组间模式或例外", "en": "Within/between-group patterns or exceptions"},
"interp-slot-relationships": {"zh": "与前后阶段的关系", "en": "Relationship with preceding and following stages"},
"interp-slot-supported-claims": {"zh": "可支持的解释", "en": "Supported interpretations"},
"interp-slot-boundaries": {"zh": "不能越界的部分", "en": "Boundaries that should not be crossed"},
"interp-unresolved": {"zh": "未解析", "en": "Unresolved"},
"interp-no-local-evidence": {"zh": "未找到可追溯本地证据;仅能报告阶段状态,不能形成结果解读。", "en": "No traceable local evidence found; only stage status can be reported, no result interpretation."},
"interp-status-restricted": {"zh": "阶段状态为 {status},结果解读应标注为受限。", "en": "Stage status is {status}; result interpretation should be marked as restricted."},
"interp-missing-subtask-products": {"zh": "{status} 阶段缺少完整子任务产物,不能按完全成功阶段写作。", "en": "{status} stage lacks complete subtask products; cannot be written as fully successful stage."},
"interp-missing-newick": {"zh": "缺少可核验的 Newick tip 计数或分支支持信息。", "en": "Missing verifiable Newick tip counts or branch support information."},
"interp-missing-motif-sites": {"zh": "缺少每个 motif 的位点分布表,不能写成员级 motif 排列。", "en": "Missing per-motif site distribution table; cannot write member-level motif arrangement."},
"interp-motif-partial": {"zh": "motif 阶段存在部分成功,seqlogo 或辅助图件等子任务应作为缺口处理。", "en": "Motif stage partially succeeded; subtasks such as seqlogo or auxiliary figures should be treated as gaps."},
"interp-missing-domain": {"zh": "缺少可解析的主要结构域分布。", "en": "Missing parseable major domain distribution."},
"interp-missing-structure": {"zh": "缺少结构原始表基因级计数,组内 exon/intron 模式应降级。", "en": "Missing gene-level counts from raw structure table; within-group exon/intron patterns should be downgraded."},
"interp-generic-template": {"zh": "该阶段使用通用模板,不能替代领域特异 Results 解读。", "en": "This stage uses a generic template; cannot substitute for domain-specific Results interpretation."},
"interp-missing-evidence": {"zh": "缺少可追溯 evidence 条目,只能描述 manifest/指标层结果。", "en": "Missing traceable evidence entries; only manifest/metric-level results can be described."},
"interp-status-downgrade": {"zh": "阶段状态为 {status},需要降级解释。", "en": "Stage status is {status}; interpretation needs downgrading."},
"interp-high-risk-conflict": {"zh": "存在 high risk 证据冲突,不能写成可发表结果。", "en": "High-risk evidence conflicts exist; cannot be written as publishable results."},
"interp-risk-caveat": {"zh": "存在风险提示,解释需保留边界。", "en": "Risk caveats exist; interpretation must retain boundaries."},
}
# ── 兼容映射:旧 _MSG 中文 key → 新 key ──
_LEGACY_MSG_MAP: dict[str, str] = {
"✅ 所有分析阶段已完成!": "status-completed",
"📋 自动规划剩余分析阶段": "status-auto-plan",
"**已完成**": "status-completed-label",
"无": "status-none",
"**待执行**": "status-pending",
"个阶段)": "status-stage-count",
"请确认是否按顺序执行以上分析阶段?": "confirm-execute-stages",
"我将帮您执行RNA-seq": "intent-rnaseq-execute",
"分析。请确认参数后开始。": "intent-confirm-start",
"RNA-seq分析将通过前端异步执行。": "intent-rnaseq-async",
" 分析。PlanningAgentV2 已根据当前状态生成完整执行计划。": "intent-planning-v2-plan",
"我将帮您执行": "intent-will-execute",
"分析。": "intent-analysis-suffix",
"请提供基因家族蛋白序列文件(.fa/.fasta),用于MEME保守基序预测。": "guidance-motif",
"请提供config.xlsx及基因组/GFF/CDS/PEP等原始文件,用于完整数据准备。": "guidance-genome-prepare",
"请提供基因家族蛋白序列文件,用于Pfam/InterPro结构域注释。": "guidance-domain",
"请提供基因家族的GFF注释文件和基因组序列。": "guidance-structure",
"请提供基因家族成员的启动子序列(上游2000bp)或全基因组序列+GFF。": "guidance-promoter",
"请提供物种基因组序列(.fasta)和GFF注释文件。": "guidance-synteny",
"请提供多个物种的基因组序列和GFF注释文件,以及物种间的同源关系。": "guidance-interspecies-synteny",
"请提供染色体长度信息和基因位置信息。": "guidance-karyotype",
"请提供拟南芥同源基因映射文件(ortholog_pairs.txt,格式:拟南芥ID\\t苦荞ID),用于STRING数据库互作预测。如未提供,请先运行同源基因识别分析。": "guidance-ppi",
"请提供目标物种和参考物种(如拟南芥At)的蛋白序列文件,用于同源基因识别。": "guidance-ortholog",
"请提供物种间同源基因对(ortholog pairs,格式:基因A\\t基因B)或共线性分析结果。": "guidance-kaks",
"请提供RNA-seq表达矩阵(FPKM/TPM/Count)或原始测序数据。": "guidance-expression",
"请提供差异表达基因列表(DEGs)或目标基因集。": "guidance-enrichment",
"请提供基因家族蛋白序列文件,用于理化性质分析。": "guidance-pep",
"请提供基因家族HMM文件和蛋白序列文件,将自动执行标准11阶段分析。": "guidance-combo",
"请提供RNA-seq原始测序数据(FASTQ格式)。": "guidance-rna-seq-qc",
"请提供质控后的clean reads(FASTQ格式)和参考基因组。": "guidance-rna-seq-mapping",
"请提供比对后的BAM文件或参考基因组注释GFF。": "guidance-rna-seq-quantification",
"请提供featureCounts计数矩阵和样本分组表,用于VST、PCA、样本相关性和聚类。": "guidance-rnaseq-sample-qc",
"请提供多时相表达矩阵(如不同发育阶段/处理时间点)。": "guidance-trend",
"请提供VST/log2表达矩阵或count矩阵和样本性状表,用于共表达网络构建。": "guidance-rnaseq-wgcna",
"请提供差异表达结果和gene2go背景文件,或先执行背景注释。": "guidance-rnaseq-go-enrich",
"请提供差异表达结果和gene2ko背景文件,或先执行背景注释。": "guidance-rnaseq-kegg-enrich",
"请提供差异表达排序统计量和gene2ko/KEGG背景,用于fgsea排序富集。": "guidance-rnaseq-fgsea",
"请提供差异表达结果和目标物种蛋白FASTA;若已有InterProScan TSV会优先复用。": "guidance-rnaseq-candidate-family",
"请提供表达矩阵(样本数≥6),用于共表达网络构建。": "guidance-wgcna",
"你是BotanicalBaseAgent基因家族分析系统的知识助手。基于提供的文献资料,生成专业、详细的回答。": "knowledge-system-prompt",
"📚 基于知识库的回答:": "knowledge-answer-label",
"**参考文献**:": "knowledge-refs-label",
"(来源: 本地LLM回答 + RAG辅助检索)": "knowledge-local-rag-source",
"⚠️ (本地LLM回答,未使用RAG文献检索)": "knowledge-local-no-rag",
"找到": "knowledge-found",
"条相关文献,正在生成本地LLM回答...": "knowledge-generating",
"未找到相关文献,生成一般回答": "knowledge-no-refs",
"你是一个专业的基因家族分析意图识别器。": "intent-recognizer-prompt",
"你是一个基因家族分析专家。用户想要进行基因家族分析。": "intent-expert-prompt",
}
# ── API ──────────────────────────────────────────────
def t(key: str, lang: str = "zh", **params) -> str:
"""获取翻译文本,支持参数替换.
Args:
key: I18N_MAP 中的 key
lang: "zh" 或 "en"
**params: 替换 {param_name} 占位符
Returns:
翻译后的文本;若 key 不存在则返回 "⚠key"
"""
entry = I18N_MAP.get(key, {})
text = entry.get(lang) or entry.get("zh") or f"⚠{key}"
if params:
text = text.format(**params)
return text
def t_legacy(zh_text: str, lang: str = "zh") -> str:
"""兼容旧 orchestrator._l() 的调用方式:用中文文本查找翻译.
优先查 _LEGACY_MSG_MAP → 新 I18N_MAP,找不到做部分匹配,最后回退到原中文。
"""
if lang == "zh":
return zh_text
new_key = _LEGACY_MSG_MAP.get(zh_text)
if new_key:
return t(new_key, lang)
# fallback: partial match
for legacy_zh, mapped_key in _LEGACY_MSG_MAP.items():
if legacy_zh in zh_text:
translated_part = t(mapped_key, lang)
return zh_text.replace(legacy_zh, translated_part)
return zh_text
def validate_i18n_coverage() -> list[str]:
"""返回所有缺少 en 翻译的 key."""
return [k for k, v in I18N_MAP.items() if "en" not in v]
# ── Key 命名规范 ──
# 阶段名称: stage-name-{id}
# 状态消息: status-{state}
# 会话: session-{action}
# 文件操作: file-{action}
# 错误/验证: error-{context} / validation-{context}
# 诊断/修复: diag-{context} / fix-{context}
# 报告: report-{stage}-{type}
# GWAS: gwas-{action}
# 方法学: methodology-{action}
# 亚家族: subfamily-{action}
# 扩展阶段: extension-{action}
# 解读证据: evidence-{stage}-{type}