Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,11 @@ def custom_provider_factory(api_key=None):
if registered_providers:
logger.info(f"Registered providers: {', '.join(registered_providers)}")

# Require at least one valid provider
if not valid_providers:
# Check if any enabled tools require LLM providers
llm_tools_active = {name for name, tool in TOOLS.items() if tool.requires_model()}

# Require at least one valid provider only if LLM tools are enabled
if not valid_providers and llm_tools_active:
raise ValueError(
"At least one API configuration is required. Please set either:\n"
"- GEMINI_API_KEY for Gemini models\n"
Expand All @@ -551,6 +554,11 @@ def custom_provider_factory(api_key=None):
"- OPENROUTER_API_KEY for OpenRouter (multiple models)\n"
"- CUSTOM_API_URL for local models (Ollama, vLLM, etc.)"
)
elif not valid_providers:
non_llm_names = sorted(set(TOOLS.keys()) - llm_tools_active)
logger.warning(
f"No API providers configured. Only non-LLM tools ({', '.join(non_llm_names)}) will be available."
)

logger.info(f"Available providers: {', '.join(valid_providers)}")

Expand Down Expand Up @@ -614,7 +622,7 @@ def cleanup_providers():
# Check if auto mode has any models available after restrictions
from config import IS_AUTO_MODE

if IS_AUTO_MODE:
if IS_AUTO_MODE and llm_tools_active:
available_models = ModelProviderRegistry.get_available_models(respect_restrictions=True)
if not available_models:
logger.error(
Expand All @@ -625,6 +633,8 @@ def cleanup_providers():
"No models available for auto mode due to restrictions. "
"Please adjust your allowed model settings or disable auto mode."
)
elif IS_AUTO_MODE and not llm_tools_active:
logger.info("Auto mode skipped - no LLM tools are active.")


@server.list_tools()
Expand Down
1 change: 0 additions & 1 deletion simulator_tests/test_chat_simple_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
- Conversation context preservation across turns
"""


from .conversation_base_test import ConversationBaseTest


Expand Down
1 change: 0 additions & 1 deletion simulator_tests/test_conversation_chain_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
- Properly traverse parent relationships for history reconstruction
"""


from .conversation_base_test import ConversationBaseTest


Expand Down
1 change: 0 additions & 1 deletion simulator_tests/test_cross_tool_comprehensive.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
5. Proper tool chaining with context
"""


from .conversation_base_test import ConversationBaseTest


Expand Down
1 change: 0 additions & 1 deletion simulator_tests/test_ollama_custom_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
- Model alias resolution for local models
"""


from .base_test import BaseSimulatorTest


Expand Down
1 change: 0 additions & 1 deletion simulator_tests/test_openrouter_fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
- Auto mode correctly selects OpenRouter models
"""


from .base_test import BaseSimulatorTest


Expand Down
1 change: 0 additions & 1 deletion simulator_tests/test_openrouter_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
- Error handling when models are not available
"""


from .base_test import BaseSimulatorTest


Expand Down
1 change: 0 additions & 1 deletion simulator_tests/test_xai_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
- API integration and response validation
"""


from .base_test import BaseSimulatorTest


Expand Down
12 changes: 4 additions & 8 deletions tests/test_directory_expansion_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,23 @@ def temp_directory_with_files(self, project_path):
files = []
for i in range(5):
swift_file = temp_path / f"File{i}.swift"
swift_file.write_text(
f"""
swift_file.write_text(f"""
import Foundation

class TestClass{i} {{
func testMethod{i}() -> String {{
return "test{i}"
}}
}}
"""
)
""")
files.append(str(swift_file))

# Create a Python file as well
python_file = temp_path / "helper.py"
python_file.write_text(
"""
python_file.write_text("""
def helper_function():
return "helper"
"""
)
""")
files.append(str(python_file))

try:
Expand Down
6 changes: 2 additions & 4 deletions tests/test_docker_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,11 @@ def temp_project_dir():

# Create base files
(temp_path / "server.py").write_text("# Mock server.py")
(temp_path / "Dockerfile").write_text(
"""
(temp_path / "Dockerfile").write_text("""
FROM python:3.11-slim
COPY server.py /app/
CMD ["python", "/app/server.py"]
"""
)
""")

yield temp_path

Expand Down
18 changes: 6 additions & 12 deletions tests/test_prompt_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,14 @@ async def test_chat_with_files(self):

# Create a temporary Python file for testing
with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:
f.write(
"""
f.write("""
def hello_world():
\"\"\"A simple hello world function.\"\"\"
return "Hello, World!"

if __name__ == "__main__":
print(hello_world())
"""
)
""")
temp_file = f.name

try:
Expand Down Expand Up @@ -155,8 +153,7 @@ async def test_codereview_normal_review(self):

# Create a temporary Python file for testing
with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:
f.write(
"""
f.write("""
def process_user_input(user_input):
# Potentially unsafe code for demonstration
query = f"SELECT * FROM users WHERE name = '{user_input}'"
Expand All @@ -166,8 +163,7 @@ def main():
user_name = input("Enter name: ")
result = process_user_input(user_name)
print(result)
"""
)
""")
temp_file = f.name

try:
Expand Down Expand Up @@ -241,8 +237,7 @@ async def test_analyze_normal_question(self):

# Create a temporary Python file demonstrating MVC pattern
with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:
f.write(
"""
f.write("""
# Model
class User:
def __init__(self, name, email):
Expand All @@ -262,8 +257,7 @@ def __init__(self, model, view):

def get_user_display(self):
return self.view.display_user(self.model)
"""
)
""")
temp_file = f.name

try:
Expand Down