Refactor models and logging for nexus-claude-api

- Update default models in config to use `claude-opus-4.6`.
- Introduce logging configuration to write logs to a file.
- Add correlation ID to error responses for better traceability.
- Implement diagnostics for summarizing message requests.
- Normalize legacy system messages in the API.
- Enhance tests to cover new logging and error handling features.
- Update README and documentation to reflect changes in model defaults and logging behavior.
This commit is contained in:
2026-06-26 22:36:09 +08:00
parent 2851fa01cf
commit 0e98ce57d4
21 changed files with 573 additions and 78 deletions

View File

@@ -19,8 +19,24 @@ def test_claude_code_command() -> None:
command = generate_claude_code_powershell(settings)
assert "ANTHROPIC_BASE_URL" in command
assert "claude-sonnet-4.6" in command
assert command.endswith("claude")
assert "ANTHROPIC_AUTH_TOKEN='dummy'" in command
assert "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY='1'" in command
assert "claude-opus-4.6" in command
assert command.endswith("claude --model claude-opus-4.6")
def test_claude_code_command_uses_custom_model() -> None:
settings = Settings.from_values(
host="127.0.0.1",
port=4141,
api_key="test",
model="claude-opus-4.6",
require_api_key=False,
)
command = generate_claude_code_powershell(settings)
assert command.endswith("claude --model claude-opus-4.6")
def test_missing_api_key_fails(monkeypatch) -> None: