fix: auto send prompt runtime (#3295)

This commit is contained in:
Archer
2024-12-03 00:02:56 +08:00
committed by GitHub
parent c506442993
commit f28b7e41a8
8 changed files with 79 additions and 76 deletions

View File

@@ -10,13 +10,17 @@ import { AppChatConfigType } from '@fastgpt/global/core/app/type';
import { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io';
type ChatBoxDataType = {
appId: string;
title?: string;
userAvatar?: string;
app: {
chatConfig?: AppChatConfigType;
name: string;
avatar: string;
type: `${AppTypeEnum}`;
pluginInputs: FlowNodeInputItemType[];
chatModels?: string[];
};
};
@@ -55,7 +59,9 @@ const ChatItemContextProvider = ({ children }: { children: ReactNode }) => {
const ChatBoxRef = useRef<ChatComponentRef>(null);
const variablesForm = useForm<ChatBoxInputFormType>();
const [chatBoxData, setChatBoxData] = useState<ChatBoxDataType>(defaultChatData);
const [chatBoxData, setChatBoxData] = useState<ChatBoxDataType>({
...defaultChatData
});
const isPlugin = chatBoxData.app.type === AppTypeEnum.plugin;

View File

@@ -56,10 +56,6 @@ const ChatRecordContextProvider = ({
const ChatBoxRef = useContextSelector(ChatItemContext, (v) => v.ChatBoxRef);
const [isChatRecordsLoaded, setIsChatRecordsLoaded] = useState(false);
useEffect(() => {
setIsChatRecordsLoaded(false);
}, [params]);
const {
data: chatRecords,
ScrollData,
@@ -67,6 +63,8 @@ const ChatRecordContextProvider = ({
total: totalRecordsCount
} = useScrollPagination(
async (data: getPaginationRecordsBody): Promise<PaginationResponse<ChatSiteItemType>> => {
setIsChatRecordsLoaded(false);
const res = await getChatRecords(data);
// First load scroll to bottom