Workflow Copilot: various small fixes (#4454)
This commit is contained in:
committed by
GitHub
parent
4c2c7df42c
commit
6b9ea59e67
@@ -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 { getClient } from "@/api/AxiosClient";
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { useIsSkyvernUser } from "@/hooks/useIsSkyvernUser";
|
import { useIsSkyvernUser } from "@/hooks/useIsSkyvernUser";
|
||||||
@@ -165,6 +165,10 @@ export function WorkflowCopilotChat({
|
|||||||
}, [messages.length, onMessageCountChange]);
|
}, [messages.length, onMessageCountChange]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!isOpen) {
|
||||||
|
hasScrolledOnLoad.current = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isLoadingHistory) {
|
if (isLoadingHistory) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -174,7 +178,7 @@ export function WorkflowCopilotChat({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
scrollToBottom("smooth");
|
scrollToBottom("smooth");
|
||||||
}, [messages, isLoading, isLoadingHistory]);
|
}, [messages, isLoading, isLoadingHistory, isOpen]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!workflowPermanentId) {
|
if (!workflowPermanentId) {
|
||||||
@@ -525,7 +529,7 @@ export function WorkflowCopilotChat({
|
|||||||
}, [size]);
|
}, [size]);
|
||||||
|
|
||||||
// Recalculate position when chat opens to align with button (only first time)
|
// Recalculate position when chat opens to align with button (only first time)
|
||||||
useEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (isOpen && buttonRef?.current && !hasInitializedPosition.current) {
|
if (isOpen && buttonRef?.current && !hasInitializedPosition.current) {
|
||||||
const newPosition = calculateDefaultPosition(
|
const newPosition = calculateDefaultPosition(
|
||||||
size.width,
|
size.width,
|
||||||
|
|||||||
@@ -169,8 +169,7 @@ Use this when the user's request is ambiguous, missing critical information, or
|
|||||||
|
|
||||||
{
|
{
|
||||||
"type": "ASK_QUESTION",
|
"type": "ASK_QUESTION",
|
||||||
"user_response": "A short response to show the user in chat",
|
"user_response": "A clear, specific question to ask the user",
|
||||||
"question": "A clear, specific question to ask the user",
|
|
||||||
"global_llm_context": "User's overall goal (preserve from previous)"
|
"global_llm_context": "User's overall goal (preserve from previous)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user