The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(ui): Agent toggle beside Tools + custom user avatar + LU monogram AI avatar
purple8b2803cef624
diff --git a/src/components/chat/AgentModeToggle.tsx b/src/components/chat/AgentModeToggle.tsxindex d694d54d..6eef7226 100644--- a/src/components/chat/AgentModeToggle.tsx+++ b/src/components/chat/AgentModeToggle.tsx@@ -1,7 +1,6 @@import { useState } from 'react'import { motion } from 'framer-motion'-import { MessageSquarePlus } from 'lucide-react'-import { ToggleSwitch } from '../ui/ToggleSwitch'+import { MessageSquarePlus, Bot } from 'lucide-react'import { Modal } from '../ui/Modal'import { useAgentModeStore } from '../../stores/agentModeStore'import { useChatStore } from '../../stores/chatStore'@@ -121,12 +120,30 @@ export function AgentModeToggle() {return (<>- <ToggleSwitch- enabled={isActive}- onChange={handleToggle}+ {/* Tools-style button (same size/look as the Tools toggle it sits next+ to). Green when active, dimmed + disabled when the model can't agent. */}+ <button+ onClick={handleToggle}disabled={!isCompatible}- size="sm"- />+ title={+ !isCompatible+ ? 'This model is not agent-compatible'+ : isActive+ ? 'Agent Mode is on — click to turn off'+ : 'Agent Mode is off — click to turn on'+ }+ className={+ 'flex items-center gap-1 px-2 py-0.5 rounded border transition-colors text-[0.55rem] ' ++ (isActive+ ? 'border-green-500/30 text-green-400'+ : !isCompatible+ ? 'border-white/[0.04] text-gray-600 opacity-50 cursor-not-allowed'+ : 'border-gray-200 dark:border-white/[0.06] text-gray-500 hover:border-gray-400 dark:hover:border-white/15')+ }+ >+ <Bot size={9} />+ <span>Agent</span>+ </button>{/* New Chat Required Modal */}<Modal open={showNewChatModal} onClose={() => { setShowNewChatModal(false); setNeverShowChecked(false) }} title="">diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsxindex fa4ef0c8..2dbc35ce 100644--- a/src/components/chat/ChatView.tsx+++ b/src/components/chat/ChatView.tsx@@ -12,9 +12,8 @@ import { AgentModeToggle } from './AgentModeToggle'import { AgentWorkspaceBadge } from './AgentWorkspaceBadge'import { ErrorBoundary } from '../ui/ErrorBoundary'import { useSettingsStore } from '../../stores/settingsStore'-import { FEATURE_FLAGS } from '../../lib/constants'-import { isAgentCompatible, isThinkingCompatible } from '../../lib/model-compatibility'-import { FileText, Bot, ChevronDown, Download, Brain, Wrench, Radio, RefreshCw, X } from 'lucide-react'+import { isThinkingCompatible } from '../../lib/model-compatibility'+import { FileText, ChevronDown, Download, Brain, Wrench, Radio, RefreshCw, X } from 'lucide-react'import { PluginsDropdown } from './PluginsDropdown'import { TokenCounter } from './TokenCounter'import { ContextDropdown } from './ContextDropdown'@@ -187,6 +186,14 @@ export function ChatView() {</div>)}+ {/* Agent Mode — sits directly to the right of the Tools toggle.+ Tools only shows when agent is active, so when agent is OFF+ this Agent button occupies the Tools spot; when ON, Tools+ appears and Agent is immediately to its right. The button+ (in AgentModeToggle) is styled the same size as Tools. */}+ <AgentModeToggle />+ <AgentWorkspaceBadge />+{/* Spacer */}<div className="flex-1" />@@ -265,25 +272,7 @@ export function ChatView() {)}</button>- {/* Agent Mode */}- {FEATURE_FLAGS.AGENT_MODE && (- <div className={- 'flex items-center gap-1 px-2 py-0.5 rounded border transition-colors text-[0.55rem] ' +- (isAgentActive- ? 'border-green-500/30 text-green-400'- : activeModel && !isAgentCompatible(activeModel)- ? 'border-white/[0.04] text-gray-600 opacity-50'- : 'border-gray-200 dark:border-white/[0.06] text-gray-500')- }>- <Bot size={10} />- <span>Agent</span>- <AgentModeToggle />- {/* Workspace badge — only renders when agent mode is- on AND a workspace has been chosen. Click pops- AgentWorkspaceDialog so the user can swap mid-chat. */}- <AgentWorkspaceBadge />- </div>- )}+ {/* (Agent Mode toggle relocated above, next to the Tools toggle.) */}</div><MessageListdiff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsxindex 1999023a..636b5965 100644--- a/src/components/chat/CodexView.tsx+++ b/src/components/chat/CodexView.tsx@@ -93,6 +93,7 @@ export function CodexView() {const thinkingEnabled = useSettingsStore((s) => s.settings.thinkingEnabled)const codexReviewMode = useSettingsStore((s) => s.settings.codexReviewMode)const updateSettings = useSettingsStore((s) => s.updateSettings)+ const userAvatarDataUrl = useSettingsStore((s) => s.settings.userAvatarDataUrl)const activeModel = useModelStore((s) => s.activeModel)const createConversation = useChatStore((s) => s.createConversation)const codexWorkingDir = useCodexStore((s) => s.workingDirectory)@@ -231,14 +232,16 @@ export function CodexView() {key={msg.id}className={`flex gap-2 px-3 py-1 ${msg.role === 'user' ? 'flex-row-reverse' : ''}`}>- <div className={`w-5 h-5 rounded flex items-center justify-center shrink-0 ${+ <div className={`w-5 h-5 rounded overflow-hidden flex items-center justify-center shrink-0 ${msg.role === 'user'? 'bg-gray-100 dark:bg-white/8': 'bg-gray-50 dark:bg-white/5'}`}>{msg.role === 'user'- ? <User size={9} className="text-gray-400" />- : <Code size={9} className="text-gray-500" />+ ? (userAvatarDataUrl+ ? <img src={userAvatarDataUrl} alt="" className="w-full h-full object-cover" />+ : <User size={9} className="text-gray-400" />)+ : <img src="/LU-monogram-bw.png" alt="" className="w-3 h-3 object-contain dark:invert-0 invert opacity-80" />}</div><div className="max-w-[85%] space-y-0.5">diff --git a/src/components/chat/MessageBubble.tsx b/src/components/chat/MessageBubble.tsxindex 5d1a920b..2fce6d45 100644--- a/src/components/chat/MessageBubble.tsx+++ b/src/components/chat/MessageBubble.tsx@@ -1,5 +1,5 @@import { motion } from 'framer-motion'-import { User, Bot, Copy, Check, Pencil, RefreshCw, X, Wrench } from 'lucide-react'+import { User, Copy, Check, Pencil, RefreshCw, X, Wrench } from 'lucide-react'import { useState, useRef, useEffect, useMemo } from 'react'import { MarkdownRenderer } from './MarkdownRenderer'import { ThinkingBlock } from './ThinkingBlock'@@ -11,6 +11,7 @@ import type { Message } from '../../types/chat'import { useAgentModeStore } from '../../stores/agentModeStore'import { useChatStore } from '../../stores/chatStore'import { useModelStore } from '../../stores/modelStore'+import { useSettingsStore } from '../../stores/settingsStore'import { extractToolCallsFromContent } from '../../lib/tool-call-repair'import { isAgentCompatible } from '../../lib/model-compatibility'@@ -46,6 +47,7 @@ export function MessageBubble({ message, onRegenerate, onEdit, pendingApprovalId)const activeModel = useModelStore((s) => s.activeModel)const toggleAgentMode = useAgentModeStore((s) => s.toggleAgentMode)+ const userAvatarDataUrl = useSettingsStore((s) => s.settings.userAvatarDataUrl)const suggestAgent = useMemo(() => {if (isUser || isAgentActive || !activeConversationId || !activeModel) return false@@ -101,13 +103,20 @@ export function MessageBubble({ message, onRegenerate, onEdit, pendingApprovalId{/* Avatar */}<divclassName={- 'w-6 h-6 rounded-md flex items-center justify-center shrink-0 ' ++ 'w-6 h-6 rounded-md overflow-hidden flex items-center justify-center shrink-0 ' +(isUser? 'bg-gray-100 dark:bg-white/8 border border-gray-200 dark:border-white/10': 'bg-gray-50 dark:bg-white/5 border border-gray-200 dark:border-white/[0.06]')}>- {isUser ? <User size={11} className="text-gray-400" /> : <Bot size={11} className="text-gray-500" />}+ {isUser ? (+ userAvatarDataUrl+ ? <img src={userAvatarDataUrl} alt="" className="w-full h-full object-cover" />+ : <User size={11} className="text-gray-400" />+ ) : (+ // AI avatar is ALWAYS the LU black/white monogram (theme-inverted).+ <img src="/LU-monogram-bw.png" alt="" className="w-4 h-4 object-contain dark:invert-0 invert opacity-80" />+ )}</div><div className="max-w-[80%] space-y-0.5">diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex 4bdfb571..dfc51e4e 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -1,5 +1,5 @@-import { useState, useEffect, type ReactNode } from 'react'-import { ArrowLeft, RotateCcw, Sun, Moon, Mic, Volume2, Check, X, Loader2, Shield, ChevronRight, GraduationCap, Lock, Sliders, Plug, Bot, Phone } from 'lucide-react'+import { useState, useEffect, useRef, type ReactNode, type ChangeEvent } from 'react'+import { ArrowLeft, RotateCcw, Sun, Moon, Mic, Volume2, Check, X, Loader2, Shield, ChevronRight, GraduationCap, Lock, Sliders, Plug, Bot, Phone, User } from 'lucide-react'import { motion, AnimatePresence } from 'framer-motion'import { useSettingsStore } from '../../stores/settingsStore'import { useUIStore } from '../../stores/uiStore'@@ -24,6 +24,79 @@ import { useUpdateStore, isNewerVersion } from '../../stores/updateStore'import { backendCall } from '../../api/backend'import { ArrowUpCircle } from 'lucide-react'+// ── User profile picture (Appearance) ───────────────────────────+// Self-contained like HfDownloadPathSetting. Stores the picture as a+// downscaled base64 data URL (≤256px PNG) in settings so persisted state+// stays small. Shows next to the user's messages in chat / code / agent.+// The AI avatar is always the LU monogram and is NOT user-settable.+function AvatarSetting() {+ const userAvatarDataUrl = useSettingsStore((s) => s.settings.userAvatarDataUrl)+ const updateSettings = useSettingsStore((s) => s.updateSettings)+ const inputRef = useRef<HTMLInputElement>(null)++ const onPick = (e: ChangeEvent<HTMLInputElement>) => {+ const file = e.target.files?.[0]+ e.target.value = '' // allow re-picking the same file+ if (!file) return+ const reader = new FileReader()+ reader.onload = () => {+ const img = new Image()+ img.onload = () => {+ // Downscale to ≤256px (longest edge) so the persisted data URL is small.+ const MAX = 256+ const scale = Math.min(1, MAX / Math.max(img.width, img.height))+ const w = Math.max(1, Math.round(img.width * scale))+ const h = Math.max(1, Math.round(img.height * scale))+ const canvas = document.createElement('canvas')+ canvas.width = w+ canvas.height = h+ const ctx = canvas.getContext('2d')+ if (!ctx) return+ ctx.drawImage(img, 0, 0, w, h)+ updateSettings({ userAvatarDataUrl: canvas.toDataURL('image/png') })+ }+ img.src = reader.result as string+ }+ reader.readAsDataURL(file)+ }++ return (+ <div className="flex items-center justify-between pt-2">+ <span className="text-[0.7rem] text-gray-700 dark:text-gray-400">Profile picture</span>+ <div className="flex items-center gap-2">+ {userAvatarDataUrl ? (+ <img src={userAvatarDataUrl} alt="" className="w-7 h-7 rounded-md object-cover border border-gray-200 dark:border-white/10" />+ ) : (+ <div className="w-7 h-7 rounded-md bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 flex items-center justify-center">+ <User size={12} className="text-gray-400" />+ </div>+ )}+ <button+ onClick={() => inputRef.current?.click()}+ className="px-2 py-1 rounded text-[0.65rem] bg-gray-200 dark:bg-white/10 text-gray-900 dark:text-white hover:bg-gray-300 dark:hover:bg-white/15 transition-colors"+ >+ {userAvatarDataUrl ? 'Change' : 'Upload'}+ </button>+ {userAvatarDataUrl && (+ <button+ onClick={() => updateSettings({ userAvatarDataUrl: '' })}+ className="px-2 py-1 rounded text-[0.65rem] text-gray-500 hover:text-red-400 transition-colors"+ >+ Remove+ </button>+ )}+ </div>+ <input+ ref={inputRef}+ type="file"+ accept="image/png,image/jpeg,image/webp,image/gif"+ onChange={onPick}+ className="hidden"+ />+ </div>+ )+}+// ── Collapsible Section ─────────────────────────────────────────function Section({ title, children, defaultOpen = false }: { title: string; children: ReactNode; defaultOpen?: boolean }) {@@ -730,6 +803,7 @@ export function SettingsPage() {</button></div></div>+ <AvatarSetting /></Section><Section title="Generation">diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex d1cdca47..895d5472 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -56,6 +56,8 @@ export const DEFAULT_SETTINGS: Settings = {codexStageMode: false,codexReviewMode: false,defaultWorkspace: null,+ // v8: user-uploaded profile picture (base64 data URL, ≤256px). '' = default icon.+ userAvatarDataUrl: '',}/** Caveman mode system prompt prefixes — credit: github.com/JuliusBrussee/caveman (MIT) */diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex b8009af2..94040d80 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -15,7 +15,9 @@ import { DEFAULT_SETTINGS, BUILT_IN_PERSONAS } from '../lib/constants'// for 3B-8B local models, default false). Same additive merge path below// ({ ...DEFAULT_SETTINGS, ...persisted.settings }) fills the new default in// while preserving every existing user value — existing users get it OFF.-const STORE_VERSION = 7+// v8: added settings.userAvatarDataUrl (user profile picture, default ''),+// backfilled by the same additive merge — existing users keep the default icon.+const STORE_VERSION = 8interface SettingsState {settings: Settingsdiff --git a/src/types/settings.ts b/src/types/settings.tsindex 0b782810..872f69d3 100644--- a/src/types/settings.ts+++ b/src/types/settings.ts@@ -133,6 +133,13 @@ export interface Settings {* falling back to the per-thread cwd.*/defaultWorkspace: AgentWorkspace | null+ /**+ * User profile picture as a base64 data URL (downscaled to ≤256px PNG on+ * upload so it stays small in persisted state). Empty string = show the+ * default user icon. Rendered next to the user's chat / code / agent+ * messages. The AI's avatar is always the LU monogram (not user-settable).+ */+ userAvatarDataUrl: string}export interface Persona {