mirror of
https://github.com/aljazceru/goose.git
synced 2026-01-14 11:54:24 +01:00
fix: Load and Use recipes in new window (#3501)
This commit is contained in:
@@ -29,7 +29,8 @@ interface RecipesViewProps {
|
||||
onLoadRecipe?: (recipe: Recipe) => void;
|
||||
}
|
||||
|
||||
export default function RecipesView({ onLoadRecipe }: RecipesViewProps = {}) {
|
||||
// @ts-expect-error until we make onLoadRecipe work for loading recipes in the same window
|
||||
export default function RecipesView({ _onLoadRecipe }: RecipesViewProps = {}) {
|
||||
const [savedRecipes, setSavedRecipes] = useState<SavedRecipe[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [showSkeleton, setShowSkeleton] = useState(true);
|
||||
@@ -93,20 +94,24 @@ export default function RecipesView({ onLoadRecipe }: RecipesViewProps = {}) {
|
||||
|
||||
const handleLoadRecipe = async (savedRecipe: SavedRecipe) => {
|
||||
try {
|
||||
if (onLoadRecipe) {
|
||||
// Use the callback to navigate within the same window
|
||||
onLoadRecipe(savedRecipe.recipe);
|
||||
} else {
|
||||
// Fallback to creating a new window (for backwards compatibility)
|
||||
window.electron.createChatWindow(
|
||||
undefined, // query
|
||||
undefined, // dir
|
||||
undefined, // version
|
||||
undefined, // resumeSessionId
|
||||
savedRecipe.recipe, // recipe config
|
||||
undefined // view type
|
||||
);
|
||||
}
|
||||
// onLoadRecipe is not working for loading recipes. It looks correct
|
||||
// but the instructions are not flowing through to the server.
|
||||
// Needs a fix but commenting out to get prod back up and running.
|
||||
//
|
||||
// if (onLoadRecipe) {
|
||||
// // Use the callback to navigate within the same window
|
||||
// onLoadRecipe(savedRecipe.recipe);
|
||||
// } else {
|
||||
// Fallback to creating a new window (for backwards compatibility)
|
||||
window.electron.createChatWindow(
|
||||
undefined, // query
|
||||
undefined, // dir
|
||||
undefined, // version
|
||||
undefined, // resumeSessionId
|
||||
savedRecipe.recipe, // recipe config
|
||||
undefined // view type
|
||||
);
|
||||
// }
|
||||
} catch (err) {
|
||||
console.error('Failed to load recipe:', err);
|
||||
setError(err instanceof Error ? err.message : 'Failed to load recipe');
|
||||
|
||||
Reference in New Issue
Block a user