feat(gui): Implement RAG Settings panel in AI Settings

This commit is contained in:
2026-05-04 11:22:06 -04:00
parent a9ca5ad781
commit f57e2fe4f0
7 changed files with 74 additions and 13 deletions
+1
View File
@@ -14,3 +14,4 @@ dpg_layout.ini
.coverage
tests/temp_workspace
.mypy_cache
.slop_cache
+6
View File
@@ -0,0 +1,6 @@
{
"C:\\projects\\manual_slop\\src\\ai_client.py": {
"hash": "db4b3aad82599499d7796860757e229d2d412c5ccb3e821ddaee68ca0d3ad5d3",
"summary": "This Python module serves as a unified client interface for multiple Large Language Model (LLM) providers, abstracting away provider-specific differences in tool handling, history management, and caching. It includes specialized logic for Anthropic to manage token limits and for Gemini to inject initial context efficiently.\n\n* **Multi-Provider Abstraction:** Provides a single interface for interacting with LLMs from Anthropic, Gemini, DeepSeek, and Minimax.\n* **Provider-Specific Optimization:** Implements tailored strategies for managing token limits (Anthropic) and context injection (Gemini).\n* **Tooling and Bias Management:** Supports setting agent tools, tool presets, and bias profiles to influence LLM behavior.\n* **Communication Logging:** Tracks and logs communication events with LLM providers.\n* **Configuration and State Management:** Manages global generation parameters, credentials, and session state.\n\n**Outline:**\n**Python** \u2014 2501 lines\nimports: __future__, anthropic, asyncio, collections, datetime, difflib, google, hashlib, json, openai, os, pathlib, requests, src, sys, threading, time, tomllib, typing\nconstants: _GEMINI_CACHE_TTL, _BIAS_ENGINE, MAX_TOOL_ROUNDS, _MAX_TOOL_OUTPUT_BYTES, _ANTHROPIC_CHUNK_SIZE, _SYSTEM_PROMPT, COMMS_CLAMP_CHARS, TOOL_NAME, _CACHED_ANTHROPIC_TOOLS, _DIFF_LINE_THRESHOLD, _CACHED_DEEPSEEK_TOOLS, _CHARS_PER_TOKEN, _ANTHROPIC_MAX_PROMPT_TOKENS, _GEMINI_MAX_INPUT_TOKENS, _FILE_REFRESH_MARKER\nclass ProviderError: __init__, ui_message\nfunctions: set_model_params, get_history_trunc_limit, set_history_trunc_limit, get_current_tier, set_current_tier, set_custom_system_prompt, set_base_system_prompt, set_use_default_base_prompt, set_project_context_marker, _get_context_marker, _get_combined_system_prompt, get_combined_system_prompt, _append_comms, get_comms_log, clear_comms_log, get_credentials_path, _load_credentials, _classify_anthropic_error, _classify_gemini_error, _classify_deepseek_error, _classify_minimax_error, set_provider, get_provider, cleanup, reset_session, get_gemini_cache_stats, list_models, _list_gemini_cli_models, _list_gemini_models, _list_anthropic_models, _list_deepseek_models, _list_minimax_models, set_agent_tools, set_tool_preset, set_bias_profile, get_bias_profile, _build_anthropic_tools, _get_anthropic_tools, _gemini_tool_declaration, _execute_tool_calls_concurrently, _execute_single_tool_call_async, _run_script, _truncate_tool_output, _reread_file_items, _build_file_context_text, _build_file_diff_text, _build_deepseek_tools, _get_deepseek_tools, _content_block_to_dict, _ensure_gemini_client, _get_gemini_history_list, _send_gemini, _send_gemini_cli, _estimate_message_tokens, _invalidate_token_estimate, _estimate_prompt_tokens, _strip_stale_file_refreshes, _trim_anthropic_history, _ensure_anthropic_client, _chunk_text, _build_chunked_context_blocks, _strip_cache_controls, _add_history_cache_breakpoint, _repair_anthropic_history, _send_anthropic, _ensure_deepseek_client, _ensure_minimax_client, _repair_deepseek_history, _send_deepseek, _send_minimax, run_tier4_analysis, run_tier4_patch_callback, run_tier4_patch_generation, get_token_stats, send, _add_bleed_derived, get_history_bleed_stats, run_subagent_summarization"
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ This file tracks all major tracks for the project. Each track has its own detail
### Architecture & Backend
1. [ ] **Track: RAG Support**
1. [~] **Track: RAG Support**
*Link: [./tracks/rag_support_20260308/](./tracks/rag_support_20260308/)*
*Goal: Add support for RAG (Retrieval-Augmented Generation) using local vector stores (Chroma/Qdrant), native vendor retrieval, and external RAG APIs. Implement indexing pipeline and retrieval UI.*
@@ -28,7 +28,7 @@
- [x] Task: Conductor - User Manual Verification 'Phase 2: Indexing & Retrieval Logic' (Protocol in workflow.md) fe0069c
## Phase 3: GUI Integration & Visualization
- [ ] Task: Implement the RAG Settings panel in `src/gui_2.py`.
- [~] Task: Implement the RAG Settings panel in `src/gui_2.py`.
- [ ] Add UI controls for choosing the RAG source, embedding model, and retrieval parameters.
- [ ] Add a "Rebuild Index" button and status progress bar.
- [ ] Task: Implement retrieval visualization in the Discussion history.
+10 -10
View File
@@ -102,26 +102,26 @@ Collapsed=0
DockId=0x0000000D,0
[Window][Discussion Hub]
Pos=1313,24
Size=1359,1879
Pos=1563,24
Size=1359,1683
Collapsed=0
DockId=0x00000006,0
[Window][Operations Hub]
Pos=0,24
Size=1311,1879
Size=1561,1683
Collapsed=0
DockId=0x00000005,2
[Window][Files & Media]
Pos=1313,24
Size=1359,1879
Pos=1563,24
Size=1359,1683
Collapsed=0
DockId=0x00000006,1
[Window][AI Settings]
Pos=0,24
Size=1311,1879
Size=1561,1683
Collapsed=0
DockId=0x00000005,0
@@ -131,8 +131,8 @@ Size=416,325
Collapsed=0
[Window][MMA Dashboard]
Pos=1313,24
Size=1359,1879
Pos=1563,24
Size=1359,1683
Collapsed=0
DockId=0x00000006,2
@@ -407,7 +407,7 @@ DockId=0x00000006,1
[Window][Project Settings]
Pos=0,24
Size=1311,1879
Size=1561,1683
Collapsed=0
DockId=0x00000005,1
@@ -535,7 +535,7 @@ Column 2 Width=150
DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,24 Size=2672,1879 Split=X
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,24 Size=2922,1683 Split=X
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=2175,1183 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=1512,858 Split=X Selected=0x8CA2375C
+40 -1
View File
@@ -672,8 +672,9 @@ class App:
self._render_provider_panel()
if imgui.collapsing_header("System Prompts"):
self._render_system_prompts_panel()
if imgui.collapsing_header("RAG Settings"):
self._render_rag_panel()
self._render_agent_tools_panel()
imgui.end()
if self.ui_separate_usage_analytics and self.show_windows.get("Usage Analytics", False):
exp, opened = imgui.begin("Usage Analytics", self.show_windows["Usage Analytics"])
@@ -4372,6 +4373,44 @@ def hello():
self.show_preset_manager_window = True
imgui.set_item_tooltip("Open preset management modal")
ch, self.ui_project_system_prompt = imgui.input_text_multiline("##psp", self.ui_project_system_prompt, imgui.ImVec2(-1, 100))
def _render_rag_panel(self) -> None:
conf = self.controller.rag_config
if not conf: return
ch, conf.enabled = imgui.checkbox("Enable RAG", conf.enabled)
imgui.text("Vector Store Provider")
providers = ['chroma', 'qdrant', 'mock']
try:
idx = providers.index(conf.vector_store.provider)
except (ValueError, AttributeError):
idx = 0
ch2, next_idx = imgui.combo("##rag_provider", idx, providers)
if ch2:
conf.vector_store.provider = providers[next_idx]
imgui.text("Embedding Provider")
emb_providers = ['gemini', 'local']
try:
idx_e = emb_providers.index(conf.embedding_provider)
except (ValueError, AttributeError):
idx_e = 0
ch3, next_idx_e = imgui.combo("##rag_emb_provider", idx_e, emb_providers)
if ch3:
conf.embedding_provider = emb_providers[next_idx_e]
imgui.text("Chunk Size")
imgui.set_next_item_width(150)
ch4, conf.chunk_size = imgui.input_int("##rag_chunk_size", conf.chunk_size)
imgui.text("Chunk Overlap")
imgui.set_next_item_width(150)
ch5, conf.chunk_overlap = imgui.input_int("##rag_chunk_overlap", conf.chunk_overlap)
imgui.separator()
imgui.text(f"Status: {self.controller.rag_status}")
if imgui.button("Rebuild Index"):
self.controller._rebuild_rag_index()
def _render_agent_tools_panel(self) -> None:
if imgui.collapsing_header("Active Tool Presets & Biases", imgui.TreeNodeFlags_.default_open):
imgui.text("Tool Preset")
+15
View File
@@ -0,0 +1,15 @@
import pytest
from src.gui_2 import App
def test_rag_panel_exists():
"""Verify that _render_rag_panel has been added to the App class."""
assert hasattr(App, '_render_rag_panel')
assert callable(App._render_rag_panel)
def test_rag_panel_integration():
"""Verify that _gui_func calls _render_rag_panel by inspecting source or via mock."""
import inspect
source = inspect.getsource(App._gui_func)
assert "self._render_rag_panel()" in source
assert "imgui.collapsing_header(\"RAG Settings\")" in source