mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
fix save and run recipe not working (#7186)
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
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 { Geese } from '../icons/Geese';
|
||||
import Copy from '../icons/Copy';
|
||||
@@ -327,19 +333,20 @@ export default function CreateEditRecipeModal({
|
||||
try {
|
||||
const recipe = getCurrentRecipe();
|
||||
|
||||
let saved_recipe_id = await saveRecipe(recipe, recipeId);
|
||||
await saveRecipe(recipe, recipeId);
|
||||
|
||||
// Close modal first
|
||||
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(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
saved_recipe_id
|
||||
encodedRecipe
|
||||
);
|
||||
|
||||
toastSuccess({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useForm } from '@tanstack/react-form';
|
||||
import { Recipe } from '../../recipe';
|
||||
import { Recipe, encodeRecipe, stripEmptyExtensions } from '../../recipe';
|
||||
import { Geese } from '../icons/Geese';
|
||||
import { X, Save, Play, Loader2 } from 'lucide-react';
|
||||
import { Button } from '../ui/button';
|
||||
@@ -182,19 +182,20 @@ export default function CreateRecipeFromSessionModal({
|
||||
: undefined,
|
||||
};
|
||||
|
||||
let recipeId = await saveRecipe(recipe, null);
|
||||
await saveRecipe(recipe, null);
|
||||
|
||||
onRecipeCreated?.(recipe);
|
||||
onClose();
|
||||
|
||||
if (runAfterSave) {
|
||||
const encodedRecipe = await encodeRecipe(stripEmptyExtensions(recipe));
|
||||
window.electron.createChatWindow(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
recipeId
|
||||
encodedRecipe
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user