fix: translate Chinese prompts to English in simulation config and profile generators
- simulation_config_generator.py: translate all LLM prompts and system messages - oasis_profile_generator.py: translate profile generation prompts Ensures get_language_instruction() controls output language instead of being overridden by Chinese prompt context.
This commit is contained in:
@@ -671,7 +671,7 @@ class OasisProfileGenerator:
|
||||
|
||||
def _get_system_prompt(self, is_individual: bool) -> str:
|
||||
"""获取系统提示词"""
|
||||
base_prompt = "你是社交媒体用户画像生成专家。生成详细、真实的人设用于舆论模拟,最大程度还原已有现实情况。必须返回有效的JSON格式,所有字符串值不能包含未转义的换行符。"
|
||||
base_prompt = "You are a social media user persona generation expert. Generate detailed, realistic personas for opinion simulation, maximizing fidelity to real-world situations. Must return valid JSON format, all string values must not contain unescaped newlines."
|
||||
return f"{base_prompt}\n\n{get_language_instruction()}"
|
||||
|
||||
def _build_individual_persona_prompt(
|
||||
@@ -687,7 +687,7 @@ class OasisProfileGenerator:
|
||||
attrs_str = json.dumps(entity_attributes, ensure_ascii=False) if entity_attributes else "无"
|
||||
context_str = context[:3000] if context else "无额外上下文"
|
||||
|
||||
return f"""为实体生成详细的社交媒体用户人设,最大程度还原已有现实情况。
|
||||
return f"""Generate detailed social media user persona for the entity, maximizing fidelity to real-world situations.
|
||||
|
||||
实体名称: {entity_name}
|
||||
实体类型: {entity_type}
|
||||
@@ -736,7 +736,7 @@ class OasisProfileGenerator:
|
||||
attrs_str = json.dumps(entity_attributes, ensure_ascii=False) if entity_attributes else "无"
|
||||
context_str = context[:3000] if context else "无额外上下文"
|
||||
|
||||
return f"""为机构/群体实体生成详细的社交媒体账号设定,最大程度还原已有现实情况。
|
||||
return f"""Generate detailed social media account settings for organization/group entity, maximizing fidelity to real-world situations.
|
||||
|
||||
实体名称: {entity_name}
|
||||
实体类型: {entity_type}
|
||||
@@ -769,7 +769,7 @@ class OasisProfileGenerator:
|
||||
- persona必须是一段连贯的文字描述,不要使用换行符
|
||||
- {get_language_instruction()} (gender字段必须用英文"other")
|
||||
- age必须是整数30,gender必须是字符串"other"
|
||||
- 机构账号发言要符合其身份定位"""
|
||||
- Organization account posts must match its identity positioning"""
|
||||
|
||||
def _generate_profile_rule_based(
|
||||
self,
|
||||
@@ -1076,11 +1076,11 @@ class OasisProfileGenerator:
|
||||
- name: 用户真实姓名
|
||||
- username: 系统中的用户名
|
||||
- user_char: 详细人设描述(注入到LLM系统提示中,指导Agent行为)
|
||||
- description: 简短的公开简介(显示在用户资料页面)
|
||||
- description: Short public bio (displayed on user profile page)
|
||||
|
||||
user_char vs description 区别:
|
||||
user_char vs description difference:
|
||||
- user_char: 内部使用,LLM系统提示,决定Agent如何思考和行动
|
||||
- description: 外部显示,其他用户可见的简介
|
||||
- description: Externally displayed, visible to other users
|
||||
"""
|
||||
import csv
|
||||
|
||||
@@ -1112,7 +1112,7 @@ class OasisProfileGenerator:
|
||||
profile.name, # name: 真实姓名
|
||||
profile.user_name, # username: 用户名
|
||||
user_char, # user_char: 完整人设(内部LLM使用)
|
||||
description # description: 简短简介(外部显示)
|
||||
description # description: Short bio (externally displayed)
|
||||
]
|
||||
writer.writerow(row)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user