Skip to content

Commit 6dab27b

Browse files
committed
error display
1 parent e44ee7e commit 6dab27b

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

backend/src/agent/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ class Configuration(BaseModel):
1616
)
1717

1818
reflection_model: str = Field(
19-
default="gemini-2.5-flash-preview-04-17",
19+
default="gemini-2.5-flash",
2020
metadata={
2121
"description": "The name of the language model to use for the agent's reflection."
2222
},
2323
)
2424

2525
answer_model: str = Field(
26-
default="gemini-2.5-pro-preview-05-06",
26+
default="gemini-2.5-pro",
2727
metadata={
2828
"description": "The name of the language model to use for the agent's answer."
2929
},

backend/src/agent/graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def reflection(state: OverallState, config: RunnableConfig) -> ReflectionState:
153153
configurable = Configuration.from_runnable_config(config)
154154
# Increment the research loop count and get the reasoning model
155155
state["research_loop_count"] = state.get("research_loop_count", 0) + 1
156-
reasoning_model = state.get("reasoning_model") or configurable.reasoning_model
156+
reasoning_model = state.get("reasoning_model", configurable.reflection_model)
157157

158158
# Format the prompt
159159
current_date = get_current_date()
@@ -231,7 +231,7 @@ def finalize_answer(state: OverallState, config: RunnableConfig):
231231
Dictionary with state update, including running_summary key containing the formatted final summary with sources
232232
"""
233233
configurable = Configuration.from_runnable_config(config)
234-
reasoning_model = state.get("reasoning_model") or configurable.reasoning_model
234+
reasoning_model = state.get("reasoning_model") or configurable.answer_model
235235

236236
# Format the prompt
237237
current_date = get_current_date()

frontend/src/App.tsx

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useState, useEffect, useRef, useCallback } from "react";
44
import { ProcessedEvent } from "@/components/ActivityTimeline";
55
import { WelcomeScreen } from "@/components/WelcomeScreen";
66
import { ChatMessagesView } from "@/components/ChatMessagesView";
7+
import { Button } from "@/components/ui/button";
78

89
export default function App() {
910
const [processedEventsTimeline, setProcessedEventsTimeline] = useState<
@@ -14,7 +15,8 @@ export default function App() {
1415
>({});
1516
const scrollAreaRef = useRef<HTMLDivElement>(null);
1617
const hasFinalizeEventOccurredRef = useRef(false);
17-
18+
const [error, setError] = useState<string | null>(null);
19+
console.log(import.meta.env.DEV);
1820
const thread = useStream<{
1921
messages: Message[];
2022
initial_search_query_count: number;
@@ -54,9 +56,10 @@ export default function App() {
5456
title: "Reflection",
5557
data: event.reflection.is_sufficient
5658
? "Search successful, generating final answer."
57-
: `Need more information, searching for ${event.reflection.follow_up_queries?.join(
58-
", "
59-
) || "additional information"}`,
59+
: `Need more information, searching for ${
60+
event.reflection.follow_up_queries?.join(", ") ||
61+
"additional information"
62+
}`,
6063
};
6164
} else if (event.finalize_answer) {
6265
processedEvent = {
@@ -72,6 +75,9 @@ export default function App() {
7275
]);
7376
}
7477
},
78+
onError: (error: any) => {
79+
setError(error.message);
80+
},
7581
});
7682

7783
useEffect(() => {
@@ -166,6 +172,20 @@ export default function App() {
166172
isLoading={thread.isLoading}
167173
onCancel={handleCancel}
168174
/>
175+
) : error ? (
176+
<div className="flex flex-col items-center justify-center h-full">
177+
<div className="flex flex-col items-center justify-center gap-4">
178+
<h1 className="text-2xl text-red-400 font-bold">Error</h1>
179+
<p className="text-red-400">{JSON.stringify(error)}</p>
180+
181+
<Button
182+
variant="destructive"
183+
onClick={() => window.location.reload()}
184+
>
185+
Retry
186+
</Button>
187+
</div>
188+
</div>
169189
) : (
170190
<ChatMessagesView
171191
messages={thread.messages}

frontend/src/components/ChatMessagesView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ const AiMessageBubble: React.FC<AiMessageBubbleProps> = ({
203203
</ReactMarkdown>
204204
<Button
205205
variant="default"
206-
className="cursor-pointer bg-neutral-700 border-neutral-600 text-neutral-300 self-end"
206+
className={`cursor-pointer bg-neutral-700 border-neutral-600 text-neutral-300 self-end ${
207+
message.content.length > 0 ? "visible" : "hidden"
208+
}`}
207209
onClick={() =>
208210
handleCopy(
209211
typeof message.content === "string"
@@ -251,6 +253,8 @@ export function ChatMessagesView({
251253
}
252254
};
253255

256+
console.log("liveActivityEvents", liveActivityEvents);
257+
254258
return (
255259
<div className="flex flex-col h-full overflow-hidden">
256260
<ScrollArea className="flex-1 min-h-0" ref={scrollAreaRef}>

0 commit comments

Comments
 (0)