feat: i18n support - auto-detect system language for zh/en prompts

This commit is contained in:
Liang Jiaqing
2026-04-16 18:47:40 +08:00
parent 47bcb1b01a
commit 7cadbd7403
7 changed files with 56 additions and 20 deletions

5
ga.py
View File

@@ -566,9 +566,10 @@ def get_global_memory():
prompt = "\n"
try:
script_dir = os.path.dirname(os.path.abspath(__file__))
suffix = '_en' if os.environ.get('GA_LANG', '') == 'en' else ''
with open(os.path.join(script_dir, 'memory/global_mem_insight.txt'), 'r', encoding='utf-8', errors='replace') as f: insight = f.read()
with open(os.path.join(script_dir, 'assets/insight_fixed_structure.txt'), 'r', encoding='utf-8') as f: structure = f.read()
prompt += f'cwd = {os.path.join(script_dir, "temp")} (用./引用)\n'
with open(os.path.join(script_dir, f'assets/insight_fixed_structure{suffix}.txt'), 'r', encoding='utf-8') as f: structure = f.read()
prompt += f'cwd = {os.path.join(script_dir, "temp")} (./)\n'
prompt += f"\n[Memory] (../memory)\n"
prompt += structure + '\n../memory/global_mem_insight.txt:\n'
prompt += insight + "\n"