Compare commits

...

5 Commits

Author SHA1 Message Date
11d9b66c7f Merge 80ac0c92ba into 4d24d73161 2025-02-20 12:37:02 +07:00
4d24d73161 Merge pull request #631 from user1007017/patch-1
Update README.md grammatical error
2025-02-20 10:37:33 +05:30
5f0b87f4a9 Update README.md 2025-02-15 19:06:46 +01: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 5 deletions

View File

@ -44,7 +44,7 @@ Want to know more about its architecture and how it works? You can read it [here
- **Normal Mode:** Processes your query and performs a web search.
- **Focus Modes:** Special modes to better answer specific types of questions. Perplexica currently has 6 focus modes:
- **All Mode:** Searches the entire web to find the best results.
- **Writing Assistant Mode:** Helpful for writing tasks that does not require searching the web.
- **Writing Assistant Mode:** Helpful for writing tasks that do not require searching the web.
- **Academic Search Mode:** Finds articles and papers, ideal for academic research.
- **YouTube Search Mode:** Finds YouTube videos based on the search query.
- **Wolfram Alpha Search Mode:** Answers queries that need calculations or data analysis using Wolfram Alpha.

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);