mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-21 01:08:33 +00:00
Ran prettier formatting
This commit is contained in:
@ -359,10 +359,13 @@ const sendMessage = async (
|
|||||||
if (options?.rewriteIndex !== undefined) {
|
if (options?.rewriteIndex !== undefined) {
|
||||||
const rewriteIndex = options.rewriteIndex;
|
const rewriteIndex = options.rewriteIndex;
|
||||||
setMessages((prev) => {
|
setMessages((prev) => {
|
||||||
return [...prev.slice(0, messages.length > 2 ? rewriteIndex - 1 : 0)]
|
return [...prev.slice(0, messages.length > 2 ? rewriteIndex - 1 : 0)];
|
||||||
});
|
});
|
||||||
|
|
||||||
messageChatHistory = chatHistory.slice(0, messages.length > 2 ? rewriteIndex - 1 : 0)
|
messageChatHistory = chatHistory.slice(
|
||||||
|
0,
|
||||||
|
messages.length > 2 ? rewriteIndex - 1 : 0,
|
||||||
|
);
|
||||||
setChatHistory(messageChatHistory);
|
setChatHistory(messageChatHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +483,8 @@ const sendMessage = async (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const ollamaContextWindow = localStorage.getItem('ollamaContextWindow') || '2048';
|
const ollamaContextWindow =
|
||||||
|
localStorage.getItem('ollamaContextWindow') || '2048';
|
||||||
|
|
||||||
const res = await fetch('/api/chat', {
|
const res = await fetch('/api/chat', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -542,9 +546,13 @@ const sendMessage = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const rewrite = (messageId: string) => {
|
const rewrite = (messageId: string) => {
|
||||||
const messageIndex = messages.findIndex((msg) => msg.messageId === messageId);
|
const messageIndex = messages.findIndex(
|
||||||
|
(msg) => msg.messageId === messageId,
|
||||||
|
);
|
||||||
if (messageIndex == -1) return;
|
if (messageIndex == -1) return;
|
||||||
sendMessage(messages[messageIndex - 1].content, messageId, { rewriteIndex: messageIndex });
|
sendMessage(messages[messageIndex - 1].content, messageId, {
|
||||||
|
rewriteIndex: messageIndex,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -77,7 +77,9 @@ const MessageInput = ({
|
|||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
'bg-light-secondary dark:bg-dark-secondary p-4 flex items-center border border-light-200 dark:border-dark-200',
|
'bg-light-secondary dark:bg-dark-secondary p-4 flex items-center border border-light-200 dark:border-dark-200',
|
||||||
mode === 'multi' ? 'flex-col rounded-lg' : 'flex-col md:flex-row rounded-lg md:rounded-full',
|
mode === 'multi'
|
||||||
|
? 'flex-col rounded-lg'
|
||||||
|
: 'flex-col md:flex-row rounded-lg md:rounded-full',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{mode === 'single' && (
|
{mode === 'single' && (
|
||||||
|
@ -35,12 +35,11 @@ const OptimizationModes = [
|
|||||||
|
|
||||||
const Optimization = ({
|
const Optimization = ({
|
||||||
optimizationMode,
|
optimizationMode,
|
||||||
setOptimizationMode
|
setOptimizationMode,
|
||||||
}: {
|
}: {
|
||||||
optimizationMode: string;
|
optimizationMode: string;
|
||||||
setOptimizationMode: (mode: string) => void;
|
setOptimizationMode: (mode: string) => void;
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
const handleOptimizationChange = (mode: string) => {
|
const handleOptimizationChange = (mode: string) => {
|
||||||
setOptimizationMode(mode);
|
setOptimizationMode(mode);
|
||||||
localStorage.setItem('optimizationMode', mode);
|
localStorage.setItem('optimizationMode', mode);
|
||||||
|
Reference in New Issue
Block a user