Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8adf1fd
ai-plugin: add mcp adapter
ashu8912 Sep 4, 2025
2bbc057
ai-plugin: Add mcp setting and electron mcp client
ashu8912 Sep 8, 2025
e5f427b
ai-plugin: Use mcp settings
ashu8912 Sep 8, 2025
ee6abf8
ai-plugin: Add ability to approve a tool request
ashu8912 Sep 8, 2025
6861926
ai-plugin: Fix tool response and update MCPSettings
ashu8912 Sep 10, 2025
a8e0d23
feat: add MCP output formatting and display components
ashu8912 Sep 21, 2025
1697659
ai-plugin: Add prompt width context for component state management
ashu8912 Sep 21, 2025
1e2ecc3
ai-plugin: Add inline tool approval system
ashu8912 Sep 21, 2025
f4169ef
ai-plugin: Add tools dialog for managing available tools
ashu8912 Sep 21, 2025
74893d3
ai-plugin: Enhance tool manager with retry functionality and MCP inte…
ashu8912 Sep 21, 2025
047cbe7
ai-plugin: Integrate MCP components with content rendering system
ashu8912 Sep 21, 2025
22231c6
ai-plugin: Enhance AI modal with retry functionality and tool management
ashu8912 Sep 21, 2025
cc9ad5a
ai-plugin: Enhance LangChain manager with advanced tool processing
ashu8912 Sep 21, 2025
f062894
ai-plugin: Add advanced MCP configuration editor dialog
ashu8912 Sep 21, 2025
303e2a9
ai-plugin: Enhance MCP settings with editor dialog integration
ashu8912 Sep 21, 2025
0776921
ai-plugin: Add utility enhancements and helper functions
ashu8912 Sep 21, 2025
e1a016f
ai-plugin: Run formatter
ashu8912 Sep 21, 2025
9ab7758
ai-plugin: Markdown rendering for document responses and UI fixes
ashu8912 Sep 23, 2025
e136bae
ai-plugin: Enhance tool arguments through ai calls
ashu8912 Sep 23, 2025
0ccdf6a
ai-plugin: Add search to mcp tools
ashu8912 Sep 29, 2025
69ece14
ai-assistant: Fix rendering of messages especially with bullet points
joaquimrocha Sep 30, 2025
5f88818
ai-assistant: List MCP tools per MCP server in the tools dialog
joaquimrocha Sep 30, 2025
ef0be7a
ai-assistant: Add shortDescription to the Tool class
joaquimrocha Sep 30, 2025
71530d0
ai-assistant: Properly look for whether we are running in-desktop
joaquimrocha Sep 30, 2025
ea87815
ai-assistant: Add tool test prompts
joaquimrocha Sep 30, 2025
ef32472
ai-assistant: Improve the tool UI and UX
joaquimrocha Sep 30, 2025
5232bae
ai-plugin: Fix k8s tool call working
ashu8912 Oct 9, 2025
64b4ec2
ai-plugin: fix log fetch failures
ashu8912 Oct 9, 2025
aacf512
ai-plugin: add missing tool response
ashu8912 Oct 10, 2025
d20293d
ai-plugin: Use mcp tools config update from electron main process
ashu8912 Oct 13, 2025
8fbe0d2
ai-plugin: Remove logs and cleanup
ashu8912 Oct 18, 2025
bc6bb84
ai-plugin: Fix tool args passing
ashu8912 Oct 19, 2025
df53824
ai-plugin: UI fixes
ashu8912 Oct 19, 2025
6a48fa5
ai-plugin: Format and lint fixes
ashu8912 Oct 19, 2025
e741d31
ai-plugin: React to cluster change
ashu8912 Oct 27, 2025
0c74b60
ai-plugin: Fix rendering issues
ashu8912 Oct 27, 2025
ef4dc01
ai-plugin: Remove unused code
ashu8912 Oct 27, 2025
d9bb4cb
ai-plugin: Allow multiple tool calls to happen
ashu8912 Oct 29, 2025
8debdd5
ai-assistant: Add a GUI for managing MCP servers
joaquimrocha Oct 31, 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
41 changes: 32 additions & 9 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 All @@ -96,7 +99,14 @@ const TableWrapper: React.FC<{ children: React.ReactNode }> = React.memo(({ chil

// Extract table rows from children
const tableElement = React.Children.only(children) as React.ReactElement;
const tbody = React.Children.toArray(tableElement.props.children).find(
const tableChildren = tableElement.props.children;

if (!tableChildren) {
// No children found, return table as is
return <Box sx={{ overflowX: 'auto', width: '100%', mb: 2 }}>{children}</Box>;
}

const tbody = React.Children.toArray(tableChildren).find(
(child: any) => child?.type === 'tbody' || child?.props?.component === 'tbody'
);

Expand All @@ -106,7 +116,8 @@ const TableWrapper: React.FC<{ children: React.ReactNode }> = React.memo(({ chil
}

const tbodyElement = tbody as React.ReactElement;
const rows = React.Children.toArray(tbodyElement.props.children);
const tbodyChildren = tbodyElement.props.children;
const rows = tbodyChildren ? React.Children.toArray(tbodyChildren) : [];
const hasMoreRows = rows.length > maxRows;
const visibleRows = showAll ? rows : rows.slice(0, maxRows);

Expand All @@ -117,7 +128,7 @@ const TableWrapper: React.FC<{ children: React.ReactNode }> = React.memo(({ chil

// Clone the table with the limited tbody
const limitedTable = React.cloneElement(tableElement, {
children: React.Children.map(tableElement.props.children, (child: any) => {
children: React.Children.map(tableChildren, (child: any) => {
if (child?.type === 'tbody' || child?.props?.component === 'tbody') {
return limitedTbody;
}
Expand Down Expand Up @@ -276,7 +287,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 +535,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 +578,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 +655,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 +667,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