clean up expert display panel
This commit is contained in:
parent
aa3d140cd7
commit
07649b934a
|
|
@ -16,7 +16,9 @@
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[]()
|
[]()
|
||||||
|
|
||||||
<img src="assets/demo.gif" alt="RA.Aid Demo" autoplay loop style="width: 100%; max-width: 800px;">
|
Here's a video of RA.Aid adding a feature to itself:
|
||||||
|
|
||||||
|
<img src="assets/demo-ra-aid-task-1.gif" alt="RA.Aid Demo" autoplay loop style="width: 100%; max-width: 800px;">
|
||||||
|
|
||||||
> 👋 **Pull requests are very welcome!** As a technical founder with limited time (who uses RA.Aid to save time), I greatly appreciate any contributions to this repository. Don't be shy - your help makes a real difference!
|
> 👋 **Pull requests are very welcome!** As a technical founder with limited time (who uses RA.Aid to save time), I greatly appreciate any contributions to this repository. Don't be shy - your help makes a real difference!
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.3 MiB |
|
|
@ -133,55 +133,46 @@ def ask_expert(question: str) -> str:
|
||||||
"""
|
"""
|
||||||
global expert_context
|
global expert_context
|
||||||
|
|
||||||
# Build query with context and key facts
|
# Get all content first
|
||||||
query_parts = []
|
related_contents = read_related_files()
|
||||||
|
|
||||||
# Add key facts if they exist
|
|
||||||
key_facts = get_memory_value('key_facts')
|
|
||||||
if key_facts and len(key_facts) > 0:
|
|
||||||
query_parts.append("# Key Facts About This Project")
|
|
||||||
query_parts.append(key_facts)
|
|
||||||
|
|
||||||
# Add key snippets if they exist
|
|
||||||
key_snippets = get_memory_value('key_snippets')
|
key_snippets = get_memory_value('key_snippets')
|
||||||
if key_snippets and len(key_snippets) > 0:
|
key_facts = get_memory_value('key_facts')
|
||||||
query_parts.append('# Key Snippets')
|
|
||||||
query_parts.append(key_snippets)
|
|
||||||
|
|
||||||
# Add other context if it exists
|
# Build display query (just question)
|
||||||
if expert_context:
|
display_query = "# Question\n" + question
|
||||||
query_parts.append("\n# Additional Context")
|
|
||||||
query_parts.append("\n".join(expert_context))
|
|
||||||
|
|
||||||
# Add the question
|
# Show only question in panel
|
||||||
if query_parts: # If we have context/facts, add a newline before question
|
|
||||||
query_parts.append("\n# Question")
|
|
||||||
query_parts.append(question)
|
|
||||||
|
|
||||||
# Join all parts
|
|
||||||
query = "\n".join(query_parts)
|
|
||||||
|
|
||||||
# Display the query in a panel before making the call
|
|
||||||
console.print(Panel(
|
console.print(Panel(
|
||||||
Markdown(query),
|
Markdown(display_query),
|
||||||
title="🤔 Expert Query",
|
title="🤔 Expert Query",
|
||||||
border_style="yellow"
|
border_style="yellow"
|
||||||
))
|
))
|
||||||
|
|
||||||
# Clear context after use (only after successful panel display)
|
# Clear context after panel display
|
||||||
expert_context.clear()
|
expert_context.clear()
|
||||||
|
|
||||||
# Get related file contents and rebuild query with it at the start
|
# Build full query in specified order
|
||||||
related_contents = read_related_files()
|
query_parts = []
|
||||||
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
|
if related_contents:
|
||||||
response = get_model().invoke(query)
|
query_parts.extend(['# Related Files', related_contents])
|
||||||
|
|
||||||
|
if key_snippets and len(key_snippets) > 0:
|
||||||
|
query_parts.extend(['# Key Snippets', key_snippets])
|
||||||
|
|
||||||
|
if key_facts and len(key_facts) > 0:
|
||||||
|
query_parts.extend(['# Key Facts About This Project', key_facts])
|
||||||
|
|
||||||
|
if expert_context:
|
||||||
|
query_parts.extend(['\n# Additional Context', '\n'.join(expert_context)])
|
||||||
|
|
||||||
|
query_parts.extend(['# Question', question])
|
||||||
|
|
||||||
|
# Join all parts
|
||||||
|
full_query = '\n'.join(query_parts)
|
||||||
|
|
||||||
|
# Get response using full query
|
||||||
|
response = get_model().invoke(full_query)
|
||||||
|
|
||||||
# Format and display response
|
# Format and display response
|
||||||
console.print(Panel(
|
console.print(Panel(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue