Skip to content

Renke dev #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Thumbs.db

# Optional backend venv (if created in root)
#.venv/
.python-version

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
7 changes: 5 additions & 2 deletions backend/src/agent/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def generate_query(state: OverallState, config: RunnableConfig) -> QueryGenerati
)
# Generate the search queries
result = structured_llm.invoke(formatted_prompt)
return {"search_query": result.query}
print(f"\nDEBUG: generate_query result: {result}")
print(f"DEBUG: generate_query result.query type: {type(result.query)}, value: {result.query}\n")
return {"query_list": result.query}


def continue_to_web_research(state: QueryGenerationState):
Expand Down Expand Up @@ -170,7 +172,8 @@ def reflection(state: OverallState, config: RunnableConfig) -> ReflectionState:
api_key=os.getenv("GEMINI_API_KEY"),
)
result = llm.with_structured_output(Reflection).invoke(formatted_prompt)

print(f"\nDEBUG: reflection result: {result}")
print(f"DEBUG: reflection result.follow_up_queries type: {type(result.follow_up_queries)}, value: {result.follow_up_queries}\n")
return {
"is_sufficient": result.is_sufficient,
"knowledge_gap": result.knowledge_gap,
Expand Down
32 changes: 16 additions & 16 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 30 additions & 4 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export default function App() {
assistantId: "agent",
messagesKey: "messages",
onUpdateEvent: (event: any) => {
console.log("event", event);
console.log("event data", event.data);
let processedEvent: ProcessedEvent | null = null;
if (event.generate_query) {
processedEvent = {
Expand All @@ -48,10 +50,34 @@ export default function App() {
}.`,
};
} else if (event.reflection) {
processedEvent = {
title: "Reflection",
data: "Analysing Web Research Results",
};
console.log("reflection event received:", event.reflection);
console.log("Type of event.reflection.follow_up_queries:", typeof event.reflection?.follow_up_queries);
if (event.reflection.is_sufficient) {
processedEvent = {
title: "Reflection",
data: "Search successful, generating final answer."
};
} else if (event.reflection.follow_up_queries) {
console.log("Is event.reflection.follow_up_queries an Array?", Array.isArray(event.reflection.follow_up_queries));
if (Array.isArray(event.reflection.follow_up_queries)) {
processedEvent = {
title: "Reflection",
data: `Need more information, searching for ${event.reflection.follow_up_queries.join(", ")}`,
};
} else {
console.error("CRITICAL ERROR: event.reflection.follow_up_queries is NOT an array!", event.reflection.follow_up_queries);
processedEvent = {
title: "Reflection (Error)",
data: `Unexpected data type for follow-up queries: ${typeof event.reflection.follow_up_queries}. Value: ${JSON.stringify(event.reflection.follow_up_queries)}`,
};
}
} else {
console.error("CRITICAL ERROR: event.reflection.follow_up_queries is null or undefined!", event.reflection.follow_up_queries);
processedEvent = {
title: "Reflection (Error)",
data: "Follow-up queries list is missing.",
};
}
} else if (event.finalize_answer) {
processedEvent = {
title: "Finalizing Answer",
Expand Down
5 changes: 4 additions & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export default defineConfig({
base: "/app/",
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
// CHANGE THIS LINE:
// From: "@": path.resolve(new URL(".", import.meta.url).pathname, "./src"),
// To:
'@': path.resolve(process.cwd(), './src'),
},
},
server: {
Expand Down