mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-11-21 12:38:14 +00:00
Compare commits
8 Commits
v1.11.0-rc
...
4b2aa0b2ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b2aa0b2ad | ||
|
|
78878313da | ||
|
|
203ab6215b | ||
|
|
80231c61fd | ||
|
|
f2daa4a842 | ||
|
|
258b233251 | ||
|
|
cd1b4de5e8 | ||
|
|
4d2b1c6d11 |
13
src/app.ts
13
src/app.ts
@@ -29,10 +29,17 @@ server.listen(port, () => {
|
||||
|
||||
startWebSocketServer(server);
|
||||
|
||||
process.on('uncaughtException', (err, origin) => {
|
||||
logger.error(`Uncaught Exception at ${origin}: ${err}`);
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.error('Uncaught Exception:', error);
|
||||
console.error(error.stack);
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
logger.error(`Unhandled Rejection at: ${promise}, reason: ${reason}`);
|
||||
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
||||
|
||||
if (reason instanceof Error) {
|
||||
console.error(reason.stack);
|
||||
} else {
|
||||
console.error(reason);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
NEXT_PUBLIC_WS_URL=ws://localhost:3001
|
||||
NEXT_PUBLIC_API_URL=http://localhost:3001/api
|
||||
NEXT_PUBLIC_API_URL=http://localhost:3001/api
|
||||
|
||||
@@ -10,6 +10,8 @@ const Chat = ({
|
||||
loading,
|
||||
messages,
|
||||
sendMessage,
|
||||
copilotEnabled,
|
||||
setCopilotEnabled,
|
||||
messageAppeared,
|
||||
rewrite,
|
||||
fileIds,
|
||||
@@ -18,6 +20,8 @@ const Chat = ({
|
||||
setFiles,
|
||||
}: {
|
||||
messages: Message[];
|
||||
copilotEnabled: boolean;
|
||||
setCopilotEnabled: (enable: boolean) => void;
|
||||
sendMessage: (message: string) => void;
|
||||
loading: boolean;
|
||||
messageAppeared: boolean;
|
||||
@@ -89,6 +93,8 @@ const Chat = ({
|
||||
<MessageInput
|
||||
loading={loading}
|
||||
sendMessage={sendMessage}
|
||||
copilotEnabled={copilotEnabled}
|
||||
setCopilotEnabled={setCopilotEnabled}
|
||||
fileIds={fileIds}
|
||||
setFileIds={setFileIds}
|
||||
files={files}
|
||||
|
||||
@@ -256,12 +256,14 @@ const useSocket = (
|
||||
});
|
||||
|
||||
ws.onerror = () => {
|
||||
debugger
|
||||
clearTimeout(timeoutId);
|
||||
setIsWSReady(false);
|
||||
toast.error('WebSocket connection error.');
|
||||
};
|
||||
|
||||
ws.onclose = () => {
|
||||
debugger
|
||||
clearTimeout(timeoutId);
|
||||
setIsWSReady(false);
|
||||
console.debug(new Date(), 'ws:disconnected');
|
||||
@@ -277,16 +279,19 @@ const useSocket = (
|
||||
}
|
||||
};
|
||||
|
||||
const attemptReconnect = () => {
|
||||
const attemptReconnect = async () => {
|
||||
retryCountRef.current += 1;
|
||||
|
||||
if (retryCountRef.current > MAX_RETRIES) {
|
||||
console.debug(new Date(), 'ws:max_retries');
|
||||
setError(true);
|
||||
toast.error(
|
||||
'Unable to connect to server after multiple attempts. Please refresh the page to try again.',
|
||||
);
|
||||
return;
|
||||
//setError(true);
|
||||
|
||||
// toast.error(
|
||||
// 'Unable to connect to server after multiple attempts. Please refresh the page to try again.',
|
||||
// );
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
//return;
|
||||
}
|
||||
|
||||
const backoffDelay = getBackoffDelay(retryCountRef.current);
|
||||
@@ -409,6 +414,7 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||
const [fileIds, setFileIds] = useState<string[]>([]);
|
||||
|
||||
const [focusMode, setFocusMode] = useState('webSearch');
|
||||
const [copilotEnabled, setCopilotEnabled] = useState(true);
|
||||
const [optimizationMode, setOptimizationMode] = useState('speed');
|
||||
|
||||
const [isMessagesLoaded, setIsMessagesLoaded] = useState(false);
|
||||
@@ -493,8 +499,9 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||
},
|
||||
files: fileIds,
|
||||
focusMode: focusMode,
|
||||
copilotEnabled:copilotEnabled,
|
||||
optimizationMode: optimizationMode,
|
||||
history: [...chatHistory, ['human', message]],
|
||||
history: [...chatHistory],
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -656,6 +663,8 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||
loading={loading}
|
||||
messages={messages}
|
||||
sendMessage={sendMessage}
|
||||
copilotEnabled={copilotEnabled}
|
||||
setCopilotEnabled={setCopilotEnabled}
|
||||
messageAppeared={messageAppeared}
|
||||
rewrite={rewrite}
|
||||
fileIds={fileIds}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { cn } from '@/lib/utils';
|
||||
import { ArrowUp } from 'lucide-react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {ArrowUp} from 'lucide-react';
|
||||
import {useEffect, useRef, useState} from 'react';
|
||||
import TextareaAutosize from 'react-textarea-autosize';
|
||||
import Attach from './MessageInputActions/Attach';
|
||||
import CopilotToggle from './MessageInputActions/Copilot';
|
||||
import { File } from './ChatWindow';
|
||||
import {File} from './ChatWindow';
|
||||
import AttachSmall from './MessageInputActions/AttachSmall';
|
||||
|
||||
const MessageInput = ({
|
||||
sendMessage,
|
||||
copilotEnabled,
|
||||
setCopilotEnabled,
|
||||
loading,
|
||||
fileIds,
|
||||
setFileIds,
|
||||
@@ -16,13 +17,14 @@ const MessageInput = ({
|
||||
setFiles,
|
||||
}: {
|
||||
sendMessage: (message: string) => void;
|
||||
copilotEnabled: boolean;
|
||||
setCopilotEnabled: (enable: boolean) => void;
|
||||
loading: boolean;
|
||||
fileIds: string[];
|
||||
setFileIds: (fileIds: string[]) => void;
|
||||
files: File[];
|
||||
setFiles: (files: File[]) => void;
|
||||
}) => {
|
||||
const [copilotEnabled, setCopilotEnabled] = useState(false);
|
||||
const [message, setMessage] = useState('');
|
||||
const [textareaRows, setTextareaRows] = useState(1);
|
||||
const [mode, setMode] = useState<'multi' | 'single'>('single');
|
||||
|
||||
@@ -48,8 +48,8 @@ const focusModes = [
|
||||
icon: (
|
||||
<SiYoutube
|
||||
className="h-5 w-auto mr-0.5"
|
||||
onPointerEnterCapture={undefined}
|
||||
onPointerLeaveCapture={undefined}
|
||||
onPointerEnter={undefined}
|
||||
onPointerLeave={undefined}
|
||||
/>
|
||||
),
|
||||
},
|
||||
@@ -60,8 +60,8 @@ const focusModes = [
|
||||
icon: (
|
||||
<SiReddit
|
||||
className="h-5 w-auto mr-0.5"
|
||||
onPointerEnterCapture={undefined}
|
||||
onPointerLeaveCapture={undefined}
|
||||
onPointerEnter={undefined}
|
||||
onPointerLeave={undefined}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@icons-pack/react-simple-icons": "^9.4.0",
|
||||
"@langchain/core": "^0.3.22",
|
||||
"@langchain/openai": "^0.0.25",
|
||||
"@tailwindcss/typography": "^0.5.12",
|
||||
"clsx": "^2.1.0",
|
||||
|
||||
4835
ui/pnpm-lock.yaml
generated
Normal file
4835
ui/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
3449
ui/yarn.lock
3449
ui/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user