feat(i18n): replace remaining hardcoded Chinese in progress callbacks
This commit is contained in:
parent
da2490ec31
commit
592ee52f59
|
|
@ -20,7 +20,7 @@ from zep_cloud.client import Zep
|
||||||
|
|
||||||
from ..config import Config
|
from ..config import Config
|
||||||
from ..utils.logger import get_logger
|
from ..utils.logger import get_logger
|
||||||
from ..utils.locale import get_language_instruction
|
from ..utils.locale import get_language_instruction, t
|
||||||
from .zep_entity_reader import EntityNode, ZepEntityReader
|
from .zep_entity_reader import EntityNode, ZepEntityReader
|
||||||
|
|
||||||
logger = get_logger('mirofish.oasis_profile')
|
logger = get_logger('mirofish.oasis_profile')
|
||||||
|
|
@ -314,7 +314,7 @@ class OasisProfileGenerator:
|
||||||
logger.debug(f"跳过Zep检索:未设置graph_id")
|
logger.debug(f"跳过Zep检索:未设置graph_id")
|
||||||
return results
|
return results
|
||||||
|
|
||||||
comprehensive_query = f"关于{entity_name}的所有信息、活动、事件、关系和背景"
|
comprehensive_query = t('progress.zepSearchQuery', name=entity_name)
|
||||||
|
|
||||||
def search_edges():
|
def search_edges():
|
||||||
"""搜索边(事实/关系)- 带重试机制"""
|
"""搜索边(事实/关系)- 带重试机制"""
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ from openai import OpenAI
|
||||||
|
|
||||||
from ..config import Config
|
from ..config import Config
|
||||||
from ..utils.logger import get_logger
|
from ..utils.logger import get_logger
|
||||||
from ..utils.locale import get_language_instruction
|
from ..utils.locale import get_language_instruction, t
|
||||||
from .zep_entity_reader import EntityNode, ZepEntityReader
|
from .zep_entity_reader import EntityNode, ZepEntityReader
|
||||||
|
|
||||||
logger = get_logger('mirofish.simulation_config')
|
logger = get_logger('mirofish.simulation_config')
|
||||||
|
|
@ -293,14 +293,14 @@ class SimulationConfigGenerator:
|
||||||
reasoning_parts = []
|
reasoning_parts = []
|
||||||
|
|
||||||
# ========== 步骤1: 生成时间配置 ==========
|
# ========== 步骤1: 生成时间配置 ==========
|
||||||
report_progress(1, "生成时间配置...")
|
report_progress(1, t('progress.generatingTimeConfig'))
|
||||||
num_entities = len(entities)
|
num_entities = len(entities)
|
||||||
time_config_result = self._generate_time_config(context, num_entities)
|
time_config_result = self._generate_time_config(context, num_entities)
|
||||||
time_config = self._parse_time_config(time_config_result, num_entities)
|
time_config = self._parse_time_config(time_config_result, num_entities)
|
||||||
reasoning_parts.append(f"时间配置: {time_config_result.get('reasoning', '成功')}")
|
reasoning_parts.append(f"时间配置: {time_config_result.get('reasoning', '成功')}")
|
||||||
|
|
||||||
# ========== 步骤2: 生成事件配置 ==========
|
# ========== 步骤2: 生成事件配置 ==========
|
||||||
report_progress(2, "生成事件配置和热点话题...")
|
report_progress(2, t('progress.generatingEventConfig'))
|
||||||
event_config_result = self._generate_event_config(context, simulation_requirement, entities)
|
event_config_result = self._generate_event_config(context, simulation_requirement, entities)
|
||||||
event_config = self._parse_event_config(event_config_result)
|
event_config = self._parse_event_config(event_config_result)
|
||||||
reasoning_parts.append(f"事件配置: {event_config_result.get('reasoning', '成功')}")
|
reasoning_parts.append(f"事件配置: {event_config_result.get('reasoning', '成功')}")
|
||||||
|
|
@ -314,7 +314,7 @@ class SimulationConfigGenerator:
|
||||||
|
|
||||||
report_progress(
|
report_progress(
|
||||||
3 + batch_idx,
|
3 + batch_idx,
|
||||||
f"生成Agent配置 ({start_idx + 1}-{end_idx}/{len(entities)})..."
|
t('progress.generatingAgentConfig', start=start_idx + 1, end=end_idx, total=len(entities))
|
||||||
)
|
)
|
||||||
|
|
||||||
batch_configs = self._generate_agent_configs_batch(
|
batch_configs = self._generate_agent_configs_batch(
|
||||||
|
|
@ -334,7 +334,7 @@ class SimulationConfigGenerator:
|
||||||
reasoning_parts.append(f"初始帖子分配: {assigned_count} 个帖子已分配发布者")
|
reasoning_parts.append(f"初始帖子分配: {assigned_count} 个帖子已分配发布者")
|
||||||
|
|
||||||
# ========== 最后一步: 生成平台配置 ==========
|
# ========== 最后一步: 生成平台配置 ==========
|
||||||
report_progress(total_steps, "生成平台配置...")
|
report_progress(total_steps, t('progress.generatingPlatformConfig'))
|
||||||
twitter_config = None
|
twitter_config = None
|
||||||
reddit_config = None
|
reddit_config = None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ class SimulationManager:
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(
|
progress_callback(
|
||||||
"generating_profiles", 95,
|
"generating_profiles", 95,
|
||||||
"保存Profile文件...",
|
t('progress.savingProfiles'),
|
||||||
current=total_entities,
|
current=total_entities,
|
||||||
total=total_entities
|
total=total_entities
|
||||||
)
|
)
|
||||||
|
|
@ -376,7 +376,7 @@ class SimulationManager:
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(
|
progress_callback(
|
||||||
"generating_profiles", 100,
|
"generating_profiles", 100,
|
||||||
f"完成,共 {len(profiles)} 个Profile",
|
t('progress.profilesComplete', count=len(profiles)),
|
||||||
current=len(profiles),
|
current=len(profiles),
|
||||||
total=len(profiles)
|
total=len(profiles)
|
||||||
)
|
)
|
||||||
|
|
@ -385,7 +385,7 @@ class SimulationManager:
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(
|
progress_callback(
|
||||||
"generating_config", 0,
|
"generating_config", 0,
|
||||||
"正在分析模拟需求...",
|
t('progress.analyzingRequirements'),
|
||||||
current=0,
|
current=0,
|
||||||
total=3
|
total=3
|
||||||
)
|
)
|
||||||
|
|
@ -395,7 +395,7 @@ class SimulationManager:
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(
|
progress_callback(
|
||||||
"generating_config", 30,
|
"generating_config", 30,
|
||||||
"正在调用LLM生成配置...",
|
t('progress.callingLLMConfig'),
|
||||||
current=1,
|
current=1,
|
||||||
total=3
|
total=3
|
||||||
)
|
)
|
||||||
|
|
@ -414,7 +414,7 @@ class SimulationManager:
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(
|
progress_callback(
|
||||||
"generating_config", 70,
|
"generating_config", 70,
|
||||||
"正在保存配置文件...",
|
t('progress.savingConfigFiles'),
|
||||||
current=2,
|
current=2,
|
||||||
total=3
|
total=3
|
||||||
)
|
)
|
||||||
|
|
@ -430,7 +430,7 @@ class SimulationManager:
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(
|
progress_callback(
|
||||||
"generating_config", 100,
|
"generating_config", 100,
|
||||||
"配置生成完成",
|
t('progress.configComplete'),
|
||||||
current=3,
|
current=3,
|
||||||
total=3
|
total=3
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,17 @@
|
||||||
"sectionDone": "Section {title} complete",
|
"sectionDone": "Section {title} complete",
|
||||||
"assemblingReport": "Assembling full report...",
|
"assemblingReport": "Assembling full report...",
|
||||||
"reportComplete": "Report generation complete",
|
"reportComplete": "Report generation complete",
|
||||||
"reportFailed": "Report generation failed: {error}"
|
"reportFailed": "Report generation failed: {error}",
|
||||||
|
"savingProfiles": "Saving profile files...",
|
||||||
|
"profilesComplete": "Done, {count} profiles generated",
|
||||||
|
"callingLLMConfig": "Calling LLM to generate config...",
|
||||||
|
"savingConfigFiles": "Saving config files...",
|
||||||
|
"configComplete": "Config generation complete",
|
||||||
|
"generatingTimeConfig": "Generating time config...",
|
||||||
|
"generatingEventConfig": "Generating event config and hot topics...",
|
||||||
|
"generatingAgentConfig": "Generating agent config ({start}-{end}/{total})...",
|
||||||
|
"generatingPlatformConfig": "Generating platform config...",
|
||||||
|
"zepSearchQuery": "All information, activities, events, relationships and background about {name}"
|
||||||
},
|
},
|
||||||
"log": {
|
"log": {
|
||||||
"preparingGoBack": "Preparing to return to Step 2, closing simulation...",
|
"preparingGoBack": "Preparing to return to Step 2, closing simulation...",
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,17 @@
|
||||||
"sectionDone": "章节 {title} 已完成",
|
"sectionDone": "章节 {title} 已完成",
|
||||||
"assemblingReport": "正在组装完整报告...",
|
"assemblingReport": "正在组装完整报告...",
|
||||||
"reportComplete": "报告生成完成",
|
"reportComplete": "报告生成完成",
|
||||||
"reportFailed": "报告生成失败: {error}"
|
"reportFailed": "报告生成失败: {error}",
|
||||||
|
"savingProfiles": "保存Profile文件...",
|
||||||
|
"profilesComplete": "完成,共 {count} 个Profile",
|
||||||
|
"callingLLMConfig": "正在调用LLM生成配置...",
|
||||||
|
"savingConfigFiles": "正在保存配置文件...",
|
||||||
|
"configComplete": "配置生成完成",
|
||||||
|
"generatingTimeConfig": "生成时间配置...",
|
||||||
|
"generatingEventConfig": "生成事件配置和热点话题...",
|
||||||
|
"generatingAgentConfig": "生成Agent配置 ({start}-{end}/{total})...",
|
||||||
|
"generatingPlatformConfig": "生成平台配置...",
|
||||||
|
"zepSearchQuery": "关于{name}的所有信息、活动、事件、关系和背景"
|
||||||
},
|
},
|
||||||
"log": {
|
"log": {
|
||||||
"preparingGoBack": "准备返回 Step 2,正在关闭模拟...",
|
"preparingGoBack": "准备返回 Step 2,正在关闭模拟...",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue