From 79a8778603a80f0365307d1967c9d866c16fe951 Mon Sep 17 00:00:00 2001 From: Liu Renke Date: Tue, 17 Jun 2025 14:20:10 +0800 Subject: [PATCH 1/3] use process.cwd() to increase robustness --- frontend/vite.config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index b5490299..c53643bd 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -9,7 +9,10 @@ export default defineConfig({ base: "/app/", resolve: { alias: { - "@": path.resolve(new URL(".", import.meta.url).pathname, "./src"), + // CHANGE THIS LINE: + // From: "@": path.resolve(new URL(".", import.meta.url).pathname, "./src"), + // To: + '@': path.resolve(process.cwd(), './src'), }, }, server: { From 23194bfd08693760b81fd6059519d01d5000f371 Mon Sep 17 00:00:00 2001 From: Liu Renke Date: Mon, 23 Jun 2025 15:34:22 +0800 Subject: [PATCH 2/3] update --- backend/src/agent/graph.py | 5 ++++- frontend/package-lock.json | 32 ++++++++++++++++---------------- frontend/src/App.tsx | 38 ++++++++++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/backend/src/agent/graph.py b/backend/src/agent/graph.py index dae64b77..5602c6bb 100644 --- a/backend/src/agent/graph.py +++ b/backend/src/agent/graph.py @@ -78,6 +78,8 @@ def generate_query(state: OverallState, config: RunnableConfig) -> QueryGenerati ) # Generate the search queries result = structured_llm.invoke(formatted_prompt) + 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} @@ -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, diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 48599091..f6cd5a30 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -600,28 +600,28 @@ } }, "node_modules/@floating-ui/core": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.0.tgz", - "integrity": "sha512-FRdBLykrPPA6P76GGGqlex/e7fbe0F1ykgxHYNXQsH/iTEtjMj/f9bpY5oQqbjt5VgZvgz/uKXbGuROijh3VLA==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.1.tgz", + "integrity": "sha512-azI0DrjMMfIug/ExbBaeDVJXcY0a7EPvPjb2xAJPa4HeimBX+Z18HK8QQR3jb6356SnDDdxx+hinMLcJEDdOjw==", "license": "MIT", "dependencies": { "@floating-ui/utils": "^0.2.9" } }, "node_modules/@floating-ui/dom": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.0.tgz", - "integrity": "sha512-lGTor4VlXcesUMh1cupTUTDoCxMb0V6bm3CnxHzQcw8Eaf1jQbgQX4i02fYgT0vJ82tb5MZ4CZk1LRGkktJCzg==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.1.tgz", + "integrity": "sha512-cwsmW/zyw5ltYTUeeYJ60CnQuPqmGwuGVhG9w0PRaRKkAyi38BT5CKrpIbb+jtahSwUl04cWzSx9ZOIxeS6RsQ==", "license": "MIT", "dependencies": { - "@floating-ui/core": "^1.7.0", + "@floating-ui/core": "^1.7.1", "@floating-ui/utils": "^0.2.9" } }, "node_modules/@floating-ui/react-dom": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.2.tgz", - "integrity": "sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.3.tgz", + "integrity": "sha512-huMBfiU9UnQ2oBwIhgzyIiSpVgvlDstU8CX0AF+wS+KzmYMs0J2a3GwuFHV1Lz+jlrQGeC1fF+Nv0QoumyV0bA==", "license": "MIT", "dependencies": { "@floating-ui/dom": "^1.0.0" @@ -2264,18 +2264,18 @@ } }, "node_modules/@types/react": { - "version": "19.1.2", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.2.tgz", - "integrity": "sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw==", + "version": "19.1.8", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz", + "integrity": "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g==", "license": "MIT", "dependencies": { "csstype": "^3.0.2" } }, "node_modules/@types/react-dom": { - "version": "19.1.3", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.1.3.tgz", - "integrity": "sha512-rJXC08OG0h3W6wDMFxQrZF00Kq6qQvw0djHRdzl3U5DnIERz0MRce3WVc7IS6JYBwtaP/DwYtRRjVlvivNveKg==", + "version": "19.1.6", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.1.6.tgz", + "integrity": "sha512-4hOiT/dwO8Ko0gV1m/TJZYk3y0KBnY9vzDh7W+DH17b2HFSOGgdj33dhihPeuy3l0q23+4e+hoXHV6hCC4dCXw==", "devOptional": true, "license": "MIT", "peerDependencies": { diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 6e68e50b..464ed19b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -30,6 +30,8 @@ export default function App() { console.log(event); }, onUpdateEvent: (event: any) => { + console.log("event", event); + console.log("event data", event.data); let processedEvent: ProcessedEvent | null = null; if (event.generate_query) { processedEvent = { @@ -50,14 +52,34 @@ export default function App() { }.`, }; } else if (event.reflection) { - processedEvent = { - title: "Reflection", - data: event.reflection.is_sufficient - ? "Search successful, generating final answer." - : `Need more information, searching for ${event.reflection.follow_up_queries.join( - ", " - )}`, - }; + 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", From 6c417abee4c490da056649fb988b70eefabae4da Mon Sep 17 00:00:00 2001 From: RK0731 Date: Fri, 27 Jun 2025 21:38:39 +0800 Subject: [PATCH 3/3] resolve confict --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ad4a67f2..d01bda51 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ Thumbs.db # Optional backend venv (if created in root) #.venv/ +.python-version # Byte-compiled / optimized / DLL files __pycache__/