mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-12-16 08:38:15 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2edef888a3 | ||
|
|
5e1746f646 | ||
|
|
2e736613c5 | ||
|
|
046daf442a |
@@ -61,9 +61,9 @@ We'd also like to thank the following partners for their generous support:
|
|||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="100" align="center">
|
<td>
|
||||||
<a href="https://dashboard.exa.ai" target="_blank">
|
<a href="https://dashboard.exa.ai" target="_blank">
|
||||||
<img src=".assets/sponsers/exa.png" alt="Exa" width="80" height="80" style="border-radius: .75rem;" />
|
<img src=".assets/sponsers/exa.png" alt="Exa" style="max-width: 8rem; max-height: 8rem; border-radius: .75rem;" />
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
|
||||||
import { Settings } from 'lucide-react';
|
import { Settings } from 'lucide-react';
|
||||||
import EmptyChatMessageInput from './EmptyChatMessageInput';
|
import EmptyChatMessageInput from './EmptyChatMessageInput';
|
||||||
import { File } from './ChatWindow';
|
import { File } from './ChatWindow';
|
||||||
@@ -8,39 +5,8 @@ import Link from 'next/link';
|
|||||||
import WeatherWidget from './WeatherWidget';
|
import WeatherWidget from './WeatherWidget';
|
||||||
import NewsArticleWidget from './NewsArticleWidget';
|
import NewsArticleWidget from './NewsArticleWidget';
|
||||||
import SettingsButtonMobile from '@/components/Settings/SettingsButtonMobile';
|
import SettingsButtonMobile from '@/components/Settings/SettingsButtonMobile';
|
||||||
import {
|
|
||||||
getShowNewsWidget,
|
|
||||||
getShowWeatherWidget,
|
|
||||||
} from '@/lib/config/clientRegistry';
|
|
||||||
|
|
||||||
const EmptyChat = () => {
|
const EmptyChat = () => {
|
||||||
const [showWeather, setShowWeather] = useState(() =>
|
|
||||||
typeof window !== 'undefined' ? getShowWeatherWidget() : true,
|
|
||||||
);
|
|
||||||
const [showNews, setShowNews] = useState(() =>
|
|
||||||
typeof window !== 'undefined' ? getShowNewsWidget() : true,
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const updateWidgetVisibility = () => {
|
|
||||||
setShowWeather(getShowWeatherWidget());
|
|
||||||
setShowNews(getShowNewsWidget());
|
|
||||||
};
|
|
||||||
|
|
||||||
updateWidgetVisibility();
|
|
||||||
|
|
||||||
window.addEventListener('client-config-changed', updateWidgetVisibility);
|
|
||||||
window.addEventListener('storage', updateWidgetVisibility);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
window.removeEventListener(
|
|
||||||
'client-config-changed',
|
|
||||||
updateWidgetVisibility,
|
|
||||||
);
|
|
||||||
window.removeEventListener('storage', updateWidgetVisibility);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div className="absolute w-full flex flex-row items-center justify-end mr-5 mt-5">
|
<div className="absolute w-full flex flex-row items-center justify-end mr-5 mt-5">
|
||||||
@@ -53,20 +19,14 @@ const EmptyChat = () => {
|
|||||||
</h2>
|
</h2>
|
||||||
<EmptyChatMessageInput />
|
<EmptyChatMessageInput />
|
||||||
</div>
|
</div>
|
||||||
{(showWeather || showNews) && (
|
|
||||||
<div className="flex flex-col w-full gap-4 mt-2 sm:flex-row sm:justify-center">
|
<div className="flex flex-col w-full gap-4 mt-2 sm:flex-row sm:justify-center">
|
||||||
{showWeather && (
|
|
||||||
<div className="flex-1 w-full">
|
<div className="flex-1 w-full">
|
||||||
<WeatherWidget />
|
<WeatherWidget />
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
{showNews && (
|
|
||||||
<div className="flex-1 w-full">
|
<div className="flex-1 w-full">
|
||||||
<NewsArticleWidget />
|
<NewsArticleWidget />
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,12 +12,6 @@ import { useTheme } from 'next-themes';
|
|||||||
import { Loader2 } from 'lucide-react';
|
import { Loader2 } from 'lucide-react';
|
||||||
import { Switch } from '@headlessui/react';
|
import { Switch } from '@headlessui/react';
|
||||||
|
|
||||||
const emitClientConfigChanged = () => {
|
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
window.dispatchEvent(new Event('client-config-changed'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const SettingsSelect = ({
|
const SettingsSelect = ({
|
||||||
field,
|
field,
|
||||||
value,
|
value,
|
||||||
@@ -41,7 +35,6 @@ const SettingsSelect = ({
|
|||||||
if (field.key === 'theme') {
|
if (field.key === 'theme') {
|
||||||
setTheme(newValue);
|
setTheme(newValue);
|
||||||
}
|
}
|
||||||
emitClientConfigChanged();
|
|
||||||
} else {
|
} else {
|
||||||
const res = await fetch('/api/config', {
|
const res = await fetch('/api/config', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -113,7 +106,6 @@ const SettingsInput = ({
|
|||||||
try {
|
try {
|
||||||
if (field.scope === 'client') {
|
if (field.scope === 'client') {
|
||||||
localStorage.setItem(field.key, newValue);
|
localStorage.setItem(field.key, newValue);
|
||||||
emitClientConfigChanged();
|
|
||||||
} else {
|
} else {
|
||||||
const res = await fetch('/api/config', {
|
const res = await fetch('/api/config', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -190,7 +182,6 @@ const SettingsTextarea = ({
|
|||||||
try {
|
try {
|
||||||
if (field.scope === 'client') {
|
if (field.scope === 'client') {
|
||||||
localStorage.setItem(field.key, newValue);
|
localStorage.setItem(field.key, newValue);
|
||||||
emitClientConfigChanged();
|
|
||||||
} else {
|
} else {
|
||||||
const res = await fetch('/api/config', {
|
const res = await fetch('/api/config', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -267,7 +258,6 @@ const SettingsSwitch = ({
|
|||||||
try {
|
try {
|
||||||
if (field.scope === 'client') {
|
if (field.scope === 'client') {
|
||||||
localStorage.setItem(field.key, String(newValue));
|
localStorage.setItem(field.key, String(newValue));
|
||||||
emitClientConfigChanged();
|
|
||||||
} else {
|
} else {
|
||||||
const res = await fetch('/api/config', {
|
const res = await fetch('/api/config', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -11,9 +11,3 @@ export const getAutoMediaSearch = () =>
|
|||||||
|
|
||||||
export const getSystemInstructions = () =>
|
export const getSystemInstructions = () =>
|
||||||
getClientConfig('systemInstructions', '');
|
getClientConfig('systemInstructions', '');
|
||||||
|
|
||||||
export const getShowWeatherWidget = () =>
|
|
||||||
getClientConfig('showWeatherWidget', 'true') === 'true';
|
|
||||||
|
|
||||||
export const getShowNewsWidget = () =>
|
|
||||||
getClientConfig('showNewsWidget', 'true') === 'true';
|
|
||||||
|
|||||||
@@ -69,24 +69,6 @@ class ConfigManager {
|
|||||||
default: true,
|
default: true,
|
||||||
scope: 'client',
|
scope: 'client',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Show weather widget',
|
|
||||||
key: 'showWeatherWidget',
|
|
||||||
type: 'switch',
|
|
||||||
required: false,
|
|
||||||
description: 'Display the weather card on the home screen.',
|
|
||||||
default: true,
|
|
||||||
scope: 'client',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Show news widget',
|
|
||||||
key: 'showNewsWidget',
|
|
||||||
type: 'switch',
|
|
||||||
required: false,
|
|
||||||
description: 'Display the recent news card on the home screen.',
|
|
||||||
default: true,
|
|
||||||
scope: 'client',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
personalization: [
|
personalization: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,22 +60,6 @@ const defaultChatModels: Model[] = [
|
|||||||
name: 'GPT 5 Mini',
|
name: 'GPT 5 Mini',
|
||||||
key: 'gpt-5-mini',
|
key: 'gpt-5-mini',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'GPT 5 Pro',
|
|
||||||
key: 'gpt-5-pro',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'GPT 5.1',
|
|
||||||
key: 'gpt-5.1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'GPT 5.2',
|
|
||||||
key: 'gpt-5.2',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'GPT 5.2 Pro',
|
|
||||||
key: 'gpt-5.2-pro',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'o1',
|
name: 'o1',
|
||||||
key: 'o1',
|
key: 'o1',
|
||||||
|
|||||||
Reference in New Issue
Block a user