fix: auto send prompt runtime (#3295)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user