fixed LLM provider config warning issue

This commit is contained in:
abhigyanpatwari 2026-01-09 21:06:31 +05:30
parent 65004450da
commit 0a42fe46ac
3 changed files with 39 additions and 4 deletions

View file

@ -10,6 +10,7 @@ import { StatusBar } from './components/StatusBar';
import { FileTreePanel } from './components/FileTreePanel';
import { CodeReferencesPanel } from './components/CodeReferencesPanel';
import { FileEntry } from './services/zip';
import { getActiveProviderConfig } from './core/llm/settings-service';
const AppContent = () => {
const {
@ -49,6 +50,12 @@ const AppContent = () => {
setGraph(result.graph);
setFileContents(result.fileContents);
setViewMode('exploring');
// Initialize (or re-initialize) the agent AFTER a repo loads so it captures
// the current codebase context (file contents + graph tools) in the worker.
if (getActiveProviderConfig()) {
initializeAgent();
}
// Auto-start embeddings pipeline in background
// Uses WebGPU if available, falls back to WASM
@ -73,7 +80,7 @@ const AppContent = () => {
setProgress(null);
}, 3000);
}
}, [setViewMode, setGraph, setFileContents, setProgress, setProjectName, runPipeline, startEmbeddings]);
}, [setViewMode, setGraph, setFileContents, setProgress, setProjectName, runPipeline, startEmbeddings, initializeAgent]);
const handleGitClone = useCallback(async (files: FileEntry[]) => {
// Extract project name from first file path (e.g., "owner-repo-123/src/..." -> "owner-repo")
@ -91,6 +98,12 @@ const AppContent = () => {
setGraph(result.graph);
setFileContents(result.fileContents);
setViewMode('exploring');
// Initialize (or re-initialize) the agent AFTER a repo loads so it captures
// the current codebase context (file contents + graph tools) in the worker.
if (getActiveProviderConfig()) {
initializeAgent();
}
// Auto-start embeddings pipeline in background
// Uses WebGPU if available, falls back to WASM
@ -115,7 +128,7 @@ const AppContent = () => {
setProgress(null);
}, 3000);
}
}, [setViewMode, setGraph, setFileContents, setProgress, setProjectName, runPipelineFromFiles, startEmbeddings]);
}, [setViewMode, setGraph, setFileContents, setProgress, setProjectName, runPipelineFromFiles, startEmbeddings, initializeAgent]);
const handleFocusNode = useCallback((nodeId: string) => {
graphCanvasRef.current?.focusNode(nodeId);

View file

@ -8,6 +8,7 @@ import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
import ReactMarkdown from 'react-markdown';
import { useAppState } from '../hooks/useAppState';
import { ToolCallCard } from './ToolCallCard';
import { isProviderConfigured } from '../core/llm/settings-service';
// Custom syntax theme
const customTheme = {
@ -492,7 +493,11 @@ export const RightPanel = () => {
{!isAgentReady && !isAgentInitializing && (
<div className="mt-2 text-xs text-amber-200 flex items-center gap-2">
<AlertTriangle className="w-3.5 h-3.5" />
<span>Configure an LLM provider to enable chat.</span>
<span>
{isProviderConfigured()
? 'Initializing AI agent...'
: 'Configure an LLM provider to enable chat.'}
</span>
</div>
)}
</div>

View file

@ -520,6 +520,23 @@ export const AppStateProvider = ({ children }: { children: ReactNode }) => {
timestamp: Date.now(),
};
setChatMessages(prev => [...prev, userMessage]);
// If embeddings are running and we're currently creating the vector index,
// avoid a confusing "Embeddings not ready" error and give a clear wait message.
if (embeddingStatus === 'indexing') {
const assistantMessage: ChatMessage = {
id: `assistant-${Date.now()}`,
role: 'assistant',
content: 'Wait a moment, vector index is being created.',
timestamp: Date.now(),
};
setChatMessages(prev => [...prev, assistantMessage]);
setAgentError(null);
setIsChatLoading(false);
setCurrentToolCalls([]);
return;
}
setIsChatLoading(true);
setCurrentToolCalls([]);
@ -778,7 +795,7 @@ export const AppStateProvider = ({ children }: { children: ReactNode }) => {
setIsChatLoading(false);
setCurrentToolCalls([]);
}
}, [chatMessages, isAgentReady, initializeAgent, resolveFilePath, findFileNodeId, addCodeReference, clearAICodeReferences, clearAIToolHighlights, graph]);
}, [chatMessages, isAgentReady, initializeAgent, resolveFilePath, findFileNodeId, addCodeReference, clearAICodeReferences, clearAIToolHighlights, graph, embeddingStatus]);
const clearChat = useCallback(() => {
setChatMessages([]);