fix: recipe deeplinks
This commit is contained in:
@@ -72,8 +72,8 @@ export default function ChatView({
|
|||||||
const [isGeneratingRecipe, setIsGeneratingRecipe] = useState(false);
|
const [isGeneratingRecipe, setIsGeneratingRecipe] = useState(false);
|
||||||
const scrollRef = useRef<ScrollAreaHandle>(null);
|
const scrollRef = useRef<ScrollAreaHandle>(null);
|
||||||
|
|
||||||
// Get botConfig directly from appConfig
|
// Get recipeConfig directly from appConfig
|
||||||
const botConfig = window.appConfig.get('botConfig') as Recipe | null;
|
const recipeConfig = window.appConfig.get('recipeConfig') as Recipe | null;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
messages,
|
messages,
|
||||||
@@ -125,8 +125,8 @@ export default function ChatView({
|
|||||||
// Create recipe directly from chat messages
|
// Create recipe directly from chat messages
|
||||||
const createRecipeRequest = {
|
const createRecipeRequest = {
|
||||||
messages: messages,
|
messages: messages,
|
||||||
title: 'Custom Recipe',
|
title: '',
|
||||||
description: 'Created from chat session',
|
description: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await createRecipe(createRecipeRequest);
|
const response = await createRecipe(createRecipeRequest);
|
||||||
@@ -138,14 +138,13 @@ export default function ChatView({
|
|||||||
window.electron.logInfo('Created recipe:');
|
window.electron.logInfo('Created recipe:');
|
||||||
window.electron.logInfo(JSON.stringify(response.recipe, null, 2));
|
window.electron.logInfo(JSON.stringify(response.recipe, null, 2));
|
||||||
|
|
||||||
// Create a new window for the recipe editor
|
|
||||||
console.log('Opening recipe editor with config:', response.recipe);
|
|
||||||
|
|
||||||
// First, verify the recipe data
|
// First, verify the recipe data
|
||||||
if (!response.recipe || !response.recipe.title) {
|
if (!response.recipe) {
|
||||||
throw new Error('Invalid recipe data received');
|
throw new Error('No recipe data received');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a new window for the recipe editor
|
||||||
|
console.log('Opening recipe editor with config:', response.recipe);
|
||||||
window.electron.createChatWindow(
|
window.electron.createChatWindow(
|
||||||
undefined, // query
|
undefined, // query
|
||||||
undefined, // dir
|
undefined, // dir
|
||||||
@@ -368,11 +367,13 @@ export default function ChatView({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card className="flex flex-col flex-1 rounded-none h-[calc(100vh-95px)] w-full bg-bgApp mt-0 border-none relative">
|
<Card className="flex flex-col flex-1 rounded-none h-[calc(100vh-95px)] w-full bg-bgApp mt-0 border-none relative">
|
||||||
{botConfig?.title && messages.length > 0 && (
|
{recipeConfig?.title && messages.length > 0 && (
|
||||||
<AgentHeader
|
<AgentHeader
|
||||||
title={botConfig.title}
|
title={recipeConfig.title}
|
||||||
profileInfo={
|
profileInfo={
|
||||||
botConfig.profile ? `${botConfig.profile} - ${botConfig.mcps || 12} MCPs` : undefined
|
recipeConfig.profile
|
||||||
|
? `${recipeConfig.profile} - ${recipeConfig.mcps || 12} MCPs`
|
||||||
|
: undefined
|
||||||
}
|
}
|
||||||
onChangeProfile={() => {
|
onChangeProfile={() => {
|
||||||
// Handle profile change
|
// Handle profile change
|
||||||
@@ -383,8 +384,8 @@ export default function ChatView({
|
|||||||
{messages.length === 0 ? (
|
{messages.length === 0 ? (
|
||||||
<Splash
|
<Splash
|
||||||
append={(text) => append(createUserMessage(text))}
|
append={(text) => append(createUserMessage(text))}
|
||||||
activities={Array.isArray(botConfig?.activities) ? botConfig.activities : null}
|
activities={Array.isArray(recipeConfig?.activities) ? recipeConfig.activities : null}
|
||||||
title={botConfig?.title}
|
title={recipeConfig?.title}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ScrollArea ref={scrollRef} className="flex-1" autoScroll>
|
<ScrollArea ref={scrollRef} className="flex-1" autoScroll>
|
||||||
|
|||||||
@@ -224,18 +224,29 @@ export default function MoreMenu({
|
|||||||
Configure .goosehints
|
Configure .goosehints
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
|
||||||
{/* Make Agent from Chat */}
|
{/* Make Agent from Chat - disabled if already in a recipe */}
|
||||||
<MenuButton
|
<MenuButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpen(false);
|
const recipeConfig = window.appConfig.get('recipeConfig');
|
||||||
// Signal to ChatView that we want to make an agent from the current chat
|
if (!recipeConfig) {
|
||||||
window.electron.logInfo('Make Agent button clicked');
|
setOpen(false);
|
||||||
window.dispatchEvent(new CustomEvent('make-agent-from-chat'));
|
// Signal to ChatView that we want to make an agent from the current chat
|
||||||
|
window.electron.logInfo('Make Agent button clicked');
|
||||||
|
window.dispatchEvent(new CustomEvent('make-agent-from-chat'));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
subtitle="Make a custom agent you can share or reuse with a link"
|
subtitle="Make a custom agent you can share or reuse with a link"
|
||||||
icon={<Send className="w-4 h-4" />}
|
icon={<Send className="w-4 h-4" />}
|
||||||
|
className={
|
||||||
|
window.appConfig.get('recipeConfig') ? 'opacity-50 cursor-not-allowed' : ''
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Make Agent from this session
|
Make Agent from this session
|
||||||
|
{window.appConfig.get('recipeConfig') && (
|
||||||
|
<div className="text-xs text-textSubtle mt-1">
|
||||||
|
(Not available while using a recipe/botling)
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
|
||||||
<MenuButton
|
<MenuButton
|
||||||
|
|||||||
Reference in New Issue
Block a user