fix: append the recipe prompt when start recipe in a session (#2599)

This commit is contained in:
Lifei Zhou
2025-05-21 15:59:40 +10:00
committed by GitHub
parent 0dbf155a65
commit e317153380
2 changed files with 11 additions and 2 deletions

View File

@@ -97,6 +97,7 @@ function ChatContent({
const [droppedFiles, setDroppedFiles] = useState<string[]>([]);
const scrollRef = useRef<ScrollAreaHandle>(null);
const hasSentPromptRef = useRef(false);
const {
summaryContent,
@@ -278,6 +279,14 @@ function ChatContent({
}
}, [messages]);
useEffect(() => {
const prompt = recipeConfig?.prompt;
if (prompt && !hasSentPromptRef.current) {
append(prompt);
hasSentPromptRef.current = true;
}
}, [recipeConfig?.prompt, append]);
// Handle submit
const handleSubmit = (e: React.FormEvent) => {
window.electron.startPowerSaveBlocker();
@@ -476,7 +485,6 @@ function ChatContent({
const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault();
};
return (
<div className="flex flex-col w-full h-screen items-center justify-center">
{/* Loader when generating recipe */}

View File

@@ -285,10 +285,11 @@ const windowMap = new Map<number, BrowserWindow>();
interface RecipeConfig {
id: string;
name: string;
title: string;
description: string;
instructions: string;
activities: string[];
prompt: string;
}
const createChat = async (