Refactor test cases for improved readability and consistency
- Added blank lines for better separation of test cases in multiple test files. - Reformatted event handling in tests for clarity and consistency. - Ensured consistent use of multi-line formatting for dictionary arguments in event handling. - Improved assertions and test descriptions for better understanding. - Updated test cases across various modules including test_stream_state, test_stream_utils, test_summarization, test_thread_selector, test_tool_error_handler, test_tui_widgets, test_ui_runtime, and test_wechat_channel.
This commit is contained in:
@@ -68,8 +68,10 @@ class EvoScientistConfig:
|
||||
siliconflow_api_key: str = ""
|
||||
openrouter_api_key: str = ""
|
||||
zhipu_api_key: str = ""
|
||||
custom_api_key: str = ""
|
||||
custom_base_url: str = ""
|
||||
custom_openai_api_key: str = ""
|
||||
custom_openai_base_url: str = ""
|
||||
custom_anthropic_api_key: str = ""
|
||||
custom_anthropic_base_url: str = ""
|
||||
ollama_base_url: str = ""
|
||||
tavily_api_key: str = ""
|
||||
|
||||
@@ -339,8 +341,10 @@ _ENV_MAPPINGS = {
|
||||
"siliconflow_api_key": "SILICONFLOW_API_KEY",
|
||||
"openrouter_api_key": "OPENROUTER_API_KEY",
|
||||
"zhipu_api_key": "ZHIPU_API_KEY",
|
||||
"custom_api_key": "CUSTOM_API_KEY",
|
||||
"custom_base_url": "CUSTOM_BASE_URL",
|
||||
"custom_openai_api_key": "CUSTOM_OPENAI_API_KEY",
|
||||
"custom_openai_base_url": "CUSTOM_OPENAI_BASE_URL",
|
||||
"custom_anthropic_api_key": "CUSTOM_ANTHROPIC_API_KEY",
|
||||
"custom_anthropic_base_url": "CUSTOM_ANTHROPIC_BASE_URL",
|
||||
"ollama_base_url": "OLLAMA_BASE_URL",
|
||||
"tavily_api_key": "TAVILY_API_KEY",
|
||||
"default_mode": "EVOSCIENTIST_DEFAULT_MODE",
|
||||
@@ -416,10 +420,18 @@ def apply_config_to_env(config: EvoScientistConfig) -> None:
|
||||
os.environ["OPENROUTER_API_KEY"] = config.openrouter_api_key
|
||||
if config.zhipu_api_key and not os.environ.get("ZHIPU_API_KEY"):
|
||||
os.environ["ZHIPU_API_KEY"] = config.zhipu_api_key
|
||||
if config.custom_api_key and not os.environ.get("CUSTOM_API_KEY"):
|
||||
os.environ["CUSTOM_API_KEY"] = config.custom_api_key
|
||||
if config.custom_base_url and not os.environ.get("CUSTOM_BASE_URL"):
|
||||
os.environ["CUSTOM_BASE_URL"] = config.custom_base_url
|
||||
if config.custom_openai_api_key and not os.environ.get("CUSTOM_OPENAI_API_KEY"):
|
||||
os.environ["CUSTOM_OPENAI_API_KEY"] = config.custom_openai_api_key
|
||||
if config.custom_openai_base_url and not os.environ.get("CUSTOM_OPENAI_BASE_URL"):
|
||||
os.environ["CUSTOM_OPENAI_BASE_URL"] = config.custom_openai_base_url
|
||||
if config.custom_anthropic_api_key and not os.environ.get(
|
||||
"CUSTOM_ANTHROPIC_API_KEY"
|
||||
):
|
||||
os.environ["CUSTOM_ANTHROPIC_API_KEY"] = config.custom_anthropic_api_key
|
||||
if config.custom_anthropic_base_url and not os.environ.get(
|
||||
"CUSTOM_ANTHROPIC_BASE_URL"
|
||||
):
|
||||
os.environ["CUSTOM_ANTHROPIC_BASE_URL"] = config.custom_anthropic_base_url
|
||||
if config.ollama_base_url and not os.environ.get("OLLAMA_BASE_URL"):
|
||||
os.environ["OLLAMA_BASE_URL"] = config.ollama_base_url
|
||||
if config.tavily_api_key and not os.environ.get("TAVILY_API_KEY"):
|
||||
|
||||
Reference in New Issue
Block a user