From b9d49060f3b96ce4ae01ae1a2bb42ffcd99f4645 Mon Sep 17 00:00:00 2001 From: AI Christianson Date: Wed, 11 Dec 2024 21:55:49 -0500 Subject: [PATCH] fix expert context --- .ra-aid/tech-debt/1.md | 11 ----------- ra_aid/tools/expert.py | 16 ++++++++++------ 2 files changed, 10 insertions(+), 17 deletions(-) delete mode 100644 .ra-aid/tech-debt/1.md diff --git a/.ra-aid/tech-debt/1.md b/.ra-aid/tech-debt/1.md deleted file mode 100644 index 3283407..0000000 --- a/.ra-aid/tech-debt/1.md +++ /dev/null @@ -1,11 +0,0 @@ -# Technical Debt Note 1 -## Description -The tech debt note cleanup process needs an AI-driven strategy to: -1. Analyze note contents and determine priority/relevance -2. Consider note age and related code locations -3. Implement a scoring system for note importance - -This should be implemented as a separate cleanup agent that can be triggered when needed. - -## Location -ra_aid/tools/note_tech_debt.py diff --git a/ra_aid/tools/expert.py b/ra_aid/tools/expert.py index 3da1e8a..1186956 100644 --- a/ra_aid/tools/expert.py +++ b/ra_aid/tools/expert.py @@ -123,11 +123,6 @@ def ask_expert(question: str) -> str: # Build query with context and key facts query_parts = [] - # Add related file contents if any exist first - related_contents = read_related_files() - if related_contents: - query_parts.extend(['# Related Files', related_contents]) - # Add key facts if they exist key_facts = get_memory_value('key_facts') if key_facts and len(key_facts) > 0: @@ -145,7 +140,7 @@ def ask_expert(question: str) -> str: query_parts.append("\n# Additional Context") query_parts.append("\n".join(expert_context)) - # Add the question last + # Add the question if query_parts: # If we have context/facts, add a newline before question query_parts.append("\n# Question") query_parts.append(question) @@ -163,6 +158,15 @@ def ask_expert(question: str) -> str: # Clear context after use (only after successful panel display) expert_context.clear() + # Get related file contents and rebuild query with it at the start + related_contents = read_related_files() + if related_contents: + # Create new query_parts with related files at the start + new_query_parts = ['# Related Files', related_contents] + new_query_parts.extend(query_parts) + query_parts = new_query_parts + query = "\n".join(query_parts) + # Get response response = model.invoke(query)