hotfix: don't always run prompt (#2773)
Co-authored-by: Lifei Zhou <lifei@squareup.com>
This commit is contained in:
@@ -82,7 +82,6 @@ export default function ChatView({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ChatContent({
|
function ChatContent({
|
||||||
readyForAutoUserPrompt,
|
|
||||||
chat,
|
chat,
|
||||||
setChat,
|
setChat,
|
||||||
setView,
|
setView,
|
||||||
@@ -103,7 +102,6 @@ function ChatContent({
|
|||||||
const [droppedFiles, setDroppedFiles] = useState<string[]>([]);
|
const [droppedFiles, setDroppedFiles] = useState<string[]>([]);
|
||||||
|
|
||||||
const scrollRef = useRef<ScrollAreaHandle>(null);
|
const scrollRef = useRef<ScrollAreaHandle>(null);
|
||||||
const hasSentPromptRef = useRef(false);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
summaryContent,
|
summaryContent,
|
||||||
@@ -291,13 +289,10 @@ function ChatContent({
|
|||||||
}
|
}
|
||||||
}, [messages]);
|
}, [messages]);
|
||||||
|
|
||||||
useEffect(() => {
|
// Pre-fill input with recipe prompt instead of auto-sending it
|
||||||
const prompt = recipeConfig?.prompt;
|
const initialPrompt = useMemo(() => {
|
||||||
if (prompt && !hasSentPromptRef.current && readyForAutoUserPrompt) {
|
return recipeConfig?.prompt || '';
|
||||||
append(prompt);
|
}, [recipeConfig?.prompt]);
|
||||||
hasSentPromptRef.current = true;
|
|
||||||
}
|
|
||||||
}, [recipeConfig?.prompt, append, readyForAutoUserPrompt]);
|
|
||||||
|
|
||||||
// Handle submit
|
// Handle submit
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
@@ -632,7 +627,7 @@ function ChatContent({
|
|||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
onStop={onStopGoose}
|
onStop={onStopGoose}
|
||||||
commandHistory={commandHistory}
|
commandHistory={commandHistory}
|
||||||
initialValue={_input}
|
initialValue={_input || initialPrompt}
|
||||||
setView={setView}
|
setView={setView}
|
||||||
hasMessages={hasMessages}
|
hasMessages={hasMessages}
|
||||||
numTokens={sessionTokenCount}
|
numTokens={sessionTokenCount}
|
||||||
|
|||||||
Reference in New Issue
Block a user