fixed recipe schedule jobs (#3880)
This commit is contained in:
@@ -1139,8 +1139,8 @@ impl Agent {
|
|||||||
let mode = session.and_then(|s| s.execution_mode.as_deref());
|
let mode = session.and_then(|s| s.execution_mode.as_deref());
|
||||||
|
|
||||||
match mode {
|
match mode {
|
||||||
Some("foreground") => "auto".to_string(),
|
Some("foreground") => "chat".to_string(),
|
||||||
Some("background") => "chat".to_string(),
|
Some("background") => "auto".to_string(),
|
||||||
_ => config
|
_ => config
|
||||||
.get_param("GOOSE_MODE")
|
.get_param("GOOSE_MODE")
|
||||||
.unwrap_or_else(|_| "auto".to_string()),
|
.unwrap_or_else(|_| "auto".to_string()),
|
||||||
|
|||||||
@@ -1154,6 +1154,17 @@ async fn run_scheduled_job_internal(
|
|||||||
),
|
),
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
if let Some(recipe_extensions) = recipe.extensions {
|
||||||
|
for extension in recipe_extensions {
|
||||||
|
agent
|
||||||
|
.add_extension(extension.clone())
|
||||||
|
.await
|
||||||
|
.map_err(|e| JobExecutionError {
|
||||||
|
job_id: job.id.clone(),
|
||||||
|
error: format!("Failed to add extension '{}': {}", extension.name(), e),
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e) = agent.update_provider(agent_provider).await {
|
if let Err(e) = agent.update_provider(agent_provider).await {
|
||||||
return Err(JobExecutionError {
|
return Err(JobExecutionError {
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ function BaseChatContent({
|
|||||||
chatState,
|
chatState,
|
||||||
error,
|
error,
|
||||||
setMessages,
|
setMessages,
|
||||||
input: _input,
|
input,
|
||||||
setInput: _setInput,
|
setInput: _setInput,
|
||||||
handleSubmit: engineHandleSubmit,
|
handleSubmit: engineHandleSubmit,
|
||||||
onStopGoose,
|
onStopGoose,
|
||||||
@@ -231,7 +231,9 @@ function BaseChatContent({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isProcessingResponse =
|
const isProcessingResponse =
|
||||||
chatState !== ChatState.Idle && chatState !== ChatState.WaitingForUserInput;
|
chatState !== ChatState.Idle && chatState !== ChatState.WaitingForUserInput;
|
||||||
handleAutoExecution(append, isProcessingResponse);
|
handleAutoExecution(append, isProcessingResponse, () => {
|
||||||
|
setHasStartedUsingRecipe(true);
|
||||||
|
});
|
||||||
}, [handleAutoExecution, append, chatState]);
|
}, [handleAutoExecution, append, chatState]);
|
||||||
|
|
||||||
// Use shared session continuation
|
// Use shared session continuation
|
||||||
@@ -528,7 +530,7 @@ function BaseChatContent({
|
|||||||
chatState={chatState}
|
chatState={chatState}
|
||||||
onStop={onStopGoose}
|
onStop={onStopGoose}
|
||||||
commandHistory={commandHistory}
|
commandHistory={commandHistory}
|
||||||
initialValue={_input || ''}
|
initialValue={input || ''}
|
||||||
setView={setView}
|
setView={setView}
|
||||||
numTokens={sessionTokenCount}
|
numTokens={sessionTokenCount}
|
||||||
inputTokens={sessionInputTokens || localInputTokens}
|
inputTokens={sessionInputTokens || localInputTokens}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export const useRecipeManager = (messages: Message[], locationState?: LocationSt
|
|||||||
|
|
||||||
// Get the recipe's initial prompt (always return the actual prompt, don't modify based on conversation state)
|
// Get the recipe's initial prompt (always return the actual prompt, don't modify based on conversation state)
|
||||||
const initialPrompt = useMemo(() => {
|
const initialPrompt = useMemo(() => {
|
||||||
if (!recipeConfig?.prompt || !recipeAccepted) {
|
if (!recipeConfig?.prompt || !recipeAccepted || recipeConfig?.isScheduledExecution) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,11 @@ export const useRecipeManager = (messages: Message[], locationState?: LocationSt
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Auto-execution handler for scheduled recipes
|
// Auto-execution handler for scheduled recipes
|
||||||
const handleAutoExecution = (append: (message: Message) => void, isLoading: boolean) => {
|
const handleAutoExecution = (
|
||||||
|
append: (message: Message) => void,
|
||||||
|
isLoading: boolean,
|
||||||
|
onAutoExecute?: () => void
|
||||||
|
) => {
|
||||||
const hasRequiredParams = recipeConfig?.parameters && recipeConfig.parameters.length > 0;
|
const hasRequiredParams = recipeConfig?.parameters && recipeConfig.parameters.length > 0;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -205,6 +209,7 @@ export const useRecipeManager = (messages: Message[], locationState?: LocationSt
|
|||||||
|
|
||||||
const userMessage = createUserMessage(finalPrompt);
|
const userMessage = createUserMessage(finalPrompt);
|
||||||
append(userMessage);
|
append(userMessage);
|
||||||
|
onAutoExecute?.();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user