diff --git a/application/storage/local.py b/application/storage/local.py index cf0ebcb8..a987b32b 100644 --- a/application/storage/local.py +++ b/application/storage/local.py @@ -26,7 +26,7 @@ class LocalStorage(BaseStorage): return path return os.path.join(self.base_dir, path) - def save_file(self, file_data: BinaryIO, path: str) -> dict: + def save_file(self, file_data: BinaryIO, path: str, **kwargs) -> dict: """Save a file to local storage.""" full_path = self._get_full_path(path) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 177ceef0..d987a537 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -14,7 +14,7 @@ import Github from './assets/git_nav.svg'; import Hamburger from './assets/hamburger.svg'; import openNewChat from './assets/openNewChat.svg'; import Pin from './assets/pin.svg'; -import Robot from './assets/robot.svg'; +import AgentImage from './components/AgentImage'; import SettingGear from './assets/settingGear.svg'; import Spark from './assets/spark.svg'; import SpinnerDark from './assets/spinner-dark.svg'; @@ -424,12 +424,8 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { >
- agent-logo diff --git a/frontend/src/agents/AgentCard.tsx b/frontend/src/agents/AgentCard.tsx index 1681f19d..90302c71 100644 --- a/frontend/src/agents/AgentCard.tsx +++ b/frontend/src/agents/AgentCard.tsx @@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; import userService from '../api/services/userService'; -import Robot from '../assets/robot.svg'; +import AgentImage from '../components/AgentImage'; import ThreeDots from '../assets/three-dots.svg'; import ContextMenu, { MenuOption } from '../components/ContextMenu'; import ConfirmationModal from '../modals/ConfirmationModal'; @@ -82,8 +82,8 @@ export default function AgentCard({
- {`${agent.name}`} diff --git a/frontend/src/agents/SharedAgent.tsx b/frontend/src/agents/SharedAgent.tsx index 8c97682c..ad8ba11c 100644 --- a/frontend/src/agents/SharedAgent.tsx +++ b/frontend/src/agents/SharedAgent.tsx @@ -6,7 +6,7 @@ import { useParams } from 'react-router-dom'; import userService from '../api/services/userService'; import NoFilesDarkIcon from '../assets/no-files-dark.svg'; import NoFilesIcon from '../assets/no-files.svg'; -import Robot from '../assets/robot.svg'; +import AgentImage from '../components/AgentImage'; import MessageInput from '../components/MessageInput'; import Spinner from '../components/Spinner'; import ConversationMessages from '../conversation/ConversationMessages'; @@ -152,12 +152,8 @@ export default function SharedAgent() { return (
- agent-logo diff --git a/frontend/src/agents/SharedAgentCard.tsx b/frontend/src/agents/SharedAgentCard.tsx index 9401b6e2..46988979 100644 --- a/frontend/src/agents/SharedAgentCard.tsx +++ b/frontend/src/agents/SharedAgentCard.tsx @@ -1,4 +1,4 @@ -import Robot from '../assets/robot.svg'; +import AgentImage from '../components/AgentImage'; import { Agent } from './types'; export default function SharedAgentCard({ agent }: { agent: Agent }) { @@ -6,8 +6,8 @@ export default function SharedAgentCard({ agent }: { agent: Agent }) {
-
diff --git a/frontend/src/agents/index.tsx b/frontend/src/agents/index.tsx index 14dd7423..8851e173 100644 --- a/frontend/src/agents/index.tsx +++ b/frontend/src/agents/index.tsx @@ -8,7 +8,7 @@ import Link from '../assets/link-gray.svg'; import Monitoring from '../assets/monitoring.svg'; import Pin from '../assets/pin.svg'; import Trash from '../assets/red-trash.svg'; -import Robot from '../assets/robot.svg'; +import AgentImage from '../components/AgentImage'; import ThreeDots from '../assets/three-dots.svg'; import UnPin from '../assets/unpin.svg'; import ContextMenu, { MenuOption } from '../components/ContextMenu'; @@ -138,11 +138,7 @@ function AgentsList() {
- agent-logo +

- {`${agent.name}`} diff --git a/frontend/src/components/AgentImage.tsx b/frontend/src/components/AgentImage.tsx new file mode 100644 index 00000000..28109b49 --- /dev/null +++ b/frontend/src/components/AgentImage.tsx @@ -0,0 +1,40 @@ +import { useState, useEffect } from 'react'; +import Robot from '../assets/robot.svg'; + +type AgentImageProps = { + src?: string | null; + alt?: string; + className?: string; + fallbackSrc?: string; +}; + +export default function AgentImage({ + src, + alt = 'agent', + className = '', + fallbackSrc = Robot, +}: AgentImageProps) { + const [currentSrc, setCurrentSrc] = useState( + src && src.trim() !== '' ? src : fallbackSrc, + ); + + useEffect(() => { + const newSrc = src && src.trim() !== '' ? src : fallbackSrc; + if (newSrc !== currentSrc) { + setCurrentSrc(newSrc); + } + }, [src, fallbackSrc]); + + return ( + {alt} { + if (currentSrc !== fallbackSrc) setCurrentSrc(fallbackSrc); + }} + /> + ); +}