diff --git a/README.md b/README.md index 0cf197b..77c964f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - [Installation](#installation) - [Getting Started with Docker (Recommended)](#getting-started-with-docker-recommended) - [Non-Docker Installation](#non-docker-installation) - - [Ollama connection errors](#ollama-connection-errors) + - [Ollama Connection Errors](#ollama-connection-errors) - [Using as a Search Engine](#using-as-a-search-engine) - [One-Click Deployment](#one-click-deployment) - [Upcoming Features](#upcoming-features) @@ -95,15 +95,26 @@ There are mainly 2 ways of installing Perplexica - With Docker, Without Docker. See the [installation documentation](https://github.com/ItzCrazyKns/Perplexica/tree/master/docs/installation) for more information like exposing it your network, etc. -### Ollama connection errors +### Ollama Connection Errors -If you're facing an Ollama connection error, it is often related to the backend not being able to connect to Ollama's API. How can you fix it? You can fix it by updating your Ollama API URL in the settings menu to the following: +If you're encountering an Ollama connection error, it is likely due to the backend being unable to connect to Ollama's API. To fix this issue you can: -On Windows: `http://host.docker.internal:11434`
-On Mac: `http://host.docker.internal:11434`
-On Linux: `http://private_ip_of_computer_hosting_ollama:11434` +1. **Check your Ollama API URL:** Ensure that the API URL is correctly set in the settings menu. +2. **Update API URL Based on OS:** + - **Windows:** Use `http://host.docker.internal:11434` + - **Mac:** Use `http://host.docker.internal:11434` + - **Linux:** Use `http://:11434` -You need to edit the ports accordingly. + Adjust the port number if you're using a different one. + +3. **Linux Users - Expose Ollama to Network:** + - Serve Ollama over your network with the command: + + ```bash + OLLAMA_HOST=0.0.0.0 ollama serve + ``` + + - Ensure that the port (default is 11434) is not blocked by your firewall. ## Using as a Search Engine diff --git a/package.json b/package.json index 431155e..ce5f0eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perplexica-backend", - "version": "1.6.0", + "version": "1.6.1", "license": "MIT", "author": "ItzCrazyKns", "scripts": { diff --git a/ui/components/EmptyChat.tsx b/ui/components/EmptyChat.tsx index 2aade48..ea3642b 100644 --- a/ui/components/EmptyChat.tsx +++ b/ui/components/EmptyChat.tsx @@ -1,5 +1,4 @@ import EmptyChatMessageInput from './EmptyChatMessageInput'; -import ThemeSwitcher from './theme/Switcher'; const EmptyChat = ({ sendMessage, @@ -12,8 +11,6 @@ const EmptyChat = ({ }) => { return (
- -

Research begins here. diff --git a/ui/components/EmptyChatMessageInput.tsx b/ui/components/EmptyChatMessageInput.tsx index 37ecc8f..0ff9b2e 100644 --- a/ui/components/EmptyChatMessageInput.tsx +++ b/ui/components/EmptyChatMessageInput.tsx @@ -1,5 +1,5 @@ import { ArrowRight } from 'lucide-react'; -import { useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import TextareaAutosize from 'react-textarea-autosize'; import CopilotToggle from './MessageInputActions/Copilot'; import Focus from './MessageInputActions/Focus'; @@ -16,6 +16,23 @@ const EmptyChatMessageInput = ({ const [copilotEnabled, setCopilotEnabled] = useState(false); const [message, setMessage] = useState(''); + const inputRef = useRef(null); + + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === '/') { + e.preventDefault(); + inputRef.current?.focus(); + } + }; + + useEffect(() => { + document.addEventListener('keydown', handleKeyDown); + + return () => { + document.removeEventListener('keydown', handleKeyDown); + }; + }, []); + return (
{ @@ -34,6 +51,7 @@ const EmptyChatMessageInput = ({ >
setMessage(e.target.value)} minRows={2} diff --git a/ui/components/MessageBox.tsx b/ui/components/MessageBox.tsx index 89c6761..1dce2d0 100644 --- a/ui/components/MessageBox.tsx +++ b/ui/components/MessageBox.tsx @@ -7,7 +7,6 @@ import { cn } from '@/lib/utils'; import { BookCopy, Disc3, - Share, Volume2, StopCircle, Layers3, diff --git a/ui/components/MessageInput.tsx b/ui/components/MessageInput.tsx index 7b54ea5..2229cdf 100644 --- a/ui/components/MessageInput.tsx +++ b/ui/components/MessageInput.tsx @@ -1,6 +1,6 @@ import { cn } from '@/lib/utils'; import { ArrowUp } from 'lucide-react'; -import { useEffect, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import TextareaAutosize from 'react-textarea-autosize'; import Attach from './MessageInputActions/Attach'; import CopilotToggle from './MessageInputActions/Copilot'; @@ -25,6 +25,23 @@ const MessageInput = ({ } }, [textareaRows, mode, message]); + const inputRef = useRef(null); + + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === '/') { + e.preventDefault(); + inputRef.current?.focus(); + } + }; + + useEffect(() => { + document.addEventListener('keydown', handleKeyDown); + + return () => { + document.removeEventListener('keydown', handleKeyDown); + }; + }, []); + return ( { @@ -47,6 +64,7 @@ const MessageInput = ({ > {mode === 'single' && } setMessage(e.target.value)} onHeightChange={(height, props) => { diff --git a/ui/components/Navbar.tsx b/ui/components/Navbar.tsx index 0123267..020dfb4 100644 --- a/ui/components/Navbar.tsx +++ b/ui/components/Navbar.tsx @@ -2,7 +2,6 @@ import { Clock, Edit, Share, Trash } from 'lucide-react'; import { Message } from './ChatWindow'; import { useEffect, useState } from 'react'; import { formatTimeDifference } from '@/lib/utils'; -import ThemeSwitcher from './theme/Switcher'; const Navbar = ({ messages }: { messages: Message[] }) => { const [title, setTitle] = useState(''); @@ -50,8 +49,6 @@ const Navbar = ({ messages }: { messages: Message[] }) => {

{title}

- -
{ return ( diff --git a/ui/components/theme/Switcher.tsx b/ui/components/theme/Switcher.tsx index 22e2ecc..43bbdc8 100644 --- a/ui/components/theme/Switcher.tsx +++ b/ui/components/theme/Switcher.tsx @@ -2,7 +2,6 @@ import { useTheme } from 'next-themes'; import { SunIcon, MoonIcon, MonitorIcon } from 'lucide-react'; import { useCallback, useEffect, useState } from 'react'; -import { cn } from '@/lib/utils'; import { Select } from '../SettingsDialog'; type Theme = 'dark' | 'light' | 'system'; @@ -53,7 +52,7 @@ const ThemeSwitcher = ({ className }: { className?: string }) => { onChange={(e) => handleThemeSwitch(e.target.value as Theme)} options={[ { value: 'light', label: 'Light' }, - { value: 'dark', label: 'Dark' } + { value: 'dark', label: 'Dark' }, ]} /> ); diff --git a/ui/package.json b/ui/package.json index 7489eea..430ad2d 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "perplexica-frontend", - "version": "1.6.0", + "version": "1.6.1", "license": "MIT", "author": "ItzCrazyKns", "scripts": {