fix: 3 fixes for Step 2, Step 4, Step 5
1. Step 5: Use empty model_config_dict={} so camel-ai doesn't spread
api_key into create() - AsyncOpenAI reads env vars automatically.
Step 3 unaffected (same env vars, just cleaner ModelFactory call).
2. Step 2: Fix Thai text truncation - isalnum() stripped Thai chars.
Use re.sub(r'[^\w]', '', username, re.UNICODE) instead.
3. Step 4: Move get_language_instruction() to START of prompt (not end)
and strengthen wording with MUST/IMPORTANT prefix.
This commit is contained in:
@@ -454,18 +454,13 @@ class TwitterSimulationRunner:
|
||||
|
||||
print(f"LLM配置: model={llm_model}, base_url={llm_base_url[:40] if llm_base_url else '默认'}...")
|
||||
|
||||
# Pass api_key and base_url via model_config_dict
|
||||
# camel-ai extracts these for the OpenAI client constructor
|
||||
model_config = {}
|
||||
if llm_api_key:
|
||||
model_config["api_key"] = llm_api_key
|
||||
if llm_base_url:
|
||||
model_config["base_url"] = llm_base_url
|
||||
# AsyncOpenAI reads OPENAI_API_KEY and OPENAI_BASE_URL from env automatically
|
||||
# Pass empty model_config_dict so nothing is spread to create() call
|
||||
|
||||
return ModelFactory.create(
|
||||
model_platform=ModelPlatformType.OPENAI,
|
||||
model_type=llm_model,
|
||||
model_config_dict=model_config,
|
||||
model_config_dict={},
|
||||
)
|
||||
|
||||
def _get_active_agents_for_round(
|
||||
|
||||
Reference in New Issue
Block a user