Skip to content

Commit 43a3e7e

Browse files
committed
Add screenshots to README, update default RAG configuration, and enhance UI components for improved user experience.
1 parent 52dcbdc commit 43a3e7e

File tree

11 files changed

+96
-56
lines changed

11 files changed

+96
-56
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
-**Fast Processing** - Optimized document parsing and retrieval system
1818
- 🌐 **Easy Web Interface** - Simple Streamlit app, no technical knowledge required
1919

20+
<div align="center">
21+
<img src="assets/screenshot_01.png" alt="Ragadoc Main Interface" width="80%">
22+
<p><em>Main chat interface with document upload and conversation</em></p>
23+
</div>
24+
25+
<div align="center">
26+
<img src="assets/screenshot_02.png" alt="Ragadoc Document Analysis" width="80%">
27+
<p><em>Document analysis with citations and highlighted responses</em></p>
28+
</div>
29+
2030
## 🚀 Quick Start
2131

2232
### Model Selection Guide
@@ -158,9 +168,9 @@ The app automatically detects your installed Ollama models. Popular choices:
158168
### Advanced Settings
159169

160170
Configure in the sidebar:
161-
- **Chunk Size**: How much text to process at once (default: 512)
162-
- **Chunk Overlap**: Text overlap between chunks (default: 50)
163-
- **Top-K Results**: Number of relevant chunks to consider (default: 5)
171+
- **Chunk Size**: How much text to process at once
172+
- **Chunk Overlap**: Text overlap between chunks
173+
- **Top-K Results**: Number of relevant chunks to consider
164174

165175

166176

assets/screenshot_01.png

500 KB
Loading

assets/screenshot_02.png

466 KB
Loading

ragadoc/chat_manager.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from dataclasses import dataclass, field
1212
from loguru import logger
1313

14+
from .config import DEFAULT_RAG_CONFIG
15+
1416

1517
@dataclass
1618
class ChatMessage:
@@ -55,14 +57,7 @@ def __init__(self):
5557
"""Initialize chat manager"""
5658
self.chats: Dict[str, ChatSession] = {}
5759
self.current_chat_id: Optional[str] = None
58-
self._default_rag_config = {
59-
"chunk_size": 256,
60-
"chunk_overlap": 25,
61-
"similarity_threshold": 0.7,
62-
"top_k": 10,
63-
"embedding_model": "nomic-embed-text",
64-
"llm_model": None
65-
}
60+
self._default_rag_config = DEFAULT_RAG_CONFIG.copy()
6661

6762
def create_new_chat(self, clear_rag_callback: Optional[callable] = None) -> str:
6863
"""

ragadoc/config.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Configuration constants for Ragadoc
3+
4+
This module contains all default configuration values used throughout the application.
5+
"""
6+
7+
# Default RAG Configuration
8+
DEFAULT_RAG_CONFIG = {
9+
"chunk_size": 128,
10+
"chunk_overlap": 64,
11+
"similarity_threshold": 0.7,
12+
"top_k": 10,
13+
"embedding_model": "nomic-embed-text",
14+
"llm_model": None
15+
}
16+
17+
# RAG System Constructor Defaults
18+
DEFAULT_CHUNK_SIZE = DEFAULT_RAG_CONFIG["chunk_size"]
19+
DEFAULT_CHUNK_OVERLAP = DEFAULT_RAG_CONFIG["chunk_overlap"]
20+
DEFAULT_SIMILARITY_THRESHOLD = DEFAULT_RAG_CONFIG["similarity_threshold"]
21+
DEFAULT_TOP_K = DEFAULT_RAG_CONFIG["top_k"]
22+
DEFAULT_EMBEDDING_MODEL = DEFAULT_RAG_CONFIG["embedding_model"]
23+
24+
# UI Slider Configuration
25+
CHUNK_SIZE_RANGE = (32, 1024)
26+
CHUNK_SIZE_STEP = 64
27+
CHUNK_OVERLAP_RANGE = (0, 200)
28+
CHUNK_OVERLAP_STEP = 10
29+
SIMILARITY_THRESHOLD_RANGE = (0.0, 1.0)
30+
SIMILARITY_THRESHOLD_STEP = 0.05
31+
TOP_K_RANGE = (1, 20)
32+
TOP_K_STEP = 1

ragadoc/rag_system.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@
3737
import chromadb
3838
from chromadb.config import Settings as ChromaSettings
3939

40+
# Local imports
41+
from .config import (
42+
DEFAULT_CHUNK_SIZE,
43+
DEFAULT_CHUNK_OVERLAP,
44+
DEFAULT_SIMILARITY_THRESHOLD,
45+
DEFAULT_TOP_K,
46+
DEFAULT_EMBEDDING_MODEL
47+
)
48+
4049

4150
class RAGSystem:
4251
"""
@@ -46,12 +55,12 @@ class RAGSystem:
4655
def __init__(
4756
self,
4857
ollama_base_url: str = "http://localhost:11434",
49-
embedding_model: str = "nomic-embed-text",
58+
embedding_model: str = DEFAULT_EMBEDDING_MODEL,
5059
llm_model: str = "olmo2:13b",
51-
chunk_size: int = 128,
52-
chunk_overlap: int = 25,
53-
similarity_threshold: float = 0.7,
54-
top_k: int = 10
60+
chunk_size: int = DEFAULT_CHUNK_SIZE,
61+
chunk_overlap: int = DEFAULT_CHUNK_OVERLAP,
62+
similarity_threshold: float = DEFAULT_SIMILARITY_THRESHOLD,
63+
top_k: int = DEFAULT_TOP_K
5564
):
5665
"""
5766
Initialize the RAG system

ragadoc/ui_chat.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,10 @@ def render_chat_interface():
292292

293293
# Show current document info
294294
if current_chat.document_name:
295-
with st.expander("📄 Current Document", expanded=False):
296-
st.write(f"**Document:** {current_chat.document_name}")
297-
298-
# Show RAG processing status
295+
with st.expander(f"📄 {current_chat.document_name}", expanded=False):
296+
# Show RAG processing statistics
299297
if current_chat.rag_processed:
300298
rag_stats = current_chat.rag_stats or {}
301-
st.success("✅ Processed with RAG system")
302299
col1, col2 = st.columns(2)
303300
with col1:
304301
st.metric("Chunks Created", rag_stats.get("total_chunks", 0))

ragadoc/ui_config.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,20 @@ def add_logo_and_title():
9292
logo_path = Path(__file__).parent.parent / "assets" / "logo.png"
9393

9494
if logo_path.exists():
95-
# Create a centered header with logo and title
96-
col1, col2, col3 = st.columns([1, 2, 1])
97-
98-
with col2:
99-
# Logo and title in the center column
100-
st.markdown("""
101-
<div class="logo-header">
102-
<img src="data:image/png;base64,{}" alt="ragadoc logo">
103-
<h1 style="margin: 0; font-size: 2.5rem;">ragadoc - AI Document Assistant</h1>
104-
<p style="margin: 0.5rem 0 0 0; font-style: italic; color: #b3b3b3;">
105-
Ask questions about your documents - get grounded answers with citations and highlights.
106-
</p>
107-
</div>
108-
""".format(get_base64_logo(logo_path)), unsafe_allow_html=True)
95+
# Compact header with logo and title using proper CSS classes for styling
96+
st.markdown("""
97+
<div class="logo-header" style="margin-bottom: 1rem;">
98+
<img src="data:image/png;base64,{}" alt="ragadoc logo" style="width: 70px; height: auto;">
99+
<h1 style="margin: 0.5rem 0 0 0; font-size: 2rem;">ragadoc - AI Document Assistant</h1>
100+
<p style="margin: 0.3rem 0 0 0; font-style: italic; color: #b3b3b3; font-size: 0.9rem;">
101+
Ask questions about your documents - get grounded answers with citations and highlights.
102+
</p>
103+
</div>
104+
""".format(get_base64_logo(logo_path)), unsafe_allow_html=True)
109105
else:
110-
# Fallback to text-only title if logo not found
111-
st.title("ragadoc - AI Document Assistant")
112-
st.markdown("*Ask questions about your documents - get grounded answers with citations and highlights*", unsafe_allow_html=True)
106+
# Fallback to text-only title with proper gradient styling
107+
st.markdown("<h1 style='font-size: 2rem; margin: 0 0 0.5rem 0; text-align: center;'>ragadoc - AI Document Assistant</h1>", unsafe_allow_html=True)
108+
st.markdown("<p style='margin: 0 0 1rem 0; font-style: italic; color: #b3b3b3; font-size: 0.9rem; text-align: center;'>Ask questions about your documents - get grounded answers with citations and highlights.</p>", unsafe_allow_html=True)
113109

114110

115111
def get_base64_logo(logo_path):

ragadoc/ui_session.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .llm_interface import LLMInterface
1414
from .rag_system import create_rag_system
1515
from .ui_config import get_ollama_base_url, is_running_in_docker
16+
from .config import DEFAULT_RAG_CONFIG
1617

1718

1819
def init_session_state():
@@ -46,14 +47,7 @@ def init_session_state():
4647

4748
# RAG configuration
4849
if "rag_config" not in st.session_state:
49-
st.session_state.rag_config = {
50-
"chunk_size": 256,
51-
"chunk_overlap": 25,
52-
"similarity_threshold": 0.7,
53-
"top_k": 10,
54-
"embedding_model": "nomic-embed-text",
55-
"llm_model": None
56-
}
50+
st.session_state.rag_config = DEFAULT_RAG_CONFIG.copy()
5751

5852
# Initialize RAG system
5953
if "rag_system" not in st.session_state:

ragadoc/ui_sidebar.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
from .ui_config import is_running_in_docker, get_ollama_base_url
1212
from .ui_session import init_rag_system
13+
from .config import (
14+
CHUNK_SIZE_RANGE, CHUNK_SIZE_STEP,
15+
CHUNK_OVERLAP_RANGE, CHUNK_OVERLAP_STEP,
16+
SIMILARITY_THRESHOLD_RANGE, SIMILARITY_THRESHOLD_STEP,
17+
TOP_K_RANGE, TOP_K_STEP
18+
)
1319

1420

1521
def render_sidebar():
@@ -80,10 +86,10 @@ def render_sidebar():
8086
if expert_mode:
8187
with st.expander("🔍 RAG Settings", expanded=False):
8288
# RAG parameters (excluding embedding model which is now global)
83-
chunk_size = st.slider("Chunk Size (tokens)", 32, 1024, st.session_state.rag_config["chunk_size"], 64)
84-
chunk_overlap = st.slider("Chunk Overlap (tokens)", 0, 200, st.session_state.rag_config["chunk_overlap"], 10)
85-
similarity_threshold = st.slider("Similarity Threshold", 0.0, 1.0, st.session_state.rag_config["similarity_threshold"], 0.05)
86-
top_k = st.slider("Max Retrieved Chunks", 1, 20, st.session_state.rag_config["top_k"], 1)
89+
chunk_size = st.slider("Chunk Size (tokens)", CHUNK_SIZE_RANGE[0], CHUNK_SIZE_RANGE[1], st.session_state.rag_config["chunk_size"], CHUNK_SIZE_STEP)
90+
chunk_overlap = st.slider("Chunk Overlap (tokens)", CHUNK_OVERLAP_RANGE[0], CHUNK_OVERLAP_RANGE[1], st.session_state.rag_config["chunk_overlap"], CHUNK_OVERLAP_STEP)
91+
similarity_threshold = st.slider("Similarity Threshold", SIMILARITY_THRESHOLD_RANGE[0], SIMILARITY_THRESHOLD_RANGE[1], st.session_state.rag_config["similarity_threshold"], SIMILARITY_THRESHOLD_STEP)
92+
top_k = st.slider("Max Retrieved Chunks", TOP_K_RANGE[0], TOP_K_RANGE[1], st.session_state.rag_config["top_k"], TOP_K_STEP)
8793

8894
# Update configuration if changed (excluding embedding model)
8995
new_config = {

0 commit comments

Comments
 (0)