diff --git a/backend/app/services/oasis_profile_generator.py b/backend/app/services/oasis_profile_generator.py index cac49f7..e4d9e9a 100644 --- a/backend/app/services/oasis_profile_generator.py +++ b/backend/app/services/oasis_profile_generator.py @@ -277,9 +277,9 @@ class OasisProfileGenerator: """Generate a username from the entity name""" # Keep Unicode characters (Thai, Chinese, etc) and convert to lowercase username = name.lower().replace(" ", "_") - # Only remove truly problematic characters for usernames + # Remove characters that are NOT: Thai (\u0E00-\u0E7F), ASCII alphanumeric, or underscore import re - username = re.sub(r'[^\w]', '', username, flags=re.UNICODE) + username = re.sub(r'[^\u0E00-\u0E7Fa-zA-Z0-9_]', '', username) # Add random suffix to avoid duplicates suffix = random.randint(100, 999) diff --git a/backend/scripts/run_parallel_simulation.py b/backend/scripts/run_parallel_simulation.py index e3774e1..898d520 100644 --- a/backend/scripts/run_parallel_simulation.py +++ b/backend/scripts/run_parallel_simulation.py @@ -1028,6 +1028,7 @@ def create_model(config: Dict[str, Any], use_boost: bool = False): if llm_base_url: os.environ["OPENAI_BASE_URL"] = llm_base_url + os.environ["OPENAI_API_BASE_URL"] = llm_base_url print(f"{config_label} model={llm_model}, base_url={llm_base_url[:40] if llm_base_url else '默认'}...") diff --git a/backend/scripts/run_reddit_simulation.py b/backend/scripts/run_reddit_simulation.py index 803bc66..156db9d 100644 --- a/backend/scripts/run_reddit_simulation.py +++ b/backend/scripts/run_reddit_simulation.py @@ -458,6 +458,7 @@ class RedditSimulationRunner: if llm_base_url: os.environ["OPENAI_BASE_URL"] = llm_base_url + os.environ["OPENAI_API_BASE_URL"] = llm_base_url print(f"LLM配置: model={llm_model}, base_url={llm_base_url[:40] if llm_base_url else '默认'}...") diff --git a/backend/scripts/run_twitter_simulation.py b/backend/scripts/run_twitter_simulation.py index 34d50dd..4c886ff 100644 --- a/backend/scripts/run_twitter_simulation.py +++ b/backend/scripts/run_twitter_simulation.py @@ -451,6 +451,7 @@ class TwitterSimulationRunner: if llm_base_url: os.environ["OPENAI_BASE_URL"] = llm_base_url + os.environ["OPENAI_API_BASE_URL"] = llm_base_url print(f"LLM配置: model={llm_model}, base_url={llm_base_url[:40] if llm_base_url else '默认'}...")