Compare commits

...

5 Commits

Author SHA1 Message Date
59fde37108 Merge 80ac0c92ba into a24992a3db 2025-03-02 07:13:33 +00:00
a24992a3db Merge pull request #655 from ShortCipher5/patch-1
chore: Add Sealos 1-click deployment
2025-03-01 21:56:01 +05:30
d584067bb1 Update README.md 2025-02-27 23:26:45 -08:00
80ac0c92ba [fix] Change useEffect dependence 2025-02-08 21:22:10 +09:00
5ed8fb47aa [fix] Problems with overlapping specific turns when generating LLM final answers 2025-02-08 20:33:44 +09:00
2 changed files with 20 additions and 4 deletions

View File

@ -143,6 +143,7 @@ You can access Perplexica over your home network by following our networking gui
## One-Click Deployment
[![Deploy to Sealos](https://raw.githubusercontent.com/labring-actions/templates/main/Deploy-on-Sealos.svg)](https://usw.sealos.io/?openapp=system-template%3FtemplateName%3Dperplexica)
[![Deploy to RepoCloud](https://d16t0pc4846x52.cloudfront.net/deploylobe.svg)](https://repocloud.io/details/?app_id=267)
## Upcoming Features

View File

@ -397,6 +397,8 @@ const ChatWindow = ({ id }: { id?: string }) => {
const [isMessagesLoaded, setIsMessagesLoaded] = useState(false);
const [pendingRewrite, setPendingRewrite] = useState<{ content: string; messageId: string } | null>(null);
const [notFound, setNotFound] = useState(false);
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
@ -436,6 +438,12 @@ const ChatWindow = ({ id }: { id?: string }) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const chatHistoryRef = useRef<[string, string][]>([]);
useEffect(() => {
chatHistoryRef.current = chatHistory;
}, [chatHistory]);
const messagesRef = useRef<Message[]>([]);
useEffect(() => {
@ -478,7 +486,7 @@ const ChatWindow = ({ id }: { id?: string }) => {
files: fileIds,
focusMode: focusMode,
optimizationMode: optimizationMode,
history: [...chatHistory, ['human', message]],
history: [...chatHistoryRef.current],
}),
);
@ -604,15 +612,22 @@ const ChatWindow = ({ id }: { id?: string }) => {
const message = messages[index - 1];
setMessages((prev) => {
return [...prev.slice(0, messages.length > 2 ? index - 1 : 0)];
return [...prev.slice(0, messages.length >= 2 ? index - 1 : 0)];
});
setChatHistory((prev) => {
return [...prev.slice(0, messages.length > 2 ? index - 1 : 0)];
return [...prev.slice(0, messages.length >= 2 ? index - 1 : 0)];
});
sendMessage(message.content, message.messageId);
setPendingRewrite({content: message.content, messageId: message.messageId});
};
useEffect(() => {
if (pendingRewrite) {
sendMessage(pendingRewrite.content, pendingRewrite.messageId);
setPendingRewrite(null);
}
}, [pendingRewrite]);
useEffect(() => {
if (isReady && initialMessage && ws?.readyState === 1) {
sendMessage(initialMessage);