Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
05f9409
ai-plugin: add mcp adapter
ashu8912 Sep 4, 2025
a80411d
ai-plugin: Add mcp setting and electron mcp client
ashu8912 Sep 8, 2025
9fe36b2
ai-plugin: Use mcp settings
ashu8912 Sep 8, 2025
5effb17
ai-plugin: Add ability to approve a tool request
ashu8912 Sep 8, 2025
4aba648
ai-plugin: Fix tool response and update MCPSettings
ashu8912 Sep 10, 2025
7353da6
feat: add MCP output formatting and display components
ashu8912 Sep 21, 2025
31be365
ai-plugin: Add prompt width context for component state management
ashu8912 Sep 21, 2025
0b16261
ai-plugin: Add inline tool approval system
ashu8912 Sep 21, 2025
cb1c90a
ai-plugin: Add tools dialog for managing available tools
ashu8912 Sep 21, 2025
3bd3d41
ai-plugin: Enhance tool manager with retry functionality and MCP inte…
ashu8912 Sep 21, 2025
55d1180
ai-plugin: Integrate MCP components with content rendering system
ashu8912 Sep 21, 2025
6ed69d7
ai-plugin: Enhance AI modal with retry functionality and tool management
ashu8912 Sep 21, 2025
4342f93
ai-plugin: Enhance LangChain manager with advanced tool processing
ashu8912 Sep 21, 2025
0a5b98c
ai-plugin: Add advanced MCP configuration editor dialog
ashu8912 Sep 21, 2025
e936f75
ai-plugin: Enhance MCP settings with editor dialog integration
ashu8912 Sep 21, 2025
c503444
ai-plugin: Add utility enhancements and helper functions
ashu8912 Sep 21, 2025
c6618f5
ai-plugin: Run formatter
ashu8912 Sep 21, 2025
4cf3a26
ai-plugin: Markdown rendering for document responses and UI fixes
ashu8912 Sep 23, 2025
d9d4301
ai-plugin: Enhance tool arguments through ai calls
ashu8912 Sep 23, 2025
f07c4f5
ai-plugin: Add search to mcp tools
ashu8912 Sep 29, 2025
7b2b249
ai-assistant: Fix rendering of messages especially with bullet points
joaquimrocha Sep 30, 2025
9891e50
ai-assistant: List MCP tools per MCP server in the tools dialog
joaquimrocha Sep 30, 2025
d3b05e2
ai-assistant: Add shortDescription to the Tool class
joaquimrocha Sep 30, 2025
b9bcb10
ai-assistant: Properly look for whether we are running in-desktop
joaquimrocha Sep 30, 2025
4a69bf4
ai-assistant: Add tool test prompts
joaquimrocha Sep 30, 2025
ddc8fbc
ai-assistant: Improve the tool UI and UX
joaquimrocha Sep 30, 2025
dab1c60
ai-plugin: Fix k8s tool call working
ashu8912 Oct 9, 2025
628ad14
ai-plugin: fix log fetch failures
ashu8912 Oct 9, 2025
18b7f67
ai-plugin: add missing tool response
ashu8912 Oct 10, 2025
82a0528
ai-plugin: Use mcp tools config update from electron main process
ashu8912 Oct 13, 2025
125b8aa
ai-plugin: Remove logs and cleanup
ashu8912 Oct 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
764 changes: 739 additions & 25 deletions ai-assistant/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions ai-assistant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@
"@langchain/community": "^0.3.42",
"@langchain/core": "^0.3.51",
"@langchain/google-genai": "^0.2.5",
"@langchain/langgraph": "^0.4.9",
"@langchain/mcp-adapters": "^0.6.0",
"@langchain/mistralai": "^0.2.0",
"@langchain/ollama": "^0.2.0",
"@langchain/openai": "^0.5.5",
"@modelcontextprotocol/sdk": "^1.17.5",
"@monaco-editor/react": "^4.5.2",
"@types/prismjs": "^1.26.5",
"@types/react-syntax-highlighter": "^15.5.13",
Expand Down
27 changes: 21 additions & 6 deletions ai-assistant/src/ContentRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Link as RouterLink, useHistory } from 'react-router-dom';
import remarkGfm from 'remark-gfm';
import YAML from 'yaml';
import { LogsButton, YamlDisplay } from './components';
import MCPFormattedMessage from './components/chat/MCPFormattedMessage';
import { getHeadlampLink } from './utils/promptLinkHelper';
import { parseKubernetesYAML } from './utils/SampleYamlLibrary';

Expand Down Expand Up @@ -87,6 +88,8 @@ const parseLogsButtonData = (content: string, logsButtonIndex: number): ParseRes
interface ContentRendererProps {
content: string;
onYamlDetected?: (yaml: string, resourceType: string) => void;
promptWidth?: string; // Add width prop
onRetryTool?: (toolName: string, args: Record<string, any>) => void;
}

// Table wrapper component with show more functionality - moved outside to preserve state
Expand Down Expand Up @@ -276,7 +279,7 @@ markdownComponents.li.displayName = 'MarkdownLi';
markdownComponents.blockquote.displayName = 'MarkdownBlockquote';

const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
({ content, onYamlDetected }) => {
({ content, onYamlDetected, onRetryTool }) => {
const history = useHistory();
// Create code component that has access to onYamlDetected
const CodeComponent = React.useMemo(() => {
Expand Down Expand Up @@ -524,7 +527,18 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
const processedContent = useMemo(() => {
if (!content) return null;

// First, check if content is a JSON response with error or success keys
// First, check if content is a formatted MCP output (pure JSON)
try {
const parsed = JSON.parse(content.trim());
if (parsed.formatted && parsed.mcpOutput) {
// This is a formatted MCP output, use our specialized component
return <MCPFormattedMessage content={content} isAssistant onRetryTool={onRetryTool} />;
}
} catch (error) {
// Not JSON or not formatted MCP output, continue with normal processing
}

// Second, check if content is a JSON response with error or success keys
const jsonParseResult = parseJsonContent(content.trim());
if (jsonParseResult.success) {
const parsedContent = jsonParseResult.data;
Expand Down Expand Up @@ -556,8 +570,8 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
<Box
component="pre"
sx={{
backgroundColor: theme => theme.palette.grey[100],
color: theme => theme.palette.grey[900],
backgroundColor: (theme: any) => theme.palette.grey[100],
color: (theme: any) => theme.palette.grey[900],
padding: 2,
borderRadius: 1,
overflowX: 'auto',
Expand Down Expand Up @@ -633,7 +647,7 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
{content}
</ReactMarkdown>
);
}, [content, onYamlDetected, processUnformattedYaml]);
}, [content, onYamlDetected, onRetryTool, processUnformattedYaml]);

return (
<Box sx={{ width: '100%', overflowWrap: 'break-word', wordWrap: 'break-word' }}>
Expand All @@ -645,7 +659,8 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
// Only re-render if content or onYamlDetected actually changed
return (
prevProps.content === nextProps.content &&
prevProps.onYamlDetected === nextProps.onYamlDetected
prevProps.onYamlDetected === nextProps.onYamlDetected &&
prevProps.onRetryTool === nextProps.onRetryTool
);
}
);
Expand Down
16 changes: 16 additions & 0 deletions ai-assistant/src/ai/manager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
export type ToolCall = {
id: string;
name: string;
description?: string;
arguments: Record<string, any>;
type: 'mcp' | 'regular';
};

export type Prompt = {
role: string;
content: string;
Expand All @@ -9,6 +17,14 @@ export type Prompt = {
contentFilterError?: boolean;
alreadyDisplayed?: boolean;
isDisplayOnly?: boolean; // Mark messages that shouldn't be sent to LLM
requestId?: string; // For tracking tool confirmation messages
// Add support for inline tool confirmations
toolConfirmation?: {
tools: ToolCall[];
onApprove: (approvedToolIds: string[]) => void;
onDeny: () => void;
loading?: boolean;
};
};

export default abstract class AIManager {
Expand Down
Loading
Loading