Archon onboarding, README updates, and MCP/global rule expansion for more coding assistants

This commit is contained in:
Cole Medin 2025-08-13 18:36:36 -05:00
parent 8d189b9946
commit bb64af9e7a
19 changed files with 808 additions and 180 deletions

View File

@ -16,6 +16,8 @@
## 🎯 What is Archon?
> Archon is currently in beta! Expect things to not work 100%, and please feel free to share any feedback and contribute with fixes/new features!
Archon is the **command center** for AI coding assistants. For you, it's a sleek interface to manage knowledge, context, and tasks for your projects. For the AI coding assistant(s), it's a **Model Context Protocol (MCP) server** to collaborate on and leverage the same knowledge, context, and tasks. Connect Claude Code, Kiro, Cursor, Windsurf, etc. to give your AI agents access to:
- **Your documentation** (crawled websites, uploaded PDFs/docs)
@ -32,7 +34,7 @@ This new vision for Archon replaces the old one (the agenteer). Archon used to b
- **[GitHub Discussions](https://github.com/coleam00/Archon/discussions)** - Join the conversation and share ideas about Archon
- **[Contributing Guide](CONTRIBUTING.md)** - How to get involved and contribute to Archon
- **[Introduction Video](#)** - Coming Soon
- **[Introduction Video](https://youtu.be/8pRc_s2VQIo)** - Getting Started Guide and Vision for Archon
- **[Dynamous AI Mastery](https://dynamous.ai)** - The birthplace of Archon - come join a vibrant community of other early AI adopters all helping each other transform their careers and businesses!
## Quick Start
@ -70,7 +72,7 @@ This new vision for Archon replaces the old one (the agenteer). Archon used to b
This starts the core microservices:
- **Server**: Core API and business logic (Port: 8181)
- **MCP Server**: Protocol interface for AI clients (Port: 8051)
- **Agents**: AI operations and streaming (Port: 8052)
- **Agents (coming soon!)**: AI operations and streaming (Port: 8052)
- **UI**: Web interface (Port: 3737)
Ports are configurable in your .env as well!
@ -126,17 +128,6 @@ Once everything is running:
| **MCP Server** | archon-mcp | http://localhost:8051 | Model Context Protocol interface |
| **Agents Service** | archon-agents | http://localhost:8052 | AI/ML operations, reranking |
### Optional Documentation Service
The documentation service is optional. To run it:
```bash
# Start core services + documentation
docker-compose -f docker-compose.yml -f docker-compose.docs.yml up --build -d
```
Then access documentation at: **http://localhost:3838**
## What's Included
### 🧠 Knowledge Management

View File

@ -3,6 +3,7 @@ import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-d
import { KnowledgeBasePage } from './pages/KnowledgeBasePage';
import { SettingsPage } from './pages/SettingsPage';
import { MCPPage } from './pages/MCPPage';
import { OnboardingPage } from './pages/OnboardingPage';
import { MainLayout } from './components/layouts/MainLayout';
import { ThemeProvider } from './contexts/ThemeContext';
import { ToastProvider } from './contexts/ToastContext';
@ -18,6 +19,7 @@ const AppRoutes = () => {
return (
<Routes>
<Route path="/" element={<KnowledgeBasePage />} />
<Route path="/onboarding" element={<OnboardingPage />} />
<Route path="/settings" element={<SettingsPage />} />
<Route path="/mcp" element={<MCPPage />} />
{projectsEnabled ? (

View File

@ -1,10 +1,11 @@
import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
import { SideNavigation } from './SideNavigation';
import { ArchonChatPanel } from './ArchonChatPanel';
import { X } from 'lucide-react';
import { useToast } from '../../contexts/ToastContext';
import { credentialsService } from '../../services/credentialsService';
import { isLmConfigured } from '../../utils/onboarding';
/**
* Props for the MainLayout component
*/
@ -26,6 +27,7 @@ export const MainLayout: React.FC<MainLayoutProps> = ({
const [isChatOpen, setIsChatOpen] = useState(false);
const { showToast } = useToast();
const navigate = useNavigate();
const location = useLocation();
const [backendReady, setBackendReady] = useState(false);
// Check backend readiness
@ -36,11 +38,17 @@ export const MainLayout: React.FC<MainLayoutProps> = ({
const retryDelay = 1000;
try {
// Create AbortController for proper timeout handling
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);
// Check if backend is responding with a simple health check
const response = await fetch(`${credentialsService['baseUrl']}/health`, {
method: 'GET',
timeout: 5000
} as any);
signal: controller.signal
});
clearTimeout(timeoutId);
if (response.ok) {
const healthData = await response.json();
@ -68,7 +76,10 @@ export const MainLayout: React.FC<MainLayoutProps> = ({
throw new Error(`Backend health check failed: ${response.status}`);
}
} catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
// Handle AbortError separately for timeout
const errorMessage = error instanceof Error
? (error.name === 'AbortError' ? 'Request timeout (5s)' : error.message)
: 'Unknown error';
console.log(`Backend not ready yet (attempt ${retryCount + 1}/${maxRetries}):`, errorMessage);
// Retry if we haven't exceeded max retries
@ -90,6 +101,59 @@ export const MainLayout: React.FC<MainLayoutProps> = ({
}, 1000); // Wait 1 second for initial app startup
}, [showToast, navigate]); // Removed backendReady from dependencies to prevent double execution
// Check for onboarding redirect after backend is ready
useEffect(() => {
const checkOnboarding = async () => {
// Skip if not ready, already on onboarding, or already dismissed
if (!backendReady || location.pathname === '/onboarding') {
return;
}
// Check if onboarding was already dismissed
if (localStorage.getItem('onboardingDismissed') === 'true') {
return;
}
try {
// Fetch credentials in parallel
const [ragCreds, apiKeyCreds] = await Promise.all([
credentialsService.getCredentialsByCategory('rag_strategy'),
credentialsService.getCredentialsByCategory('api_keys')
]);
// Check if LM is configured
const configured = isLmConfigured(ragCreds, apiKeyCreds);
if (!configured) {
// Redirect to onboarding
navigate('/onboarding', { replace: true });
}
} catch (error) {
// Detailed error handling per alpha principles - fail loud but don't block
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
const errorDetails = {
context: 'Onboarding configuration check',
pathname: location.pathname,
error: errorMessage,
timestamp: new Date().toISOString()
};
// Log with full context and stack trace
console.error('ONBOARDING_CHECK_FAILED:', errorDetails, error);
// Make error visible to user but don't block app functionality
showToast(
`Configuration check failed: ${errorMessage}. You can manually configure in Settings.`,
'warning'
);
// Let user continue - onboarding is optional, they can configure manually
}
};
checkOnboarding();
}, [backendReady, location.pathname, navigate, showToast]);
return <div className="relative min-h-screen bg-white dark:bg-black overflow-hidden">
{/* Fixed full-page background grid that doesn't scroll */}
<div className="fixed inset-0 neon-grid pointer-events-none z-0"></div>
@ -104,9 +168,22 @@ export const MainLayout: React.FC<MainLayoutProps> = ({
</div>
</div>
{/* Floating Chat Button - Only visible when chat is closed */}
{!isChatOpen && <button onClick={() => setIsChatOpen(true)} className="fixed bottom-6 right-6 z-50 w-14 h-14 rounded-full flex items-center justify-center backdrop-blur-md bg-gradient-to-b from-white/10 to-black/30 dark:from-white/10 dark:to-black/30 from-blue-100/80 to-blue-50/60 shadow-[0_0_20px_rgba(59,130,246,0.3)] dark:shadow-[0_0_20px_rgba(59,130,246,0.7)] hover:shadow-[0_0_25px_rgba(59,130,246,0.5)] dark:hover:shadow-[0_0_25px_rgba(59,130,246,0.9)] transition-all duration-300 overflow-hidden border border-blue-200 dark:border-transparent" aria-label="Open Knowledge Assistant">
<img src="/logo-neon.svg" alt="Archon" className="w-7 h-7" />
</button>}
{!isChatOpen && (
<div className="fixed bottom-6 right-6 z-50 group">
<button
disabled
className="w-14 h-14 rounded-full flex items-center justify-center backdrop-blur-md bg-gradient-to-b from-gray-100/80 to-gray-50/60 dark:from-gray-700/30 dark:to-gray-800/30 shadow-[0_0_10px_rgba(156,163,175,0.3)] dark:shadow-[0_0_10px_rgba(156,163,175,0.3)] cursor-not-allowed opacity-60 overflow-hidden border border-gray-300 dark:border-gray-600"
aria-label="Knowledge Assistant - Coming Soon">
<img src="/logo-neon.svg" alt="Archon" className="w-7 h-7 grayscale opacity-50" />
</button>
{/* Tooltip */}
<div className="absolute bottom-full right-0 mb-2 px-3 py-2 bg-gray-800 dark:bg-gray-900 text-white text-sm rounded-lg shadow-lg opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap">
<div className="font-medium">Coming Soon</div>
<div className="text-xs text-gray-300">Knowledge Assistant is under development</div>
<div className="absolute bottom-0 right-6 transform translate-y-1/2 rotate-45 w-2 h-2 bg-gray-800 dark:bg-gray-900"></div>
</div>
</div>
)}
{/* Chat Sidebar - Slides in/out from right */}
<div className="fixed top-0 right-0 h-full z-40 transition-transform duration-300 ease-in-out transform" style={{
transform: isChatOpen ? 'translateX(0)' : 'translateX(100%)'

View File

@ -0,0 +1,193 @@
import { useState } from 'react';
import { Key, ExternalLink, Save, Loader } from 'lucide-react';
import { Input } from '../ui/Input';
import { Button } from '../ui/Button';
import { Select } from '../ui/Select';
import { useToast } from '../../contexts/ToastContext';
import { credentialsService } from '../../services/credentialsService';
interface ProviderStepProps {
onSaved: () => void;
onSkip: () => void;
}
export const ProviderStep = ({ onSaved, onSkip }: ProviderStepProps) => {
const [provider, setProvider] = useState('openai');
const [apiKey, setApiKey] = useState('');
const [saving, setSaving] = useState(false);
const { showToast } = useToast();
const handleSave = async () => {
if (!apiKey.trim()) {
showToast('Please enter an API key', 'error');
return;
}
setSaving(true);
try {
// Save the API key
await credentialsService.createCredential({
key: 'OPENAI_API_KEY',
value: apiKey,
is_encrypted: true,
category: 'api_keys'
});
// Update the provider setting if needed
await credentialsService.updateCredential({
key: 'LLM_PROVIDER',
value: 'openai',
is_encrypted: false,
category: 'rag_strategy'
});
showToast('API key saved successfully!', 'success');
onSaved();
} catch (error) {
// Detailed error handling for critical configuration per alpha principles
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
const errorDetails = {
context: 'API key configuration',
operation: 'save_openai_key',
provider: 'openai',
error: errorMessage,
timestamp: new Date().toISOString()
};
// Log with full context and stack trace
console.error('API_KEY_SAVE_FAILED:', errorDetails, error);
// Show specific error details to help user resolve the issue
if (errorMessage.includes('duplicate') || errorMessage.includes('already exists')) {
showToast(
'API key already exists. Please update it in Settings if you want to change it.',
'warning'
);
} else if (errorMessage.includes('network') || errorMessage.includes('fetch')) {
showToast(
`Network error while saving API key: ${errorMessage}. Please check your connection.`,
'error'
);
} else if (errorMessage.includes('unauthorized') || errorMessage.includes('forbidden')) {
showToast(
`Permission error: ${errorMessage}. Please check backend configuration.`,
'error'
);
} else {
// Show the actual error for unknown issues
showToast(
`Failed to save API key: ${errorMessage}`,
'error'
);
}
} finally {
setSaving(false);
}
};
const handleSkip = () => {
showToast('You can configure your provider in Settings', 'info');
onSkip();
};
return (
<div className="space-y-6">
{/* Provider Selection */}
<div>
<Select
label="Select AI Provider"
value={provider}
onChange={(e) => setProvider(e.target.value)}
options={[
{ value: 'openai', label: 'OpenAI' },
{ value: 'google', label: 'Google Gemini' },
{ value: 'ollama', label: 'Ollama (Local)' },
]}
accentColor="green"
/>
<p className="mt-2 text-sm text-gray-600 dark:text-zinc-400">
{provider === 'openai' && 'OpenAI provides powerful models like GPT-4. You\'ll need an API key from OpenAI.'}
{provider === 'google' && 'Google Gemini offers advanced AI capabilities. Configure in Settings after setup.'}
{provider === 'ollama' && 'Ollama runs models locally on your machine. Configure in Settings after setup.'}
</p>
</div>
{/* OpenAI API Key Input */}
{provider === 'openai' && (
<>
<div>
<Input
label="OpenAI API Key"
type="password"
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
placeholder="sk-..."
accentColor="green"
icon={<Key className="w-4 h-4" />}
/>
<p className="mt-2 text-sm text-gray-600 dark:text-zinc-400">
Your API key will be encrypted and stored securely.
</p>
</div>
<div className="flex items-center gap-2 text-sm">
<a
href="https://platform.openai.com/api-keys"
target="_blank"
rel="noopener noreferrer"
className="text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-300 flex items-center gap-1"
>
Get an API key from OpenAI
<ExternalLink className="w-3 h-3" />
</a>
</div>
<div className="flex gap-3 pt-4">
<Button
variant="primary"
size="lg"
onClick={handleSave}
disabled={saving || !apiKey.trim()}
icon={saving ? <Loader className="w-4 h-4 animate-spin" /> : <Save className="w-4 h-4" />}
className="flex-1"
>
{saving ? 'Saving...' : 'Save & Continue'}
</Button>
<Button
variant="outline"
size="lg"
onClick={handleSkip}
disabled={saving}
className="flex-1"
>
Skip for Now
</Button>
</div>
</>
)}
{/* Non-OpenAI Provider Message */}
{provider !== 'openai' && (
<div className="space-y-4">
<div className="p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg">
<p className="text-sm text-blue-800 dark:text-blue-200">
{provider === 'google' && 'Google Gemini configuration will be available in Settings after setup.'}
{provider === 'ollama' && 'Ollama configuration will be available in Settings after setup. Make sure Ollama is running locally.'}
</p>
</div>
<div className="flex gap-3 pt-4">
<Button
variant="primary"
size="lg"
onClick={handleSkip}
className="flex-1"
>
Continue to Settings
</Button>
</div>
</div>
)}
</div>
);
};

View File

@ -38,7 +38,7 @@ export const SimpleMarkdown: React.FC<SimpleMarkdownProps> = ({ content, classNa
};
const processInlineMarkdown = (text: string): React.ReactNode => {
let processed = text;
const processed = text;
const elements: React.ReactNode[] = [];
let lastIndex = 0;
@ -55,7 +55,7 @@ export const SimpleMarkdown: React.FC<SimpleMarkdownProps> = ({ content, classNa
// Process *italic* text
const italicRegex = /\*(.*?)\*/g;
let remainingText = processed.slice(lastIndex);
const remainingText = processed.slice(lastIndex);
lastIndex = 0;
const italicElements: React.ReactNode[] = [];

View File

@ -4,11 +4,11 @@ import { Card } from '../ui/Card';
import { Button } from '../ui/Button';
import { useToast } from '../../contexts/ToastContext';
type IDE = 'claude' | 'windsurf' | 'cursor';
type RuleType = 'claude' | 'universal';
export const IDEGlobalRules = () => {
const [copied, setCopied] = useState(false);
const [selectedIDE, setSelectedIDE] = useState<IDE>('claude');
const [selectedRuleType, setSelectedRuleType] = useState<RuleType>('claude');
const { showToast } = useToast();
const claudeRules = `# CRITICAL: ARCHON-FIRST RULE - READ THIS FIRST
@ -355,7 +355,7 @@ archon:manage_task(
- [ ] Basic functionality tested
- [ ] Documentation updated if needed`;
const genericRules = `# Archon Integration & Workflow
const universalRules = `# Archon Integration & Workflow
**CRITICAL: This project uses Archon for knowledge management, task tracking, and project organization.**
@ -378,13 +378,7 @@ archon:manage_task(
- Maintain task descriptions and add implementation notes
- DO NOT MAKE ASSUMPTIONS - check project documentation for questions`;
const ideRules = {
claude: claudeRules,
windsurf: genericRules,
cursor: genericRules
};
const currentRules = ideRules[selectedIDE];
const currentRules = selectedRuleType === 'claude' ? claudeRules : universalRules;
// Simple markdown parser for display
const renderMarkdown = (text: string) => {
@ -481,7 +475,7 @@ archon:manage_task(
try {
await navigator.clipboard.writeText(currentRules);
setCopied(true);
showToast(`${selectedIDE.charAt(0).toUpperCase() + selectedIDE.slice(1)} rules copied to clipboard!`, 'success');
showToast(`${selectedRuleType === 'claude' ? 'Claude Code' : 'Universal'} rules copied to clipboard!`, 'success');
// Reset copy icon after 2 seconds
setTimeout(() => {
@ -494,94 +488,57 @@ archon:manage_task(
};
return (
<Card accentColor="pink" className="p-8">
<Card accentColor="blue" className="p-8">
<div className="space-y-6">
<div className="flex justify-between items-start">
<p className="text-sm text-gray-600 dark:text-zinc-400 w-4/5">
Add Global rules to your IDE to increase the consistency of the workflow.
Add global rules to your AI assistant to ensure consistent Archon workflow integration.
</p>
<Button
variant="outline"
accentColor="pink"
accentColor="blue"
icon={copied ? <Check className="w-4 h-4 mr-1" /> : <Copy className="w-4 h-4 mr-1" />}
className="ml-auto whitespace-nowrap px-4 py-2"
size="md"
onClick={handleCopyToClipboard}
>
{copied ? 'Copied!' : `Copy ${selectedIDE.charAt(0).toUpperCase() + selectedIDE.slice(1)} Rules`}
{copied ? 'Copied!' : `Copy ${selectedRuleType === 'claude' ? 'Claude Code' : 'Universal'} Rules`}
</Button>
</div>
{/* IDE Cards Section */}
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
{/* Cursor Card */}
<div
onClick={() => setSelectedIDE('cursor')}
className={`relative p-4 rounded-xl cursor-pointer transition-all duration-200 ${
selectedIDE === 'cursor'
? 'bg-gradient-to-br from-gray-800/50 to-gray-900/40 dark:from-white/50 dark:to-gray-200/40 border-2 border-gray-500/50 shadow-[0_0_20px_rgba(107,114,128,0.3)]'
: 'bg-gradient-to-br from-gray-800/30 to-gray-900/20 dark:from-white/30 dark:to-gray-200/20 border border-gray-500/30 shadow-lg hover:shadow-[0_0_15px_rgba(107,114,128,0.2)]'
}`}
>
<div className="flex items-center gap-2 mb-2">
<img src="/img/cursor.svg" alt="Cursor" className="w-5 h-5 filter invert dark:invert-0" />
<h3 className="text-sm font-semibold text-gray-800 dark:text-white">Cursor</h3>
{selectedIDE === 'cursor' && (
<Check className="w-4 h-4 ml-auto text-gray-600 dark:text-gray-300" />
)}
</div>
<p className="text-xs text-gray-600 dark:text-gray-400">
Create .cursorrules file in project root or use Settings Rules
</p>
</div>
{/* Rule Type Selector */}
<fieldset className="flex items-center space-x-6">
<legend className="sr-only">Select rule type</legend>
<label className="flex items-center cursor-pointer">
<input
type="radio"
name="ruleType"
value="claude"
checked={selectedRuleType === 'claude'}
onChange={() => setSelectedRuleType('claude')}
className="mr-2 text-blue-500 focus:ring-blue-500"
aria-label="Claude Code Rules - Comprehensive Archon workflow instructions for Claude"
/>
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">Claude Code Rules</span>
</label>
<label className="flex items-center cursor-pointer">
<input
type="radio"
name="ruleType"
value="universal"
checked={selectedRuleType === 'universal'}
onChange={() => setSelectedRuleType('universal')}
className="mr-2 text-blue-500 focus:ring-blue-500"
aria-label="Universal Agent Rules - Simplified workflow for all other AI agents"
/>
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">Universal Agent Rules</span>
</label>
</fieldset>
{/* Windsurf Card */}
<div
onClick={() => setSelectedIDE('windsurf')}
className={`relative p-4 rounded-xl cursor-pointer transition-all duration-200 ${
selectedIDE === 'windsurf'
? 'bg-gradient-to-br from-emerald-500/50 to-green-600/40 border-2 border-emerald-500/50 shadow-[0_0_20px_rgba(16,185,129,0.3)]'
: 'bg-gradient-to-br from-emerald-500/30 to-green-600/20 border border-emerald-500/30 shadow-lg hover:shadow-[0_0_15px_rgba(16,185,129,0.2)]'
}`}
>
<div className="flex items-center gap-2 mb-2">
<img src="/img/windsurf-white-symbol.svg" alt="Windsurf" className="w-5 h-5" />
<h3 className="text-sm font-semibold text-gray-800 dark:text-white">Windsurf</h3>
{selectedIDE === 'windsurf' && (
<Check className="w-4 h-4 ml-auto text-emerald-600 dark:text-emerald-300" />
)}
</div>
<p className="text-xs text-gray-600 dark:text-gray-400">
Create .windsurfrules file in project root or use IDE settings
</p>
</div>
{/* Claude Card */}
<div
onClick={() => setSelectedIDE('claude')}
className={`relative p-4 rounded-xl cursor-pointer transition-all duration-200 ${
selectedIDE === 'claude'
? 'bg-gradient-to-br from-orange-500/50 to-orange-600/40 border-2 border-orange-500/50 shadow-[0_0_20px_rgba(251,146,60,0.3)]'
: 'bg-gradient-to-br from-orange-500/30 to-orange-600/20 border border-orange-500/30 shadow-lg hover:shadow-[0_0_15px_rgba(251,146,60,0.2)]'
}`}
>
<div className="flex items-center gap-2 mb-2">
<img src="/img/claude-logo.svg" alt="Claude" className="w-5 h-5" />
<h3 className="text-sm font-semibold text-gray-800 dark:text-white">Claude Code</h3>
{selectedIDE === 'claude' && (
<Check className="w-4 h-4 ml-auto text-orange-600 dark:text-orange-300" />
)}
</div>
<p className="text-xs text-gray-600 dark:text-gray-400">
Create CLAUDE.md file in project root for Claude Code integration
</p>
</div>
</div>
<div className="border border-blue-200 dark:border-blue-800/30 bg-gradient-to-br from-blue-500/10 to-blue-600/10 backdrop-blur-sm rounded-md h-[570px] flex flex-col">
<div className="border border-blue-200 dark:border-blue-800/30 bg-gradient-to-br from-blue-500/10 to-blue-600/10 backdrop-blur-sm rounded-md h-[400px] flex flex-col">
<div className="p-4 pb-2 border-b border-blue-200/50 dark:border-blue-800/30">
<h3 className="text-base font-semibold text-gray-800 dark:text-white">
{selectedIDE.charAt(0).toUpperCase() + selectedIDE.slice(1)} Rules
{selectedRuleType === 'claude' ? 'Claude Code' : 'Universal Agent'} Rules
</h3>
</div>
<div className="flex-1 overflow-y-auto p-4 custom-scrollbar">
@ -591,16 +548,17 @@ archon:manage_task(
</div>
</div>
{/* Security Note */}
<div className="p-3 bg-gray-50 dark:bg-black/40 rounded-md flex items-start gap-3">
<div className="w-5 h-5 text-blue-500 mt-0.5 flex-shrink-0">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" />
</svg>
</div>
{/* Info Note */}
<div className="p-3 bg-blue-50 dark:bg-blue-900/20 rounded-md">
<p className="text-sm text-gray-600 dark:text-gray-400">
Adding global rules to your IDE helps maintain consistency across your project and ensures all team members follow the same workflow.
<strong>Where to place these rules:</strong>
</p>
<ul className="text-sm text-gray-600 dark:text-gray-400 mt-2 ml-4 list-disc">
<li><strong>Claude Code:</strong> Create a CLAUDE.md file in your project root</li>
<li><strong>Cursor:</strong> Create .cursorrules file or add to Settings Rules</li>
<li><strong>Windsurf:</strong> Create .windsurfrules file in project root</li>
<li><strong>Other IDEs:</strong> Add to your IDE's AI assistant configuration</li>
</ul>
</div>
</div>
</Card>

View File

@ -177,7 +177,7 @@ export const TestStatus = () => {
const handleStreamMessage = (testType: TestType, message: TestStreamMessage) => {
updateTestState(testType, (prev) => {
const newLogs = [...prev.logs];
let newResults = [...prev.results];
const newResults = [...prev.results];
switch (message.type) {
case 'status':

View File

@ -567,8 +567,8 @@ export const KnowledgeBasePage = () => {
// Show success toast
const message = data.uploadType === 'document'
? `Document "${data.fileName}" uploaded successfully! ${data.chunksStored || 0} chunks stored.`
: `Crawling completed for ${data.currentUrl}! ${data.chunksStored || 0} chunks stored.`;
? `Document "${data.fileName}" uploaded successfully!`
: `Crawling completed for ${data.currentUrl}!`;
showToast(message, 'success');
// Remove from progress items after a brief delay to show completion

View File

@ -6,8 +6,12 @@ import { Button } from '../components/ui/Button';
import { useStaggeredEntrance } from '../hooks/useStaggeredEntrance';
import { useToast } from '../contexts/ToastContext';
import { mcpServerService, ServerStatus, LogEntry, ServerConfig } from '../services/mcpServerService';
import { IDEGlobalRules } from '../components/settings/IDEGlobalRules';
// import { MCPClients } from '../components/mcp/MCPClients'; // Commented out - feature not implemented
// Supported IDE/Agent types
type SupportedIDE = 'windsurf' | 'cursor' | 'claudecode' | 'cline' | 'kiro' | 'augment';
/**
* MCP Dashboard Page Component
*
@ -43,7 +47,7 @@ export const MCPPage = () => {
const [isLoading, setIsLoading] = useState(true);
const [isStarting, setIsStarting] = useState(false);
const [isStopping, setIsStopping] = useState(false);
const [selectedIDE, setSelectedIDE] = useState<'windsurf' | 'cursor' | 'claudecode'>('windsurf');
const [selectedIDE, setSelectedIDE] = useState<SupportedIDE>('windsurf');
const logsEndRef = useRef<HTMLDivElement>(null);
const logsContainerRef = useRef<HTMLDivElement>(null);
const statusPollInterval = useRef<NodeJS.Timeout | null>(null);
@ -213,41 +217,58 @@ export const MCPPage = () => {
const getConfigForIDE = (ide: 'windsurf' | 'cursor' | 'claudecode') => {
if (!config) return '';
const getConfigForIDE = (ide: SupportedIDE) => {
if (!config || !config.host || !config.port) {
return '// Configuration not available. Please ensure the server is running.';
}
if (ide === 'cursor') {
// Cursor connecting to Streamable HTTP server
const cursorConfig = {
mcpServers: {
archon: {
url: `http://${config.host}:${config.port}/mcp`
}
}
};
return JSON.stringify(cursorConfig, null, 2);
} else if (ide === 'windsurf') {
// Windsurf can use Streamable HTTP transport
const windsurfConfig = {
mcpServers: {
archon: {
"serverUrl": `http://${config.host}:${config.port}/mcp`
}
}
};
return JSON.stringify(windsurfConfig, null, 2);
} else {
// Claude Code uses CLI commands, show HTTP config as example
const claudeConfig = {
const mcpUrl = `http://${config.host}:${config.port}/mcp`;
switch(ide) {
case 'claudecode':
return JSON.stringify({
name: "archon",
transport: "http",
url: `http://${config.host}:${config.port}/mcp`
};
return JSON.stringify(claudeConfig, null, 2);
url: mcpUrl
}, null, 2);
case 'cline':
case 'kiro':
// Cline and Kiro use stdio transport with mcp-remote
return JSON.stringify({
mcpServers: {
archon: {
command: "npx",
args: ["mcp-remote", mcpUrl]
}
}
}, null, 2);
case 'windsurf':
return JSON.stringify({
mcpServers: {
archon: {
serverUrl: mcpUrl
}
}
}, null, 2);
case 'cursor':
case 'augment':
return JSON.stringify({
mcpServers: {
archon: {
url: mcpUrl
}
}
}, null, 2);
default:
return '';
}
};
const getIDEInstructions = (ide: 'windsurf' | 'cursor' | 'claudecode') => {
const getIDEInstructions = (ide: SupportedIDE) => {
switch (ide) {
case 'windsurf':
return {
@ -278,6 +299,42 @@ export const MCPPage = () => {
'3. The connection will be established automatically'
]
};
case 'cline':
return {
title: 'Cline Configuration',
steps: [
'1. Open VS Code settings (Cmd/Ctrl + ,)',
'2. Search for "cline.mcpServers"',
'3. Click "Edit in settings.json"',
'4. Add the configuration shown below',
'5. Restart VS Code for changes to take effect'
]
};
case 'kiro':
return {
title: 'Kiro Configuration',
steps: [
'1. Open Kiro settings',
'2. Navigate to MCP Servers section',
'3. Add the configuration shown below',
'4. Save and restart Kiro'
]
};
case 'augment':
return {
title: 'Augment Configuration',
steps: [
'1. Open Augment settings',
'2. Navigate to Extensions > MCP',
'3. Add the configuration shown below',
'4. Reload configuration'
]
};
default:
return {
title: 'Configuration',
steps: ['Add the configuration to your IDE settings']
};
}
};
@ -483,16 +540,16 @@ export const MCPPage = () => {
{/* IDE Selection Tabs */}
<div className="mb-4">
<div className="flex border-b border-gray-200 dark:border-zinc-700 mb-3">
<div className="flex flex-wrap border-b border-gray-200 dark:border-zinc-700 mb-3">
<button
onClick={() => setSelectedIDE('windsurf')}
onClick={() => setSelectedIDE('claudecode')}
className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${
selectedIDE === 'windsurf'
selectedIDE === 'claudecode'
? 'border-blue-500 text-blue-600 dark:text-blue-400'
: 'border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-300'
} cursor-pointer`}
>
Windsurf
Claude Code
</button>
<button
onClick={() => setSelectedIDE('cursor')}
@ -505,14 +562,44 @@ export const MCPPage = () => {
Cursor
</button>
<button
onClick={() => setSelectedIDE('claudecode')}
onClick={() => setSelectedIDE('windsurf')}
className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${
selectedIDE === 'claudecode'
selectedIDE === 'windsurf'
? 'border-blue-500 text-blue-600 dark:text-blue-400'
: 'border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-300'
} cursor-pointer`}
>
Claude Code
Windsurf
</button>
<button
onClick={() => setSelectedIDE('cline')}
className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${
selectedIDE === 'cline'
? 'border-blue-500 text-blue-600 dark:text-blue-400'
: 'border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-300'
} cursor-pointer`}
>
Cline
</button>
<button
onClick={() => setSelectedIDE('kiro')}
className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${
selectedIDE === 'kiro'
? 'border-blue-500 text-blue-600 dark:text-blue-400'
: 'border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-300'
} cursor-pointer`}
>
Kiro
</button>
<button
onClick={() => setSelectedIDE('augment')}
className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${
selectedIDE === 'augment'
? 'border-blue-500 text-blue-600 dark:text-blue-400'
: 'border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-300'
} cursor-pointer`}
>
Augment
</button>
</div>
</div>
@ -538,7 +625,15 @@ export const MCPPage = () => {
? 'Copy this configuration and add it to ~/.cursor/mcp.json'
: selectedIDE === 'windsurf'
? 'Copy this configuration and add it to your Windsurf MCP settings'
: 'This shows the configuration format for Claude Code'
: selectedIDE === 'claudecode'
? 'This shows the configuration format for Claude Code'
: selectedIDE === 'cline'
? 'Copy this configuration and add it to VS Code settings.json under "cline.mcpServers"'
: selectedIDE === 'kiro'
? 'Copy this configuration and add it to your Kiro MCP settings'
: selectedIDE === 'augment'
? 'Copy this configuration and add it to your Augment MCP settings'
: 'Copy this configuration and add it to your IDE settings'
}
</p>
</div>
@ -623,6 +718,15 @@ export const MCPPage = () => {
</Card>
</div>
</motion.div>
{/* Global Rules Section */}
<motion.div className="mt-6" variants={itemVariants}>
<h2 className="text-xl font-semibold text-gray-800 dark:text-white mb-4 flex items-center">
<Server className="mr-2 text-pink-500" size={20} />
Global IDE Rules
</h2>
<IDEGlobalRules />
</motion.div>
</>
)}

View File

@ -0,0 +1,163 @@
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { motion } from 'framer-motion';
import { Sparkles, Key, Check, ArrowRight } from 'lucide-react';
import { Button } from '../components/ui/Button';
import { Card } from '../components/ui/Card';
import { ProviderStep } from '../components/onboarding/ProviderStep';
export const OnboardingPage = () => {
const [currentStep, setCurrentStep] = useState(1);
const navigate = useNavigate();
const handleProviderSaved = () => {
setCurrentStep(3);
};
const handleProviderSkip = () => {
// Navigate to settings with guidance
navigate('/settings');
};
const handleComplete = () => {
// Mark onboarding as dismissed and navigate to home
localStorage.setItem('onboardingDismissed', 'true');
navigate('/');
};
const containerVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1
}
}
};
const itemVariants = {
hidden: { opacity: 0, y: 20 },
visible: {
opacity: 1,
y: 0,
transition: { duration: 0.5 }
}
};
return (
<div className="min-h-screen flex items-center justify-center p-8">
<motion.div
initial="hidden"
animate="visible"
variants={containerVariants}
className="w-full max-w-2xl"
>
{/* Progress Indicators */}
<motion.div variants={itemVariants} className="flex justify-center mb-8 gap-3">
{[1, 2, 3].map((step) => (
<div
key={step}
className={`h-2 w-16 rounded-full transition-colors duration-300 ${
step <= currentStep
? 'bg-blue-500'
: 'bg-gray-200 dark:bg-zinc-800'
}`}
/>
))}
</motion.div>
{/* Step 1: Welcome */}
{currentStep === 1 && (
<motion.div variants={itemVariants}>
<Card className="p-12 text-center">
<div className="flex justify-center mb-6">
<div className="w-20 h-20 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center">
<Sparkles className="w-10 h-10 text-white" />
</div>
</div>
<h1 className="text-3xl font-bold text-gray-800 dark:text-white mb-4">
Welcome to Archon
</h1>
<p className="text-lg text-gray-600 dark:text-zinc-400 mb-8 max-w-md mx-auto">
Let's get you set up with your AI provider in just a few steps. This will enable intelligent knowledge retrieval and code assistance.
</p>
<Button
variant="primary"
size="lg"
icon={<ArrowRight className="w-5 h-5 ml-2" />}
iconPosition="right"
onClick={() => setCurrentStep(2)}
className="min-w-[200px]"
>
Get Started
</Button>
</Card>
</motion.div>
)}
{/* Step 2: Provider Setup */}
{currentStep === 2 && (
<motion.div variants={itemVariants}>
<Card className="p-12">
<div className="flex items-center mb-6">
<div className="w-12 h-12 rounded-full bg-gradient-to-br from-green-500 to-teal-600 flex items-center justify-center mr-4">
<Key className="w-6 h-6 text-white" />
</div>
<h2 className="text-2xl font-bold text-gray-800 dark:text-white">
Configure AI Provider
</h2>
</div>
<ProviderStep
onSaved={handleProviderSaved}
onSkip={handleProviderSkip}
/>
</Card>
</motion.div>
)}
{/* Step 3: All Set */}
{currentStep === 3 && (
<motion.div variants={itemVariants}>
<Card className="p-12 text-center">
<div className="flex justify-center mb-6">
<motion.div
initial={{ scale: 0 }}
animate={{ scale: 1 }}
transition={{
type: "spring",
stiffness: 260,
damping: 20
}}
className="w-20 h-20 rounded-full bg-gradient-to-br from-green-500 to-emerald-600 flex items-center justify-center"
>
<Check className="w-10 h-10 text-white" />
</motion.div>
</div>
<h1 className="text-3xl font-bold text-gray-800 dark:text-white mb-4">
All Set!
</h1>
<p className="text-lg text-gray-600 dark:text-zinc-400 mb-8 max-w-md mx-auto">
You're ready to start using Archon. Begin by adding knowledge sources through website crawling or document uploads.
</p>
<Button
variant="primary"
size="lg"
onClick={handleComplete}
className="min-w-[200px]"
>
Start Using Archon
</Button>
</Card>
</motion.div>
)}
</motion.div>
</div>
);
};

View File

@ -121,9 +121,9 @@ class CredentialsService {
const settings: RagSettings = {
USE_CONTEXTUAL_EMBEDDINGS: false,
CONTEXTUAL_EMBEDDINGS_MAX_WORKERS: 3,
USE_HYBRID_SEARCH: false,
USE_AGENTIC_RAG: false,
USE_RERANKING: false,
USE_HYBRID_SEARCH: true,
USE_AGENTIC_RAG: true,
USE_RERANKING: true,
MODEL_CHOICE: 'gpt-4.1-nano',
LLM_PROVIDER: 'openai',
LLM_BASE_URL: '',

View File

@ -0,0 +1,79 @@
export interface NormalizedCredential {
key: string;
value?: string;
encrypted_value?: string | null;
is_encrypted?: boolean;
category: string;
}
export interface ProviderInfo {
provider?: string;
}
/**
* Determines if LM (Language Model) is configured based on credentials
*
* Logic:
* - provider := value of 'LLM_PROVIDER' from ragCreds (if present)
* - if provider === 'openai': check for valid OPENAI_API_KEY
* - if provider === 'google' or 'gemini': check for valid GOOGLE_API_KEY
* - if provider === 'ollama': return true (local, no API key needed)
* - if no provider: check for any valid API key (OpenAI or Google)
*/
export function isLmConfigured(
ragCreds: NormalizedCredential[],
apiKeyCreds: NormalizedCredential[]
): boolean {
// Find the LLM_PROVIDER setting from RAG credentials
const providerCred = ragCreds.find(c => c.key === 'LLM_PROVIDER');
const provider = providerCred?.value?.toLowerCase();
// Debug logging
console.log('🔎 isLmConfigured - Provider:', provider);
console.log('🔎 isLmConfigured - API Keys:', apiKeyCreds.map(c => ({
key: c.key,
value: c.value,
encrypted_value: c.encrypted_value,
is_encrypted: c.is_encrypted,
hasValidValue: !!(c.value && c.value !== 'null' && c.value !== null)
})));
// Helper function to check if a credential has a valid value
const hasValidCredential = (cred: NormalizedCredential | undefined): boolean => {
if (!cred) return false;
return !!(
(cred.value && cred.value !== 'null' && cred.value !== null && cred.value.trim() !== '') ||
(cred.is_encrypted && cred.encrypted_value && cred.encrypted_value !== 'null' && cred.encrypted_value !== null)
);
};
// Find API keys
const openAIKeyCred = apiKeyCreds.find(c => c.key.toUpperCase() === 'OPENAI_API_KEY');
const googleKeyCred = apiKeyCreds.find(c => c.key.toUpperCase() === 'GOOGLE_API_KEY');
const hasOpenAIKey = hasValidCredential(openAIKeyCred);
const hasGoogleKey = hasValidCredential(googleKeyCred);
console.log('🔎 isLmConfigured - OpenAI key valid:', hasOpenAIKey);
console.log('🔎 isLmConfigured - Google key valid:', hasGoogleKey);
// Check based on provider
if (provider === 'openai') {
// OpenAI provider requires OpenAI API key
return hasOpenAIKey;
} else if (provider === 'google' || provider === 'gemini') {
// Google/Gemini provider requires Google API key
return hasGoogleKey;
} else if (provider === 'ollama') {
// Ollama is local, doesn't need API key
return true;
} else if (provider) {
// Unknown provider, assume it doesn't need an API key
console.log('🔎 isLmConfigured - Unknown provider, assuming configured:', provider);
return true;
} else {
// No provider specified, check if ANY API key is configured
// This allows users to configure either OpenAI or Google without specifying provider
return hasOpenAIKey || hasGoogleKey;
}
}

View File

@ -1,6 +1,13 @@
import { render, screen } from '@testing-library/react'
import { describe, test, expect } from 'vitest'
import { describe, test, expect, vi } from 'vitest'
import React from 'react'
import { isLmConfigured } from '../src/utils/onboarding'
import type { NormalizedCredential } from '../src/utils/onboarding'
// Mock useNavigate for onboarding page test
vi.mock('react-router-dom', () => ({
useNavigate: () => vi.fn()
}))
describe('Page Load Tests', () => {
test('simple page component renders', () => {
@ -42,4 +49,68 @@ describe('Page Load Tests', () => {
expect(screen.getByText('In Progress')).toBeInTheDocument()
expect(screen.getByText('Done')).toBeInTheDocument()
})
test('onboarding page renders', () => {
const MockOnboardingPage = () => <h1>Welcome to Archon</h1>
render(<MockOnboardingPage />)
expect(screen.getByText('Welcome to Archon')).toBeInTheDocument()
})
})
describe('Onboarding Detection Tests', () => {
test('isLmConfigured returns true when provider is openai and OPENAI_API_KEY exists', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'openai', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = [
{ key: 'OPENAI_API_KEY', value: 'sk-test123', category: 'api_keys' }
]
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns true when provider is openai and OPENAI_API_KEY is encrypted', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'openai', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = [
{ key: 'OPENAI_API_KEY', is_encrypted: true, category: 'api_keys' }
]
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns false when provider is openai and no OPENAI_API_KEY', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'openai', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = []
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(false)
})
test('isLmConfigured returns true when provider is ollama regardless of API keys', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'ollama', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = []
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns true when no provider but OPENAI_API_KEY exists', () => {
const ragCreds: NormalizedCredential[] = []
const apiKeyCreds: NormalizedCredential[] = [
{ key: 'OPENAI_API_KEY', value: 'sk-test123', category: 'api_keys' }
]
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns false when no provider and no OPENAI_API_KEY', () => {
const ragCreds: NormalizedCredential[] = []
const apiKeyCreds: NormalizedCredential[] = []
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(false)
})
})

View File

@ -19,15 +19,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
const internalHost = 'archon-server'; // Docker service name for internal communication
const externalHost = process.env.HOST || 'localhost'; // Host for external access
const host = isDocker ? internalHost : externalHost;
const port = process.env.ARCHON_SERVER_PORT;
if (!port) {
throw new Error(
'ARCHON_SERVER_PORT environment variable is required. ' +
'Please set it in your .env file or environment. ' +
'Default value: 8181'
);
}
const port = process.env.ARCHON_SERVER_PORT || env.ARCHON_SERVER_PORT || '8181';
return {
plugins: [

View File

@ -75,11 +75,11 @@ INSERT INTO archon_settings (key, value, is_encrypted, category, description) VA
-- RAG Strategy Configuration (all default to true)
INSERT INTO archon_settings (key, value, is_encrypted, category, description) VALUES
('USE_CONTEXTUAL_EMBEDDINGS', 'true', true, 'rag_strategy', 'Enhances embeddings with contextual information for better retrieval'),
('USE_CONTEXTUAL_EMBEDDINGS', 'false', false, 'rag_strategy', 'Enhances embeddings with contextual information for better retrieval'),
('CONTEXTUAL_EMBEDDINGS_MAX_WORKERS', '3', false, 'rag_strategy', 'Maximum parallel workers for contextual embedding generation (1-10)'),
('USE_HYBRID_SEARCH', 'true', true, 'rag_strategy', 'Combines vector similarity search with keyword search for better results'),
('USE_AGENTIC_RAG', 'true', true, 'rag_strategy', 'Enables code example extraction, storage, and specialized code search functionality'),
('USE_RERANKING', 'true', true, 'rag_strategy', 'Applies cross-encoder reranking to improve search result relevance');
('USE_HYBRID_SEARCH', 'true', false, 'rag_strategy', 'Combines vector similarity search with keyword search for better results'),
('USE_AGENTIC_RAG', 'true', false, 'rag_strategy', 'Enables code example extraction, storage, and specialized code search functionality'),
('USE_RERANKING', 'true', false, 'rag_strategy', 'Applies cross-encoder reranking to improve search result relevance');
-- Monitoring Configuration
INSERT INTO archon_settings (key, value, is_encrypted, category, description) VALUES

View File

@ -554,13 +554,12 @@ async def create_task(request: CreateTaskRequest):
async def list_tasks(
status: str | None = None,
project_id: str | None = None,
parent_task_id: str | None = None,
include_closed: bool = False,
page: int = 1,
per_page: int = 50,
exclude_large_fields: bool = False,
):
"""List tasks with optional filters including status, project, and parent task."""
"""List tasks with optional filters including status and project."""
try:
logfire.info(
f"Listing tasks | status={status} | project_id={project_id} | include_closed={include_closed} | page={page} | per_page={per_page}"
@ -570,7 +569,6 @@ async def list_tasks(
task_service = TaskService()
success, result = task_service.list_tasks(
project_id=project_id,
parent_task_id=parent_task_id,
status=status,
include_closed=include_closed,
)

View File

@ -30,9 +30,9 @@ class RAGStrategyConfig:
"""Configuration for RAG strategies."""
use_contextual_embeddings: bool = False
use_hybrid_search: bool = False
use_agentic_rag: bool = False
use_reranking: bool = False
use_hybrid_search: bool = True
use_agentic_rag: bool = True
use_reranking: bool = True
def validate_openai_api_key(api_key: str) -> bool:

View File

@ -837,7 +837,7 @@ async def add_code_examples_to_supabase(
full_documents.append(full_doc)
# Generate contextual embeddings
contextual_results = generate_contextual_embeddings_batch(
contextual_results = await generate_contextual_embeddings_batch(
full_documents, combined_texts
)

View File

@ -205,9 +205,9 @@ async def add_documents_to_supabase(
sub_batch_contents = batch_contents[ctx_i:ctx_end]
sub_batch_docs = full_documents[ctx_i:ctx_end]
# Process sub-batch with a single API call using asyncio.to_thread
sub_results = await asyncio.to_thread(
generate_contextual_embeddings_batch, sub_batch_docs, sub_batch_contents
# Process sub-batch with a single API call
sub_results = await generate_contextual_embeddings_batch(
sub_batch_docs, sub_batch_contents
)
# Extract results from this sub-batch