fix save and run recipe not working (#7186)

This commit is contained in:
Zane
2026-02-12 11:52:39 -08:00
committed by GitHub
parent 4cd39afbbe
commit d90fde19bd
2 changed files with 15 additions and 7 deletions
@@ -1,6 +1,12 @@
import React, { useState, useEffect, useCallback } from 'react'; import React, { useState, useEffect, useCallback } from 'react';
import { useForm } from '@tanstack/react-form'; import { useForm } from '@tanstack/react-form';
import { Recipe, generateDeepLink, Parameter } from '../../recipe'; import {
Recipe,
generateDeepLink,
Parameter,
encodeRecipe,
stripEmptyExtensions,
} from '../../recipe';
import { Check, ExternalLink, Play, Save, X } from 'lucide-react'; import { Check, ExternalLink, Play, Save, X } from 'lucide-react';
import { Geese } from '../icons/Geese'; import { Geese } from '../icons/Geese';
import Copy from '../icons/Copy'; import Copy from '../icons/Copy';
@@ -327,19 +333,20 @@ export default function CreateEditRecipeModal({
try { try {
const recipe = getCurrentRecipe(); const recipe = getCurrentRecipe();
let saved_recipe_id = await saveRecipe(recipe, recipeId); await saveRecipe(recipe, recipeId);
// Close modal first // Close modal first
onClose(true); onClose(true);
// Open recipe in a new window instead of navigating in the same window // Encode the recipe as a deeplink before passing to the new window
const encodedRecipe = await encodeRecipe(stripEmptyExtensions(recipe));
window.electron.createChatWindow( window.electron.createChatWindow(
undefined, undefined,
undefined, undefined,
undefined, undefined,
undefined, undefined,
undefined, undefined,
saved_recipe_id encodedRecipe
); );
toastSuccess({ toastSuccess({
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { useForm } from '@tanstack/react-form'; import { useForm } from '@tanstack/react-form';
import { Recipe } from '../../recipe'; import { Recipe, encodeRecipe, stripEmptyExtensions } from '../../recipe';
import { Geese } from '../icons/Geese'; import { Geese } from '../icons/Geese';
import { X, Save, Play, Loader2 } from 'lucide-react'; import { X, Save, Play, Loader2 } from 'lucide-react';
import { Button } from '../ui/button'; import { Button } from '../ui/button';
@@ -182,19 +182,20 @@ export default function CreateRecipeFromSessionModal({
: undefined, : undefined,
}; };
let recipeId = await saveRecipe(recipe, null); await saveRecipe(recipe, null);
onRecipeCreated?.(recipe); onRecipeCreated?.(recipe);
onClose(); onClose();
if (runAfterSave) { if (runAfterSave) {
const encodedRecipe = await encodeRecipe(stripEmptyExtensions(recipe));
window.electron.createChatWindow( window.electron.createChatWindow(
undefined, undefined,
undefined, undefined,
undefined, undefined,
undefined, undefined,
undefined, undefined,
recipeId encodedRecipe
); );
} }
} catch (error) { } catch (error) {