* Add Anthropic and Grok provider support * feat: Add crucial GPT-5 and reasoning model support for OpenRouter - Add requires_max_completion_tokens() function for GPT-5, o1, o3, Grok-3 series - Add prepare_chat_completion_params() for reasoning model compatibility - Implement max_tokens → max_completion_tokens conversion for reasoning models - Add temperature handling for reasoning models (must be 1.0 default) - Enhanced provider validation and API key security in provider endpoints - Streamlined retry logic (3→2 attempts) for faster issue detection - Add failure tracking and circuit breaker analysis for debugging - Support OpenRouter format detection (openai/gpt-5-nano, openai/o1-mini) - Improved Grok provider empty response handling with structured fallbacks - Enhanced contextual embedding with provider-aware model selection Core provider functionality: - OpenRouter, Grok, Anthropic provider support with full embedding integration - Provider-specific model defaults and validation - Secure API connectivity testing endpoints - Provider context passing for code generation workflows 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fully working model providers, addressing securtiy and code related concerns, throughly hardening our code * added multiprovider support, embeddings model support, cleaned the pr, need to fix health check, asnyico tasks errors, and contextual embeddings error * fixed contextual embeddings issue * - Added inspect-aware shutdown handling so get_llm_client always closes the underlying AsyncOpenAI / httpx.AsyncClient while the loop is still alive, with defensive logging if shutdown happens late (python/src/server/services/llm_provider_service.py:14, python/src/server/ services/llm_provider_service.py:520). * - Restructured get_llm_client so client creation and usage live in separate try/finally blocks; fallback clients now close without logging spurious Error creating LLM client when downstream code raises (python/src/server/services/llm_provider_service.py:335-556). - Close logic now sanitizes provider names consistently and awaits whichever aclose/close coroutine the SDK exposes, keeping the loop shut down cleanly (python/src/server/services/llm_provider_service.py:530-559). Robust JSON Parsing - Added _extract_json_payload to strip code fences / extra text returned by Ollama before json.loads runs, averting the markdown-induced decode errors you saw in logs (python/src/server/services/storage/code_storage_service.py:40-63). - Swapped the direct parse call for the sanitized payload and emit a debug preview when cleanup alters the content (python/src/server/ services/storage/code_storage_service.py:858-864). * added provider connection support * added provider api key not being configured warning * Updated get_llm_client so missing OpenAI keys automatically fall back to Ollama (matching existing tests) and so unsupported providers still raise the legacy ValueError the suite expects. The fallback now reuses _get_optimal_ollama_instance and rethrows ValueError(OpenAI API key not found and Ollama fallback failed) when it cant connect. Adjusted test_code_extraction_source_id.py to accept the new optional argument on the mocked extractor (and confirm its None when present). * Resolved a few needed code rabbit suggestion - Updated the knowledge API key validation to call create_embedding with the provider argument and removed the hard-coded OpenAI fallback (python/src/server/api_routes/knowledge_api.py). - Broadened embedding provider detection so prefixed OpenRouter/OpenAI model names route through the correct client (python/src/server/ services/embeddings/embedding_service.py, python/src/server/services/llm_provider_service.py). - Removed the duplicate helper definitions from llm_provider_service.py, eliminating the stray docstring that was causing the import-time syntax error. * updated via code rabbit PR review, code rabbit in my IDE found no issues and no nitpicks with the updates! what was done: Credential service now persists the provider under the uppercase key LLM_PROVIDER, matching the read path (no new EMBEDDING_PROVIDER usage introduced). Embedding batch creation stops inserting blank strings, logging failures and skipping invalid items before they ever hit the provider (python/src/server/services/embeddings/embedding_service.py). Contextual embedding prompts use real newline characters everywhereboth when constructing the batch prompt and when parsing the models response (python/src/server/services/embeddings/contextual_embedding_service.py). Embedding provider routing already recognizes OpenRouter-prefixed OpenAI models via is_openai_embedding_model; no further change needed there. Embedding insertion now skips unsupported vector dimensions instead of forcing them into the 1536-column, and the backoff loop uses await asyncio.sleep so we no longer block the event loop (python/src/server/services/storage/code_storage_service.py). RAG settings props were extended to include LLM_INSTANCE_NAME and OLLAMA_EMBEDDING_INSTANCE_NAME, and the debug log no longer prints API-key prefixes (the rest of the TanStack refactor/EMBEDDING_PROVIDER support remains deferred). * test fix * enhanced Openrouters parsing logic to automatically detect reasoning models and parse regardless of json output or not. this commit creates a robust way for archons parsing to work throughly with openrouter automatically, regardless of the model youre using, to ensure proper functionality with out breaking any generation capabilities! --------- Co-authored-by: Chillbruhhh <joshchesser97@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .eslintrc.cjs | ||
| .gitignore | ||
| biome.json | ||
| Dockerfile | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.js | ||
| README.md | ||
| tailwind.config.js | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| tsconfig.prod.json | ||
| vite.config.ts | ||
| vitest.config.ts | ||
| vitest.integration.config.ts | ||
Archon UI - Knowledge Engine Web Interface
A modern React-based web interface for the Archon Knowledge Engine MCP Server. Built with TypeScript, Vite, and Tailwind CSS.
🎨 UI Overview
Archon UI provides a comprehensive dashboard for managing your AI's knowledge base:
Key Features
- 📊 MCP Dashboard: Monitor and control the MCP server
- ⚙️ Settings Management: Configure credentials and RAG strategies
- 🕷️ Web Crawling: Crawl documentation sites and build knowledge base
- 📚 Knowledge Management: Browse, search, and organize knowledge items
- 💬 Interactive Chat: Test RAG queries with real-time responses
- 📈 Real-time Updates: WebSocket-based live updates across the UI
🏗️ Architecture
Technology Stack
- React 18.3: Modern React with hooks and functional components
- TypeScript: Full type safety and IntelliSense support
- Vite: Fast build tool and dev server
- Tailwind CSS: Utility-first styling
- Framer Motion: Smooth animations and transitions
- Lucide Icons: Beautiful and consistent iconography
- React Router: Client-side routing
Project Structure
archon-ui-main/
├── src/
│ ├── components/ # Reusable UI components
│ │ ├── ui/ # Base UI components (Button, Card, etc.)
│ │ ├── layouts/ # Layout components (Sidebar, Header)
│ │ └── animations/ # Animation components
│ ├── pages/ # Page components
│ │ ├── MCPPage.tsx # MCP Dashboard
│ │ ├── Settings.tsx # Settings page
│ │ ├── Crawl.tsx # Web crawling interface
│ │ ├── KnowledgeBase.tsx # Knowledge management
│ │ └── Chat.tsx # RAG chat interface
│ ├── services/ # API and service layers
│ │ ├── api.ts # Base API configuration
│ │ ├── mcpService.ts # MCP server communication
│ │ └── chatService.ts # Chat/RAG service
│ ├── contexts/ # React contexts
│ │ └── ToastContext.tsx # Toast notifications
│ ├── hooks/ # Custom React hooks
│ │ └── useStaggeredEntrance.ts # Animation hook
│ ├── types/ # TypeScript type definitions
│ └── lib/ # Utility functions
├── public/ # Static assets
└── test/ # Test files
📄 Pages Documentation
1. MCP Dashboard (/mcp)
The central control panel for the MCP server.
Components:
- Server Control Panel: Start/stop server, view status, select transport mode
- Server Logs Viewer: Real-time log streaming with auto-scroll
- Available Tools Table: Dynamic tool discovery and documentation
- MCP Test Panel: Interactive tool testing interface
Features:
- Dual transport support (SSE/stdio)
- Real-time status polling (5-second intervals)
- WebSocket-based log streaming
- Copy-to-clipboard configuration
- Tool parameter validation
2. Settings (/settings)
Comprehensive configuration management.
Sections:
- Credentials:
- OpenAI API key (encrypted storage)
- Supabase connection details
- MCP server configuration
- RAG Strategies:
- Contextual Embeddings toggle
- Hybrid Search toggle
- Agentic RAG (code extraction) toggle
- Reranking toggle
Features:
- Secure credential storage with encryption
- Real-time validation
- Toast notifications for actions
- Default value management
3. Web Crawling (/crawl)
Interface for crawling documentation sites.
Components:
- URL Input: Smart URL validation
- Crawl Options: Max depth, concurrent sessions
- Progress Monitoring: Real-time crawl status
- Results Summary: Pages crawled, chunks stored
Features:
- Intelligent URL type detection
- Sitemap support
- Recursive crawling
- Batch processing
4. Knowledge Base (/knowledge)
Browse and manage your knowledge items.
Components:
- Knowledge Grid: Card-based knowledge display
- Search/Filter: Search by title, type, tags
- Knowledge Details: View full item details
- Actions: Delete, refresh, organize
Features:
- Pagination support
- Real-time updates via WebSocket
- Type-based filtering (technical/business)
- Metadata display
5. RAG Chat (/chat)
Interactive chat interface for testing RAG queries.
Components:
- Chat Messages: Threaded conversation view
- Input Area: Query input with source selection
- Results Display: Formatted RAG results
- Source Selector: Filter by knowledge source
Features:
- Real-time streaming responses
- Source attribution
- Markdown rendering
- Copy functionality
🧩 Component Library
Base UI Components
Button
<Button
variant="primary|secondary|ghost"
size="sm|md|lg"
accentColor="blue|green|purple|orange|pink"
onClick={handleClick}
>
Click me
</Button>
Card
<Card accentColor="blue" className="p-6">
<h3>Card Title</h3>
<p>Card content</p>
</Card>
LoadingSpinner
<LoadingSpinner size="sm|md|lg" />
Layout Components
Sidebar
- Collapsible navigation
- Active route highlighting
- Icon + text navigation items
- Responsive design
Header
- Dark mode toggle
- User menu
- Breadcrumb navigation
Animation Components
PageTransition
Wraps pages with smooth fade/slide animations:
<PageTransition>
<YourPageContent />
</PageTransition>
🔌 Services
mcpService
Handles all MCP server communication:
startServer(): Start the MCP serverstopServer(): Stop the MCP servergetStatus(): Get current server statusstreamLogs(): WebSocket log streaminggetAvailableTools(): Fetch MCP tools
api
Base API configuration with:
- Automatic error handling
- Request/response interceptors
- Base URL configuration
- TypeScript generics
chatService
RAG query interface:
sendMessage(): Send RAG querystreamResponse(): Stream responsesgetSources(): Get available sources
🎨 Styling
Tailwind Configuration
- Custom color palette
- Dark mode support
- Custom animations
- Responsive breakpoints
Theme Variables
--primary: Blue accent colors
--secondary: Gray/neutral colors
--success: Green indicators
--warning: Orange indicators
--error: Red indicators
🚀 Development
Setup
# Install dependencies
npm install
# Start dev server
npm run dev
# Build for production
npm run build
# Run tests
npm test
Environment Variables
VITE_API_URL=http://localhost:8080
Hot Module Replacement
Vite provides instant HMR for:
- React components
- CSS modules
- TypeScript files
🧪 Testing
Unit Tests
- Component testing with React Testing Library
- Service mocking with MSW
- Hook testing with @testing-library/react-hooks
Integration Tests
- Page-level testing
- API integration tests
- WebSocket testing
📦 Build & Deployment
Docker Support
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 5173
CMD ["npm", "run", "preview"]
Production Optimization
- Code splitting by route
- Lazy loading for pages
- Image optimization
- Bundle size analysis
🔧 Configuration Files
vite.config.ts
- Path aliases
- Build optimization
- Development server config
tsconfig.json
- Strict type checking
- Path mappings
- Compiler options
tailwind.config.js
- Custom theme
- Plugin configuration
- Purge settings
🤝 Contributing
Code Style
- ESLint configuration
- Prettier formatting
- TypeScript strict mode
- Component naming conventions
Git Workflow
- Feature branches
- Conventional commits
- PR templates
- Code review process