mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-02-01 06:53:36 +00:00
fix: use ANTHROPIC_DEFAULT_OPUS_MODEL env var for model selection
The model was hardcoded to "claude-opus-4-5-20251101" in chat session services, ignoring the ANTHROPIC_DEFAULT_OPUS_MODEL environment variable. This caused issues when using alternative API providers (e.g., GLM via z.ai) that don't support Claude model names. Fixes #51 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -255,10 +255,14 @@ class AssistantChatSession:
|
|||||||
# Build environment overrides for API configuration
|
# Build environment overrides for API configuration
|
||||||
sdk_env = {var: os.getenv(var) for var in API_ENV_VARS if os.getenv(var)}
|
sdk_env = {var: os.getenv(var) for var in API_ENV_VARS if os.getenv(var)}
|
||||||
|
|
||||||
|
# Determine model from environment or use default
|
||||||
|
# This allows using alternative APIs (e.g., GLM via z.ai) that may not support Claude model names
|
||||||
|
model = os.getenv("ANTHROPIC_DEFAULT_OPUS_MODEL", "claude-opus-4-5-20251101")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.client = ClaudeSDKClient(
|
self.client = ClaudeSDKClient(
|
||||||
options=ClaudeAgentOptions(
|
options=ClaudeAgentOptions(
|
||||||
model="claude-opus-4-5-20251101",
|
model=model,
|
||||||
cli_path=system_cli,
|
cli_path=system_cli,
|
||||||
# System prompt loaded from CLAUDE.md via setting_sources
|
# System prompt loaded from CLAUDE.md via setting_sources
|
||||||
# This avoids Windows command line length limit (~8191 chars)
|
# This avoids Windows command line length limit (~8191 chars)
|
||||||
|
|||||||
@@ -167,11 +167,15 @@ class ExpandChatSession:
|
|||||||
# Build environment overrides for API configuration
|
# Build environment overrides for API configuration
|
||||||
sdk_env = {var: os.getenv(var) for var in API_ENV_VARS if os.getenv(var)}
|
sdk_env = {var: os.getenv(var) for var in API_ENV_VARS if os.getenv(var)}
|
||||||
|
|
||||||
|
# Determine model from environment or use default
|
||||||
|
# This allows using alternative APIs (e.g., GLM via z.ai) that may not support Claude model names
|
||||||
|
model = os.getenv("ANTHROPIC_DEFAULT_OPUS_MODEL", "claude-opus-4-5-20251101")
|
||||||
|
|
||||||
# Create Claude SDK client
|
# Create Claude SDK client
|
||||||
try:
|
try:
|
||||||
self.client = ClaudeSDKClient(
|
self.client = ClaudeSDKClient(
|
||||||
options=ClaudeAgentOptions(
|
options=ClaudeAgentOptions(
|
||||||
model="claude-opus-4-5-20251101",
|
model=model,
|
||||||
cli_path=system_cli,
|
cli_path=system_cli,
|
||||||
system_prompt=system_prompt,
|
system_prompt=system_prompt,
|
||||||
allowed_tools=[
|
allowed_tools=[
|
||||||
|
|||||||
@@ -169,10 +169,14 @@ class SpecChatSession:
|
|||||||
# Build environment overrides for API configuration
|
# Build environment overrides for API configuration
|
||||||
sdk_env = {var: os.getenv(var) for var in API_ENV_VARS if os.getenv(var)}
|
sdk_env = {var: os.getenv(var) for var in API_ENV_VARS if os.getenv(var)}
|
||||||
|
|
||||||
|
# Determine model from environment or use default
|
||||||
|
# This allows using alternative APIs (e.g., GLM via z.ai) that may not support Claude model names
|
||||||
|
model = os.getenv("ANTHROPIC_DEFAULT_OPUS_MODEL", "claude-opus-4-5-20251101")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.client = ClaudeSDKClient(
|
self.client = ClaudeSDKClient(
|
||||||
options=ClaudeAgentOptions(
|
options=ClaudeAgentOptions(
|
||||||
model="claude-opus-4-5-20251101",
|
model=model,
|
||||||
cli_path=system_cli,
|
cli_path=system_cli,
|
||||||
# System prompt loaded from CLAUDE.md via setting_sources
|
# System prompt loaded from CLAUDE.md via setting_sources
|
||||||
# This avoids Windows command line length limit (~8191 chars)
|
# This avoids Windows command line length limit (~8191 chars)
|
||||||
|
|||||||
Reference in New Issue
Block a user