Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
refactor(ui): Wave 9.2 + top-level merge fix — factory slim + local-UX fallback
trohitg79633b8d02d2
diff --git a/client/src/factories/baseChatModelFactory.ts b/client/src/factories/baseChatModelFactory.tsindex 8dd7ca7e..0efd8b85 100644--- a/client/src/factories/baseChatModelFactory.ts+++ b/client/src/factories/baseChatModelFactory.ts@@ -1,14 +1,12 @@-// Base Chat Model Factory - Standardized node definition generator+// Base Chat Model Factory - Wave 9.2: visual metadata only.+// Schema (Model, Prompt, Options + per-provider tuning) lives on backend+// as AIChatModelParams -- see server/models/nodes.py. resolveNodeDescription+// merges backend schema with the top-level visual fields below.import {INodeTypeDescription,NodeConnectionType,- INodeProperties} from '../types/INodeProperties';-// ============================================================================-// BASE CHAT MODEL CONFIGURATION INTERFACE-// ============================================================================-export interface ChatModelConfig {providerId: string;displayName: string;@@ -16,18 +14,8 @@ export interface ChatModelConfig {color: string;description: string;nodeName?: string;- models: Array<{- name: string;- value: string;- maxTokens?: number;- }>;- parameters: INodeProperties[];}-// ============================================================================-// BASE CHAT MODEL FACTORY FUNCTION-// ============================================================================-export function createBaseChatModel(config: ChatModelConfig): INodeTypeDescription {return {displayName: `${config.displayName} Chat Model`,@@ -39,237 +27,22 @@ export function createBaseChatModel(config: ChatModelConfig): INodeTypeDescriptidescription: config.description,defaults: {name: `${config.displayName} Chat Model`,- color: config.color+ color: config.color,},inputs: [{name: 'prompt',displayName: 'Prompt',type: 'string' as NodeConnectionType,description: 'Input prompt or message for the AI model',- required: false+ required: false,}],outputs: [{name: 'model',displayName: 'Model',type: 'ai' as NodeConnectionType,description: `${config.displayName} configuration for AI agents`,- dataStructure: {- properties: {- provider: {- type: 'string',- description: `Model provider (${config.providerId})`,- required: true- },- model: {- type: 'string',- description: 'Model name',- required: true- },- apiKey: {- type: 'string',- description: `${config.displayName} API key`,- required: true- },- temperature: {- type: 'number',- description: 'Sampling temperature'- },- maxTokens: {- type: 'number',- description: 'Maximum response tokens'- },- topP: {- type: 'number',- description: 'Top-p sampling parameter'- }- }- }}],- properties: [- {- displayName: 'Model',- name: 'model',- type: 'string',- default: '',- required: true,- placeholder: `Select a ${config.displayName} model...`,- description: `${config.displayName} model to use (configure API key in Credentials)`,- typeOptions: {- dynamicOptions: true- }- },- {- displayName: 'Prompt',- name: 'prompt',- type: 'string',- default: '{{ $json.message }}',- required: true,- typeOptions: {- rows: 4- },- description: 'The message to send to the AI model',- placeholder: 'Enter your prompt or use template variables...'- },- {- displayName: 'Options',- name: 'options',- type: 'collection',- placeholder: 'Add Option',- default: {},- options: [- {- displayName: 'System Message',- name: 'systemMessage',- type: 'string',- default: '',- typeOptions: {- rows: 3- },- description: 'System message to define AI behavior and personality'- },- ...config.parameters- ] as any- }- ]+ // Wave 8/9.2: schema lives on backend (AIChatModelParams in nodes.py).+ properties: [],};}--// ============================================================================-// STANDARD PARAMETER SETS-// ============================================================================--export const STANDARD_PARAMETERS = {- temperature: {- displayName: 'Temperature',- name: 'temperature',- type: 'number' as const,- default: 0.7,- typeOptions: { minValue: 0, maxValue: 2, numberStepSize: 0.1 },- description: 'Controls randomness in responses'- },-- maxTokens: {- displayName: 'Maximum Tokens',- name: 'maxTokens',- type: 'number' as const,- default: 4096,- typeOptions: { minValue: 1, maxValue: 200000 },- description: 'Maximum number of tokens to generate'- },-- topP: {- displayName: 'Top P',- name: 'topP',- type: 'number' as const,- default: 1,- typeOptions: { minValue: 0, maxValue: 1, numberStepSize: 0.1 },- description: 'Controls diversity via nucleus sampling'- },-- topK: {- displayName: 'Top K',- name: 'topK',- type: 'number' as const,- default: 40,- typeOptions: { minValue: 1, maxValue: 100 },- description: 'Limits token selection to top K candidates'- },-- frequencyPenalty: {- displayName: 'Frequency Penalty',- name: 'frequencyPenalty',- type: 'number' as const,- default: 0,- typeOptions: { minValue: -2, maxValue: 2, numberStepSize: 0.1 },- description: 'Penalty for frequency of token usage'- },-- presencePenalty: {- displayName: 'Presence Penalty',- name: 'presencePenalty',- type: 'number' as const,- default: 0,- typeOptions: { minValue: -2, maxValue: 2, numberStepSize: 0.1 },- description: 'Penalty for presence of tokens'- },-- // Thinking/Reasoning parameters- thinkingEnabled: {- displayName: 'Thinking/Reasoning Mode',- name: 'thinkingEnabled',- type: 'boolean' as const,- default: false,- description: 'Enable extended thinking for supported models'- },-- thinkingBudget: {- displayName: 'Thinking Budget (Tokens)',- name: 'thinkingBudget',- type: 'number' as const,- default: 2048,- typeOptions: { minValue: 1024, maxValue: 16000 },- description: 'Maximum tokens for thinking (Claude, Gemini 2.5)',- displayOptions: { show: { thinkingEnabled: [true] } }- },-- reasoningEffort: {- displayName: 'Reasoning Effort',- name: 'reasoningEffort',- type: 'options' as const,- options: [- { name: 'Minimal', value: 'minimal' },- { name: 'Low', value: 'low' },- { name: 'Medium', value: 'medium' },- { name: 'High', value: 'high' }- ],- default: 'medium',- description: 'Reasoning effort level (OpenAI o-series)',- displayOptions: { show: { thinkingEnabled: [true] } }- },-- thinkingLevel: {- displayName: 'Thinking Level',- name: 'thinkingLevel',- type: 'options' as const,- options: [- { name: 'Low', value: 'low' },- { name: 'Medium', value: 'medium' },- { name: 'High', value: 'high' }- ],- default: 'medium',- description: 'Thinking depth (Gemini 3+)',- displayOptions: { show: { thinkingEnabled: [true] } }- },-- reasoningFormat: {- displayName: 'Reasoning Format',- name: 'reasoningFormat',- type: 'options' as const,- options: [- { name: 'Parsed (show reasoning)', value: 'parsed' },- { name: 'Hidden (final answer only)', value: 'hidden' }- ],- default: 'parsed',- description: 'How to return reasoning content (Groq)',- displayOptions: { show: { thinkingEnabled: [true] } }- },-- // Common request parameters (shared by all providers)- timeout: {- displayName: 'Timeout',- name: 'timeout',- type: 'number' as const,- default: 60000,- typeOptions: { minValue: 1000, maxValue: 180000 },- description: 'Timeout for the request in milliseconds'- },-- maxRetries: {- displayName: 'Max Retries',- name: 'maxRetries',- type: 'number' as const,- default: 2,- typeOptions: { minValue: 0, maxValue: 5 },- description: 'Maximum number of retries'- },-};\ No newline at end of filediff --git a/client/src/lib/nodeSpec.ts b/client/src/lib/nodeSpec.tsindex 67b8f207..0cdac5b9 100644--- a/client/src/lib/nodeSpec.ts+++ b/client/src/lib/nodeSpec.ts@@ -146,5 +146,23 @@ export function resolveNodeDescription(return merged;});- return { ...backend, properties: mergedProperties };+ // Top-level UX-field fallback: frontend owns visual assets (SVG data+ // URIs in nodeDefinitions/assets/icons/, provider brand colors) — backend+ // NODE_METADATA carries empty strings for these to avoid duplicating SVG+ // payload across the wire. Fall back to local when backend is empty so+ // slimmed nodes keep their SVG icons and color swatches.+ const pick = <T,>(bv: T | undefined, lv: T | undefined): T | undefined =>+ bv !== undefined && bv !== null && bv !== '' ? bv : lv;+ return {+ ...backend,+ icon: pick(backend.icon, localFallback.icon) ?? '',+ subtitle: pick(backend.subtitle, localFallback.subtitle),+ description: pick(backend.description, localFallback.description) ?? '',+ defaults: {+ ...localFallback.defaults,+ ...backend.defaults,+ color: pick(backend.defaults?.color, localFallback.defaults?.color),+ },+ properties: mergedProperties,+ };}diff --git a/client/src/nodeDefinitions/aiModelNodes.ts b/client/src/nodeDefinitions/aiModelNodes.tsindex 1228fcbe..ce65a8c0 100644--- a/client/src/nodeDefinitions/aiModelNodes.ts+++ b/client/src/nodeDefinitions/aiModelNodes.ts@@ -1,254 +1,83 @@-// AI Model Node Definitions - Standardized chat model configurations using base factory+// AI Model Node Definitions - Wave 9.2: visual metadata only.+// Schema (temperature, maxTokens, thinking, etc.) lives on backend in+// AIChatModelParams (server/models/nodes.py) per-provider via discriminator.import { INodeTypeDescription } from '../types/INodeProperties';-import { createBaseChatModel, ChatModelConfig, STANDARD_PARAMETERS } from '../factories/baseChatModelFactory';+import { createBaseChatModel, ChatModelConfig } from '../factories/baseChatModelFactory';import { dracula } from '../styles/theme';import { DEEPSEEK_ICON, KIMI_ICON, MISTRAL_ICON } from '../assets/icons/llm';-// ============================================================================-// CHAT MODEL CONFIGURATIONS-// ============================================================================--// OpenAI Chat Model Configurationconst openaiConfig: ChatModelConfig = {providerId: 'openai',displayName: 'OpenAI',icon: '🤖',color: '#00A67E',description: 'OpenAI GPT models for chat completion and generation',- models: [],- parameters: [- STANDARD_PARAMETERS.frequencyPenalty,- {- ...STANDARD_PARAMETERS.maxTokens,- default: 4096,- typeOptions: { minValue: 1, maxValue: 128000 },- description: 'Maximum tokens to generate'- },- {- displayName: 'Response Format',- name: 'responseFormat',- type: 'options',- options: [- { name: 'Text', value: 'text' },- { name: 'JSON Object', value: 'json_object' }- ],- default: 'text',- description: 'Format of the response'- },- STANDARD_PARAMETERS.presencePenalty,- {- ...STANDARD_PARAMETERS.temperature,- description: 'Controls randomness (0-2). Note: O-series models (o1, o3, o4) only support temperature=1, which is set automatically.'- },- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.thinkingEnabled,- STANDARD_PARAMETERS.reasoningEffort- ]};-// Claude Chat Model Configurationconst claudeConfig: ChatModelConfig = {providerId: 'anthropic',displayName: 'Claude',icon: '🧠',color: '#FF6B35',description: 'Anthropic Claude models for conversation and analysis',- models: [],- parameters: [- {- ...STANDARD_PARAMETERS.maxTokens,- default: 4096,- typeOptions: { minValue: 1, maxValue: 128000 },- description: 'Maximum tokens to generate. Must be greater than Thinking Budget when thinking is enabled.'- },- {- ...STANDARD_PARAMETERS.temperature,- typeOptions: { minValue: 0, maxValue: 1, numberStepSize: 0.1 },- description: 'Controls randomness (0-1). Note: Automatically set to 1 when thinking mode is enabled.'- },- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.topK,- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- STANDARD_PARAMETERS.thinkingEnabled,- {- ...STANDARD_PARAMETERS.thinkingBudget,- description: 'Token budget for thinking (1024-16000). Must be less than Maximum Tokens.'- }- ]};-// Gemini Chat Model Configurationconst geminiConfig: ChatModelConfig = {providerId: 'gemini',displayName: 'Gemini',icon: '⭐',color: '#4285F4',description: 'Google Gemini models for multimodal AI capabilities',- models: [],- parameters: [- {- ...STANDARD_PARAMETERS.maxTokens,- default: 4096,- typeOptions: { minValue: 1, maxValue: 65536 },- description: 'Maximum tokens to generate'- },- {- ...STANDARD_PARAMETERS.temperature,- default: 0.9,- typeOptions: { minValue: 0, maxValue: 1, numberStepSize: 0.1 }- },- { ...STANDARD_PARAMETERS.topP, default: 0.95 },- STANDARD_PARAMETERS.topK,- {- displayName: 'Safety Settings',- name: 'safetySettings',- type: 'options',- options: [- { name: 'Default', value: 'default' },- { name: 'Strict', value: 'strict' },- { name: 'Permissive', value: 'permissive' }- ],- default: 'default',- description: 'Content safety filtering level'- },- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- STANDARD_PARAMETERS.thinkingEnabled,- {- ...STANDARD_PARAMETERS.thinkingBudget,- description: 'Token budget for thinking. Works with Gemini 2.5 Flash/Pro and Flash Thinking models.'- }- ]};-// OpenRouter Chat Model Configurationconst openrouterConfig: ChatModelConfig = {providerId: 'openrouter',displayName: 'OpenRouter',icon: '🔀',color: '#6366F1',description: 'OpenRouter unified API - access OpenAI, Claude, Gemini, Llama, and more through one API',- models: [],- parameters: [- STANDARD_PARAMETERS.temperature,- STANDARD_PARAMETERS.maxTokens,- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.frequencyPenalty,- STANDARD_PARAMETERS.presencePenalty,- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- ]};-// Groq Chat Model Configurationconst groqConfig: ChatModelConfig = {providerId: 'groq',displayName: 'Groq',icon: '⚡',color: '#F55036',description: 'Groq - Ultra-fast LLM inference with Llama, Mixtral, and Gemma models',- models: [],- parameters: [- STANDARD_PARAMETERS.temperature,- STANDARD_PARAMETERS.maxTokens,- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- STANDARD_PARAMETERS.thinkingEnabled,- STANDARD_PARAMETERS.reasoningFormat- ]};-// Cerebras Chat Model Configurationconst cerebrasConfig: ChatModelConfig = {providerId: 'cerebras',displayName: 'Cerebras',icon: '🧬',color: dracula.orange,description: 'Cerebras - Ultra-fast inference with Llama and Qwen models on custom AI hardware',- models: [],- parameters: [- STANDARD_PARAMETERS.temperature,- STANDARD_PARAMETERS.maxTokens,- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- STANDARD_PARAMETERS.thinkingEnabled,- STANDARD_PARAMETERS.thinkingBudget- ]};-// DeepSeek Chat Model Configurationconst deepseekConfig: ChatModelConfig = {providerId: 'deepseek',displayName: 'DeepSeek',icon: DEEPSEEK_ICON,color: dracula.cyan,description: 'DeepSeek V3 models (deepseek-chat, deepseek-reasoner with always-on CoT)',- models: [],- parameters: [- {- ...STANDARD_PARAMETERS.temperature,- description: 'Controls randomness (0-2). Ignored by deepseek-reasoner.'- },- STANDARD_PARAMETERS.maxTokens,- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.frequencyPenalty,- STANDARD_PARAMETERS.presencePenalty,- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- ]};-// Kimi (Moonshot AI) Chat Model Configurationconst kimiConfig: ChatModelConfig = {providerId: 'kimi',displayName: 'Kimi',icon: KIMI_ICON,color: dracula.purple,description: 'Kimi K2 models by Moonshot AI with 256K context (thinking on by default)',- models: [],- parameters: [- {- ...STANDARD_PARAMETERS.temperature,- typeOptions: { minValue: 0, maxValue: 1, numberStepSize: 0.1 },- description: 'Controls randomness (0-1). Fixed at 1.0 for thinking models.'- },- STANDARD_PARAMETERS.maxTokens,- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- ]};-// Mistral AI Chat Model Configurationconst mistralConfig: ChatModelConfig = {providerId: 'mistral',displayName: 'Mistral',icon: MISTRAL_ICON,color: dracula.orange,description: 'Mistral AI models for reasoning, coding, and multilingual tasks',- models: [],- parameters: [- {- ...STANDARD_PARAMETERS.temperature,- typeOptions: { minValue: 0, maxValue: 1, numberStepSize: 0.1 },- description: 'Controls randomness (0-1)'- },- STANDARD_PARAMETERS.maxTokens,- STANDARD_PARAMETERS.topP,- STANDARD_PARAMETERS.timeout,- STANDARD_PARAMETERS.maxRetries,- ]};-// ============================================================================-// GENERATED CHAT MODEL NODES-// ============================================================================-export const aiModelNodes: Record<string, INodeTypeDescription> = {openaiChatModel: createBaseChatModel(openaiConfig),anthropicChatModel: createBaseChatModel(claudeConfig),@@ -261,21 +90,17 @@ export const aiModelNodes: Record<string, INodeTypeDescription> = {mistralChatModel: createBaseChatModel(mistralConfig),};-// Node type names for external reference (Dashboard, SquareNode, etc.)export const AI_CHAT_MODEL_TYPES = Object.keys(aiModelNodes);-// Map node type -> provider ID for icon/credential lookupconst ALL_CONFIGS = [openaiConfig, claudeConfig, geminiConfig, openrouterConfig, groqConfig, cerebrasConfig, deepseekConfig, kimiConfig, mistralConfig];export const AI_MODEL_PROVIDER_MAP: Record<string, string> = Object.fromEntries(ALL_CONFIGS.map(c => [`${c.providerId}ChatModel`, c.providerId]));-// AI provider options for agent node dropdowns -- derived from AI_PROVIDER_META (single source of truth)import { AI_PROVIDER_META } from '../components/icons/AIProviderIcons';export const AI_PROVIDER_OPTIONS = Object.entries(AI_PROVIDER_META).map(([id, meta]) => ({name: meta.label,value: id,}));-// Export configurations and factory for external useexport { openaiConfig, claudeConfig, geminiConfig, openrouterConfig, groqConfig, cerebrasConfig, deepseekConfig, kimiConfig, mistralConfig, createBaseChatModel };