Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 5 additions & 42 deletions ui/desktop/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { type SharedSessionDetails } from './sharedSessions';
import { ErrorUI } from './components/ErrorBoundary';
import { ExtensionInstallModal } from './components/ExtensionInstallModal';
import { ToastContainer } from 'react-toastify';
import { GoosehintsModal } from './components/GoosehintsModal';
import AnnouncementModal from './components/AnnouncementModal';
import ProviderGuard from './components/ProviderGuard';
import { createSession } from './sessions';
Expand Down Expand Up @@ -43,34 +42,20 @@ import { useNavigation } from './hooks/useNavigation';
import { errorMessage } from './utils/conversionUtils';

// Route Components
const HubRouteWrapper = ({
setIsGoosehintsModalOpen,
isExtensionsLoading,
}: {
setIsGoosehintsModalOpen: (isOpen: boolean) => void;
isExtensionsLoading: boolean;
}) => {
const HubRouteWrapper = ({ isExtensionsLoading }: { isExtensionsLoading: boolean }) => {
const setView = useNavigation();

return (
<Hub
setView={setView}
setIsGoosehintsModalOpen={setIsGoosehintsModalOpen}
isExtensionsLoading={isExtensionsLoading}
/>
);
return <Hub setView={setView} isExtensionsLoading={isExtensionsLoading} />;
};

const PairRouteWrapper = ({
chat,
setChat,
setIsGoosehintsModalOpen,
activeSessionId,
setActiveSessionId,
}: {
chat: ChatType;
setChat: (chat: ChatType) => void;
setIsGoosehintsModalOpen: (isOpen: boolean) => void;
activeSessionId: string | null;
setActiveSessionId: (id: string | null) => void;
}) => {
Expand Down Expand Up @@ -178,13 +163,7 @@ const PairRouteWrapper = ({
}, [sessionId, activeSessionId, setActiveSessionId]);

return (
<Pair
key={sessionId}
setChat={setChat}
setIsGoosehintsModalOpen={setIsGoosehintsModalOpen}
sessionId={sessionId}
initialMessage={initialMessage}
/>
<Pair key={sessionId} setChat={setChat} sessionId={sessionId} initialMessage={initialMessage} />
);
};

Expand Down Expand Up @@ -356,7 +335,6 @@ const ExtensionsRoute = () => {

export function AppInner() {
const [fatalError, setFatalError] = useState<string | null>(null);
const [isGoosehintsModalOpen, setIsGoosehintsModalOpen] = useState(false);
const [agentWaitingMessage, setAgentWaitingMessage] = useState<string | null>(null);
const [isLoadingSharedSession, setIsLoadingSharedSession] = useState(false);
const [sharedSessionError, setSharedSessionError] = useState<string | null>(null);
Expand Down Expand Up @@ -652,27 +630,18 @@ export function AppInner() {
contextKey="hub"
agentWaitingMessage={agentWaitingMessage}
>
<AppLayout setIsGoosehintsModalOpen={setIsGoosehintsModalOpen} />
<AppLayout />
</ChatProvider>
</ProviderGuard>
}
>
<Route
index
element={
<HubRouteWrapper
setIsGoosehintsModalOpen={setIsGoosehintsModalOpen}
isExtensionsLoading={isExtensionsLoading}
/>
}
/>
<Route index element={<HubRouteWrapper isExtensionsLoading={isExtensionsLoading} />} />
<Route
path="pair"
element={
<PairRouteWrapper
chat={chat}
setChat={setChat}
setIsGoosehintsModalOpen={setIsGoosehintsModalOpen}
activeSessionId={activeSessionId}
setActiveSessionId={setActiveSessionId}
/>
Expand Down Expand Up @@ -709,12 +678,6 @@ export function AppInner() {
</Route>
</Routes>
</div>
{isGoosehintsModalOpen && (
<GoosehintsModal
directory={window.appConfig?.get('GOOSE_WORKING_DIR') as string}
setIsGoosehintsModalOpen={setIsGoosehintsModalOpen}
/>
)}
</>
);
}
Expand Down
3 changes: 0 additions & 3 deletions ui/desktop/src/components/BaseChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const useCurrentModelInfo = () => useContext(CurrentModelContext);

interface BaseChatProps {
setChat: (chat: ChatType) => void;
setIsGoosehintsModalOpen?: (isOpen: boolean) => void;
onMessageSubmit?: (message: string) => void;
renderHeader?: () => React.ReactNode;
customChatInputProps?: Record<string, unknown>;
Expand All @@ -57,7 +56,6 @@ interface BaseChatProps {
}

function BaseChatContent({
setIsGoosehintsModalOpen,
renderHeader,
customChatInputProps = {},
customMainLayoutProps = {},
Expand Down Expand Up @@ -423,7 +421,6 @@ function BaseChatContent({
messages={messages}
disableAnimation={disableAnimation}
sessionCosts={sessionCosts}
setIsGoosehintsModalOpen={setIsGoosehintsModalOpen}
recipe={recipe}
recipeAccepted={!hasNotAcceptedRecipe}
initialPrompt={initialPrompt}
Expand Down
71 changes: 50 additions & 21 deletions ui/desktop/src/components/ChatInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef, useState, useEffect, useMemo, useCallback } from 'react';
import { Bug, FolderKey, ScrollText } from 'lucide-react';
import { Bug, ScrollText, ChefHat } from 'lucide-react';
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/Tooltip';
import { Button } from './ui/button';
import type { View } from '../utils/navigationUtils';
Expand Down Expand Up @@ -28,6 +28,8 @@ import MessageQueue from './MessageQueue';
import { detectInterruption } from '../utils/interruptionDetector';
import { DiagnosticsModal } from './ui/DownloadDiagnostics';
import { Message } from '../api';
import CreateRecipeFromSessionModal from './recipes/CreateRecipeFromSessionModal';
import CreateEditRecipeModal from './recipes/CreateEditRecipeModal';

interface QueuedMessage {
id: string;
Expand Down Expand Up @@ -80,7 +82,6 @@ interface ChatInputProps {
totalCost: number;
};
};
setIsGoosehintsModalOpen?: (isOpen: boolean) => void;
disableAnimation?: boolean;
recipe?: Recipe | null;
recipeId?: string | null;
Expand All @@ -107,7 +108,6 @@ export default function ChatInput({
messages = [],
disableAnimation = false,
sessionCosts,
setIsGoosehintsModalOpen,
recipe,
recipeId,
recipeAccepted,
Expand Down Expand Up @@ -140,6 +140,8 @@ export default function ChatInput({
const [tokenLimit, setTokenLimit] = useState<number>(TOKEN_LIMIT_DEFAULT);
const [isTokenLimitLoaded, setIsTokenLimitLoaded] = useState(false);
const [diagnosticsOpen, setDiagnosticsOpen] = useState(false);
const [showCreateRecipeModal, setShowCreateRecipeModal] = useState(false);
const [showEditRecipeModal, setShowEditRecipeModal] = useState(false);

// Save queue state (paused/interrupted) to storage
useEffect(() => {
Expand Down Expand Up @@ -1486,9 +1488,6 @@ export default function ChatInput({
dropdownRef={dropdownRef}
setView={setView}
alerts={alerts}
recipe={recipe}
recipeId={recipeId}
hasMessages={messages.length > 0}
/>
</div>
</Tooltip>
Expand All @@ -1500,21 +1499,34 @@ export default function ChatInput({
<BottomMenuExtensionSelection sessionId={sessionId} />
</>
)}
<div className="flex items-center h-full">
<Tooltip>
<TooltipTrigger asChild>
<Button
onClick={() => setIsGoosehintsModalOpen?.(true)}
variant="ghost"
size="sm"
className="flex items-center justify-center text-text-default/70 hover:text-text-default text-xs cursor-pointer"
>
<FolderKey size={16} />
</Button>
</TooltipTrigger>
<TooltipContent>Configure goosehints</TooltipContent>
</Tooltip>
</div>
{sessionId && (
<>
<div className="w-px h-4 bg-border-default mx-2" />
<div className="flex items-center h-full">
<Tooltip>
<TooltipTrigger asChild>
<Button
onClick={() => {
if (recipe) {
setShowEditRecipeModal(true);
} else {
setShowCreateRecipeModal(true);
}
}}
variant="ghost"
size="sm"
className="flex items-center justify-center text-text-default/70 hover:text-text-default text-xs cursor-pointer"
>
<ChefHat size={16} />
</Button>
</TooltipTrigger>
<TooltipContent>
{recipe ? 'View/Edit Recipe' : 'Create Recipe from Session'}
</TooltipContent>
</Tooltip>
</div>
</>
)}
{sessionId && (
<Tooltip>
<TooltipTrigger asChild>
Expand Down Expand Up @@ -1552,6 +1564,23 @@ export default function ChatInput({
setMentionPopover((prev) => ({ ...prev, selectedIndex: index }))
}
/>

{sessionId && showCreateRecipeModal && (
<CreateRecipeFromSessionModal
isOpen={showCreateRecipeModal}
onClose={() => setShowCreateRecipeModal(false)}
sessionId={sessionId}
/>
)}

{recipe && showEditRecipeModal && (
<CreateEditRecipeModal
isOpen={showEditRecipeModal}
onClose={() => setShowEditRecipeModal(false)}
recipe={recipe}
recipeId={recipeId}
/>
)}
</div>
</div>
);
Expand Down
1 change: 0 additions & 1 deletion ui/desktop/src/components/GooseSidebar/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ interface SidebarProps {
onSelectSession: (sessionId: string) => void;
refreshTrigger?: number;
children?: React.ReactNode;
setIsGoosehintsModalOpen?: (isOpen: boolean) => void;
setView?: (view: View, viewOptions?: ViewOptions) => void;
currentPath?: string;
}
Expand Down
Loading
Loading