fix: handle non exist subrecipe path (#5287)

This commit is contained in:
Lifei Zhou
2025-10-22 09:05:18 +11:00
committed by GitHub
parent d836a10af1
commit e720733259
4 changed files with 67 additions and 18 deletions
+12 -2
View File
@@ -7,7 +7,7 @@ import { substituteParameters } from '../utils/providerUtils';
import { updateSessionUserRecipeValues } from '../api';
import { useChatContext } from '../contexts/ChatContext';
import { ChatType } from '../types/chat';
import { toastSuccess } from '../toasts';
import { toastError, toastSuccess } from '../toasts';
export const useRecipeManager = (chat: ChatType, recipe?: Recipe | null) => {
const [isParameterModalOpen, setIsParameterModalOpen] = useState(false);
@@ -181,7 +181,17 @@ export const useRecipeManager = (chat: ChatType, recipe?: Recipe | null) => {
}
setIsParameterModalOpen(false);
} catch (error) {
console.error('Failed to update system prompt with parameters:', error);
let error_message = 'unknown error';
if (typeof error === 'object' && error !== null && 'message' in error) {
error_message = error.message as string;
} else if (typeof error === 'string') {
error_message = error;
}
console.error('Failed to render recipe with parameters:', error);
toastError({
title: 'Recipe Rendering Failed',
msg: error_message,
});
}
};