Skip to content

Commit 3330057

Browse files
ryaneggzclaude
andcommitted
fix: address Phase 0 review — rename CustomSSEEvent, add Bedrock context windows, debug guards
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: ryaneggz <kre8mymedia@gmail.com>
1 parent 1356f43 commit 3330057

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

backend/src/constants/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,6 @@ def values(cls) -> list[str]:
135135
# Thread Search
136136
# Number of recent messages to store per thread snapshot for semantic search
137137
THREAD_SNAPSHOT_MESSAGE_COUNT = 20
138+
139+
# Phase enum
140+
from src.constants.phases import AgentPhase # noqa: E402, F401

backend/src/constants/llm.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,25 @@ def _safe_int_env(var_name: str, default: int) -> int:
233233
# Groq
234234
"groq:openai/gpt-oss-120b": 128_000,
235235
"groq:llama-3.3-70b-versatile": 128_000,
236+
# Bedrock
237+
"bedrock_converse:us.anthropic.claude-sonnet-4-5-20250929-v1:0": 200_000,
238+
"bedrock_converse:us.anthropic.claude-haiku-4-5-20251001-v1:0": 200_000,
239+
"bedrock_converse:us.anthropic.claude-opus-4-5-20251101-v1:0": 200_000,
240+
"bedrock_converse:us.moonshot.kimi-k2-thinking": 131_072,
241+
"bedrock_converse:us.anthropic.claude-3-5-sonnet-20241022-v2:0": 200_000,
242+
"bedrock_converse:us.anthropic.claude-3-5-haiku-20241022-v1:0": 200_000,
243+
"bedrock_converse:amazon.titan-text-premier-v1:0": 32_768,
244+
"bedrock_converse:us.meta.llama3-2-90b-instruct-v1:0": 128_000,
245+
"bedrock_converse:us.mistral.mistral-large-2407-v1:0": 128_000,
236246
}
237247

238248
DEFAULT_CONTEXT_WINDOW = 200_000 # Fallback for unknown models
239249

240250

241251
def get_context_window(model: str) -> int:
242252
"""Get context window size for a model, with fallback."""
243-
return MODEL_CONTEXT_WINDOWS.get(model, DEFAULT_CONTEXT_WINDOW)
253+
size = MODEL_CONTEXT_WINDOWS.get(model)
254+
if size is None:
255+
logger.debug(f"context_window_fallback model={model} using default={DEFAULT_CONTEXT_WINDOW}")
256+
return DEFAULT_CONTEXT_WINDOW
257+
return size

frontend/src/hooks/useChat.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,11 @@ export default function useChat(): ChatContextType {
727727
}
728728

729729
if (streamMode === "custom") {
730-
// Custom events dispatched by feature-specific handlers
730+
// Custom events dispatched by Phase 1+ feature handlers
731731
// Sub-types: cost_update, plan_status, eval_progress, context_reset, span
732-
console.debug("[custom event]", payload[1]);
732+
if (import.meta.env.DEV) {
733+
console.debug("[custom event]", payload[1]);
734+
}
733735
return;
734736
}
735737

frontend/src/lib/entities/stream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export interface AbortedEvent {
6464
data: { reason: string };
6565
}
6666

67-
export interface CustomEvent {
67+
export interface CustomSSEEvent {
6868
type: "custom";
6969
data: {
7070
type: string; // Sub-type: "cost_update", "plan_status", "eval_progress", etc.
@@ -86,7 +86,7 @@ export type SSEEvent =
8686
| ValuesEvent
8787
| ErrorEvent
8888
| AbortedEvent
89-
| CustomEvent;
89+
| CustomSSEEvent;
9090

9191
export interface DoneSignal {
9292
type: "done";

0 commit comments

Comments
 (0)