Skip to content

Automate browser based workflows with AI

Workflow Copilot: various small fixes (#4454)

Stanislav Novosad6b9ea59e6757
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowCopilotChat.tsx
index 47fa6306f..f0d9fd24b 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowCopilotChat.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowCopilotChat.tsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useRef, memo } from "react";
+import { useState, useEffect, useLayoutEffect, useRef, memo } from "react";
import { getClient } from "@/api/AxiosClient";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { useIsSkyvernUser } from "@/hooks/useIsSkyvernUser";
@@ -165,6 +165,10 @@ export function WorkflowCopilotChat({
}, [messages.length, onMessageCountChange]);
useEffect(() => {
+ if (!isOpen) {
+ hasScrolledOnLoad.current = false;
+ return;
+ }
if (isLoadingHistory) {
return;
}
@@ -174,7 +178,7 @@ export function WorkflowCopilotChat({
return;
}
scrollToBottom("smooth");
- }, [messages, isLoading, isLoadingHistory]);
+ }, [messages, isLoading, isLoadingHistory, isOpen]);
useEffect(() => {
if (!workflowPermanentId) {
@@ -525,7 +529,7 @@ export function WorkflowCopilotChat({
}, [size]);
// Recalculate position when chat opens to align with button (only first time)
- useEffect(() => {
+ useLayoutEffect(() => {
if (isOpen && buttonRef?.current && !hasInitializedPosition.current) {
const newPosition = calculateDefaultPosition(
size.width,
diff --git a/skyvern/forge/prompts/skyvern/workflow-copilot.j2 b/skyvern/forge/prompts/skyvern/workflow-copilot.j2
index dbae58fef..0071c9b2b 100644
--- a/skyvern/forge/prompts/skyvern/workflow-copilot.j2
+++ b/skyvern/forge/prompts/skyvern/workflow-copilot.j2
@@ -169,8 +169,7 @@ Use this when the user's request is ambiguous, missing critical information, or
{
"type": "ASK_QUESTION",
- "user_response": "A short response to show the user in chat",
- "question": "A clear, specific question to ask the user",
+ "user_response": "A clear, specific question to ask the user",
"global_llm_context": "User's overall goal (preserve from previous)"
}