diff --git a/frontend/src/components/agents/AgentChatPanel.tsx b/frontend/src/components/agents/AgentChatPanel.tsx index c1f2fc4b19..d9b90c6a4b 100644 --- a/frontend/src/components/agents/AgentChatPanel.tsx +++ b/frontend/src/components/agents/AgentChatPanel.tsx @@ -185,6 +185,8 @@ type Props = { /** Progression live pendant l’envoi (SSE). */ liveSteps?: AgentChatStep[]; liveAssistantText?: string | null; + /** Provider actif actuel (pour filtrer les erreurs non pertinentes) */ + activeRoutingProvider?: string | null; }; export function AgentChatPanel({ @@ -212,6 +214,7 @@ export function AgentChatPanel({ activeSubagentCount = 0, liveSteps = [], liveAssistantText = null, + activeRoutingProvider = null, }: Props) { const scrollRef = useRef(null); const textareaRef = useRef(null); @@ -308,7 +311,7 @@ export function AgentChatPanel({ )} - + {activeSubagentCount > 0 && (
@@ -515,7 +518,7 @@ export function AgentChatPanel({
)} -
+
{error && (
)} - switchView(mode, focusedRunUuid ?? agent.latest_run?.uuid ?? null)} - /> +
{viewMode === 'runs' ? ( diff --git a/frontend/src/components/agents/AgentConversationView.tsx b/frontend/src/components/agents/AgentConversationView.tsx index f39e08936e..dd05fcd174 100644 --- a/frontend/src/components/agents/AgentConversationView.tsx +++ b/frontend/src/components/agents/AgentConversationView.tsx @@ -369,7 +369,7 @@ export function AgentConversationView({ return (
-
diff --git a/frontend/src/components/agents/AgentErrorAlert.tsx b/frontend/src/components/agents/AgentErrorAlert.tsx index f54e5139a1..9213d0fb1a 100644 --- a/frontend/src/components/agents/AgentErrorAlert.tsx +++ b/frontend/src/components/agents/AgentErrorAlert.tsx @@ -1,4 +1,5 @@ -import { AlertCircle } from 'lucide-preact'; +import { AlertCircle, X } from 'lucide-preact'; +import { useState } from 'preact/hooks'; import type { Agent } from '../../lib/domain-api'; import { getAgentErrorMessage } from '../../lib/agent-errors'; import { agentDetailPath } from '../../lib/agent-routes'; @@ -8,12 +9,46 @@ type Props = { agent: Agent; compact?: boolean; onNavigate?: (event: MouseEvent, path: string) => void; + /** Provider actuellement actif (si différent du default agent) */ + activeProvider?: string | null; }; -export function AgentErrorAlert({ agent, compact = false, onNavigate }: Props) { +/** + * Détermine si l'erreur est pertinente pour le contexte actuel. + * Une erreur Ollama n'est pas pertinente si l'agent tourne actuellement sur Gemini. + */ +function isErrorRelevant( + agent: Agent, + activeProvider: string | null | undefined, +): boolean { + const errorMessage = getAgentErrorMessage(agent); + if (!errorMessage) { + return false; + } + + // Si pas de provider actif spécifié, on montre l'erreur + if (!activeProvider) { + return true; + } + + const lower = errorMessage.toLowerCase(); + const isOllamaError = lower.includes('ollama'); + const isGeminiActive = activeProvider === 'gemini' || agent.provider?.provider === 'gemini'; + + // Si l'erreur est Ollama mais que l'agent tourne sur Gemini, on cache l'erreur + if (isOllamaError && isGeminiActive) { + return false; + } + + return true; +} + +export function AgentErrorAlert({ agent, compact = false, onNavigate, activeProvider }: Props) { + const [dismissed, setDismissed] = useState(false); + const message = getAgentErrorMessage(agent); - if (!message) { + if (!message || dismissed || !isErrorRelevant(agent, activeProvider)) { return null; } @@ -26,13 +61,13 @@ export function AgentErrorAlert({ agent, compact = false, onNavigate }: Props) { return ( ); diff --git a/frontend/src/styles/global.css b/frontend/src/styles/global.css index 67391e08a9..664c90dcfb 100644 --- a/frontend/src/styles/global.css +++ b/frontend/src/styles/global.css @@ -658,3 +658,18 @@ input { color: var(--color-error); font-weight: 600; } + +/* Mobile chat improvements: composer always accessible, full-width messages */ +@media (max-width: 640px) { + /* Agent chat composer: safe bottom spacing */ + .agent-chat-composer { + padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); + } + + /* Prevent horizontal overflow on messages */ + .agent-chat-message { + max-width: 100%; + word-wrap: break-word; + overflow-wrap: break-word; + } +}