mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-09-15 22:01:33 +00:00
Compare commits
28 Commits
feat/struc
...
0dc17286b9
Author | SHA1 | Date | |
---|---|---|---|
|
0dc17286b9 | ||
|
3edd7d44dd | ||
|
1132997108 | ||
|
eadbedb713 | ||
|
37cd6d3ab5 | ||
|
88be3a045b | ||
|
45b51ab156 | ||
|
3bee01cfa7 | ||
|
567c6a8758 | ||
|
81a91da743 | ||
|
70a61ee1eb | ||
|
9d89a4413b | ||
|
6ea17d54c6 | ||
|
11a828b073 | ||
|
37022fb11e | ||
|
dd50d4927b | ||
|
fdaf3af3af | ||
|
3f2a8f862c | ||
|
58c7be6e95 | ||
|
829b4e7134 | ||
|
77870b39cc | ||
|
8e0ae9b867 | ||
|
543f1df5ce | ||
|
341aae4587 | ||
|
7f62907385 | ||
|
7c4aa683a2 | ||
|
b48b0eeb0e | ||
|
cddc793915 |
@@ -19,6 +19,7 @@
|
|||||||
"@langchain/community": "^0.3.49",
|
"@langchain/community": "^0.3.49",
|
||||||
"@langchain/core": "^0.3.66",
|
"@langchain/core": "^0.3.66",
|
||||||
"@langchain/google-genai": "^0.2.15",
|
"@langchain/google-genai": "^0.2.15",
|
||||||
|
"@langchain/groq": "^0.2.3",
|
||||||
"@langchain/ollama": "^0.2.3",
|
"@langchain/ollama": "^0.2.3",
|
||||||
"@langchain/openai": "^0.6.2",
|
"@langchain/openai": "^0.6.2",
|
||||||
"@langchain/textsplitters": "^0.1.0",
|
"@langchain/textsplitters": "^0.1.0",
|
||||||
|
@@ -1,55 +1,72 @@
|
|||||||
import { searchSearxng } from '@/lib/searxng';
|
import { searchSearxng } from '@/lib/searxng';
|
||||||
|
|
||||||
const articleWebsites = [
|
const websitesForTopic = {
|
||||||
'yahoo.com',
|
tech: {
|
||||||
'www.exchangewire.com',
|
query: ['technology news', 'latest tech', 'AI', 'science and innovation'],
|
||||||
'businessinsider.com',
|
links: ['techcrunch.com', 'wired.com', 'theverge.com'],
|
||||||
/* 'wired.com',
|
},
|
||||||
'mashable.com',
|
finance: {
|
||||||
'theverge.com',
|
query: ['finance news', 'economy', 'stock market', 'investing'],
|
||||||
'gizmodo.com',
|
links: ['bloomberg.com', 'cnbc.com', 'marketwatch.com'],
|
||||||
'cnet.com',
|
},
|
||||||
'venturebeat.com', */
|
art: {
|
||||||
];
|
query: ['art news', 'culture', 'modern art', 'cultural events'],
|
||||||
|
links: ['artnews.com', 'hyperallergic.com', 'theartnewspaper.com'],
|
||||||
|
},
|
||||||
|
sports: {
|
||||||
|
query: ['sports news', 'latest sports', 'cricket football tennis'],
|
||||||
|
links: ['espn.com', 'bbc.com/sport', 'skysports.com'],
|
||||||
|
},
|
||||||
|
entertainment: {
|
||||||
|
query: ['entertainment news', 'movies', 'TV shows', 'celebrities'],
|
||||||
|
links: ['hollywoodreporter.com', 'variety.com', 'deadline.com'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const topics = ['AI', 'tech']; /* TODO: Add UI to customize this */
|
type Topic = keyof typeof websitesForTopic;
|
||||||
|
|
||||||
export const GET = async (req: Request) => {
|
export const GET = async (req: Request) => {
|
||||||
try {
|
try {
|
||||||
const params = new URL(req.url).searchParams;
|
const params = new URL(req.url).searchParams;
|
||||||
|
|
||||||
const mode: 'normal' | 'preview' =
|
const mode: 'normal' | 'preview' =
|
||||||
(params.get('mode') as 'normal' | 'preview') || 'normal';
|
(params.get('mode') as 'normal' | 'preview') || 'normal';
|
||||||
|
const topic: Topic = (params.get('topic') as Topic) || 'tech';
|
||||||
|
|
||||||
|
const selectedTopic = websitesForTopic[topic];
|
||||||
|
|
||||||
let data = [];
|
let data = [];
|
||||||
|
|
||||||
if (mode === 'normal') {
|
if (mode === 'normal') {
|
||||||
|
const seenUrls = new Set();
|
||||||
|
|
||||||
data = (
|
data = (
|
||||||
await Promise.all([
|
await Promise.all(
|
||||||
...new Array(articleWebsites.length * topics.length)
|
selectedTopic.links.flatMap((link) =>
|
||||||
.fill(0)
|
selectedTopic.query.map(async (query) => {
|
||||||
.map(async (_, i) => {
|
|
||||||
return (
|
return (
|
||||||
await searchSearxng(
|
await searchSearxng(`site:${link} ${query}`, {
|
||||||
`site:${articleWebsites[i % articleWebsites.length]} ${
|
engines: ['bing news'],
|
||||||
topics[i % topics.length]
|
pageno: 1,
|
||||||
}`,
|
language: 'en',
|
||||||
{
|
})
|
||||||
engines: ['bing news'],
|
|
||||||
pageno: 1,
|
|
||||||
language: 'en',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
).results;
|
).results;
|
||||||
}),
|
}),
|
||||||
])
|
),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.map((result) => result)
|
|
||||||
.flat()
|
.flat()
|
||||||
|
.filter((item) => {
|
||||||
|
const url = item.url?.toLowerCase().trim();
|
||||||
|
if (seenUrls.has(url)) return false;
|
||||||
|
seenUrls.add(url);
|
||||||
|
return true;
|
||||||
|
})
|
||||||
.sort(() => Math.random() - 0.5);
|
.sort(() => Math.random() - 0.5);
|
||||||
} else {
|
} else {
|
||||||
data = (
|
data = (
|
||||||
await searchSearxng(
|
await searchSearxng(
|
||||||
`site:${articleWebsites[Math.floor(Math.random() * articleWebsites.length)]} ${topics[Math.floor(Math.random() * topics.length)]}`,
|
`site:${selectedTopic.links[Math.floor(Math.random() * selectedTopic.links.length)]} ${selectedTopic.query[Math.floor(Math.random() * selectedTopic.query.length)]}`,
|
||||||
{
|
{
|
||||||
engines: ['bing news'],
|
engines: ['bing news'],
|
||||||
pageno: 1,
|
pageno: 1,
|
||||||
|
@@ -81,8 +81,7 @@ export const POST = async (req: Request) => {
|
|||||||
if (body.chatModel?.provider === 'custom_openai') {
|
if (body.chatModel?.provider === 'custom_openai') {
|
||||||
llm = new ChatOpenAI({
|
llm = new ChatOpenAI({
|
||||||
modelName: body.chatModel?.name || getCustomOpenaiModelName(),
|
modelName: body.chatModel?.name || getCustomOpenaiModelName(),
|
||||||
apiKey:
|
apiKey: body.chatModel?.customOpenAIKey || getCustomOpenaiApiKey(),
|
||||||
body.chatModel?.customOpenAIKey || getCustomOpenaiApiKey(),
|
|
||||||
temperature: 0.7,
|
temperature: 0.7,
|
||||||
configuration: {
|
configuration: {
|
||||||
baseURL:
|
baseURL:
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
export const POST = async (req: Request) => {
|
export const POST = async (req: Request) => {
|
||||||
try {
|
try {
|
||||||
const body: { lat: number; lng: number; temperatureUnit: 'C' | 'F' } =
|
const body: {
|
||||||
await req.json();
|
lat: number;
|
||||||
|
lng: number;
|
||||||
|
measureUnit: 'Imperial' | 'Metric';
|
||||||
|
} = await req.json();
|
||||||
|
|
||||||
if (!body.lat || !body.lng) {
|
if (!body.lat || !body.lng) {
|
||||||
return Response.json(
|
return Response.json(
|
||||||
@@ -13,7 +16,9 @@ export const POST = async (req: Request) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`https://api.open-meteo.com/v1/forecast?latitude=${body.lat}&longitude=${body.lng}¤t=weather_code,temperature_2m,is_day,relative_humidity_2m,wind_speed_10m&timezone=auto${body.temperatureUnit === 'C' ? '' : '&temperature_unit=fahrenheit'}`,
|
`https://api.open-meteo.com/v1/forecast?latitude=${body.lat}&longitude=${body.lng}¤t=weather_code,temperature_2m,is_day,relative_humidity_2m,wind_speed_10m&timezone=auto${
|
||||||
|
body.measureUnit === 'Metric' ? '' : '&temperature_unit=fahrenheit'
|
||||||
|
}${body.measureUnit === 'Metric' ? '' : '&wind_speed_unit=mph'}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
@@ -35,13 +40,15 @@ export const POST = async (req: Request) => {
|
|||||||
windSpeed: number;
|
windSpeed: number;
|
||||||
icon: string;
|
icon: string;
|
||||||
temperatureUnit: 'C' | 'F';
|
temperatureUnit: 'C' | 'F';
|
||||||
|
windSpeedUnit: 'm/s' | 'mph';
|
||||||
} = {
|
} = {
|
||||||
temperature: data.current.temperature_2m,
|
temperature: data.current.temperature_2m,
|
||||||
condition: '',
|
condition: '',
|
||||||
humidity: data.current.relative_humidity_2m,
|
humidity: data.current.relative_humidity_2m,
|
||||||
windSpeed: data.current.wind_speed_10m,
|
windSpeed: data.current.wind_speed_10m,
|
||||||
icon: '',
|
icon: '',
|
||||||
temperatureUnit: body.temperatureUnit,
|
temperatureUnit: body.measureUnit === 'Metric' ? 'C' : 'F',
|
||||||
|
windSpeedUnit: body.measureUnit === 'Metric' ? 'm/s' : 'mph',
|
||||||
};
|
};
|
||||||
|
|
||||||
const code = data.current.weather_code;
|
const code = data.current.weather_code;
|
||||||
|
@@ -4,6 +4,7 @@ import { Search } from 'lucide-react';
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
interface Discover {
|
interface Discover {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -12,60 +13,66 @@ interface Discover {
|
|||||||
thumbnail: string;
|
thumbnail: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const topics: { key: string; display: string }[] = [
|
||||||
|
{
|
||||||
|
display: 'Tech & Science',
|
||||||
|
key: 'tech',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
display: 'Finance',
|
||||||
|
key: 'finance',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
display: 'Art & Culture',
|
||||||
|
key: 'art',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
display: 'Sports',
|
||||||
|
key: 'sports',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
display: 'Entertainment',
|
||||||
|
key: 'entertainment',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const [discover, setDiscover] = useState<Discover[] | null>(null);
|
const [discover, setDiscover] = useState<Discover[] | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [activeTopic, setActiveTopic] = useState<string>(topics[0].key);
|
||||||
|
|
||||||
|
const fetchArticles = async (topic: string) => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const res = await fetch(`/api/discover?topic=${topic}`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(data.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.blogs = data.blogs.filter((blog: Discover) => blog.thumbnail);
|
||||||
|
|
||||||
|
setDiscover(data.blogs);
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('Error fetching data:', err.message);
|
||||||
|
toast.error('Error fetching data');
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
fetchArticles(activeTopic);
|
||||||
try {
|
}, [activeTopic]);
|
||||||
const res = await fetch(`/api/discover`, {
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await res.json();
|
return (
|
||||||
|
|
||||||
if (!res.ok) {
|
|
||||||
throw new Error(data.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
data.blogs = data.blogs.filter((blog: Discover) => blog.thumbnail);
|
|
||||||
|
|
||||||
setDiscover(data.blogs);
|
|
||||||
} catch (err: any) {
|
|
||||||
console.error('Error fetching data:', err.message);
|
|
||||||
toast.error('Error fetching data');
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
fetchData();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return loading ? (
|
|
||||||
<div className="flex flex-row items-center justify-center min-h-screen">
|
|
||||||
<svg
|
|
||||||
aria-hidden="true"
|
|
||||||
className="w-8 h-8 text-light-200 fill-light-secondary dark:text-[#202020] animate-spin dark:fill-[#ffffff3b]"
|
|
||||||
viewBox="0 0 100 101"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M100 50.5908C100.003 78.2051 78.1951 100.003 50.5908 100C22.9765 99.9972 0.997224 78.018 1 50.4037C1.00281 22.7993 22.8108 0.997224 50.4251 1C78.0395 1.00281 100.018 22.8108 100 50.4251ZM9.08164 50.594C9.06312 73.3997 27.7909 92.1272 50.5966 92.1457C73.4023 92.1642 92.1298 73.4365 92.1483 50.6308C92.1669 27.8251 73.4392 9.0973 50.6335 9.07878C27.8278 9.06026 9.10003 27.787 9.08164 50.594Z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
d="M93.9676 39.0409C96.393 38.4037 97.8624 35.9116 96.9801 33.5533C95.1945 28.8227 92.871 24.3692 90.0681 20.348C85.6237 14.1775 79.4473 9.36872 72.0454 6.45794C64.6435 3.54717 56.3134 2.65431 48.3133 3.89319C45.869 4.27179 44.3768 6.77534 45.014 9.20079C45.6512 11.6262 48.1343 13.0956 50.5786 12.717C56.5073 11.8281 62.5542 12.5399 68.0406 14.7911C73.527 17.0422 78.2187 20.7487 81.5841 25.4923C83.7976 28.5886 85.4467 32.059 86.4416 35.7474C87.1273 38.1189 89.5423 39.6781 91.9676 39.0409Z"
|
|
||||||
fill="currentFill"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<div className="flex flex-col pt-4">
|
<div className="flex flex-col pt-4">
|
||||||
@@ -76,35 +83,73 @@ const Page = () => {
|
|||||||
<hr className="border-t border-[#2B2C2C] my-4 w-full" />
|
<hr className="border-t border-[#2B2C2C] my-4 w-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid lg:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-4 pb-28 lg:pb-8 w-full justify-items-center lg:justify-items-start">
|
<div className="flex flex-row items-center space-x-2 overflow-x-auto">
|
||||||
{discover &&
|
{topics.map((t, i) => (
|
||||||
discover?.map((item, i) => (
|
<div
|
||||||
<Link
|
key={i}
|
||||||
href={`/?q=Summary: ${item.url}`}
|
className={cn(
|
||||||
key={i}
|
'border-[0.1px] rounded-full text-sm px-3 py-1 text-nowrap transition duration-200 cursor-pointer',
|
||||||
className="max-w-sm rounded-lg overflow-hidden bg-light-secondary dark:bg-dark-secondary hover:-translate-y-[1px] transition duration-200"
|
activeTopic === t.key
|
||||||
target="_blank"
|
? 'text-cyan-300 bg-cyan-300/30 border-cyan-300/60'
|
||||||
>
|
: 'border-white/30 text-white/70 hover:text-white hover:border-white/40 hover:bg-white/5',
|
||||||
<img
|
)}
|
||||||
className="object-cover w-full aspect-video"
|
onClick={() => setActiveTopic(t.key)}
|
||||||
src={
|
>
|
||||||
new URL(item.thumbnail).origin +
|
<span>{t.display}</span>
|
||||||
new URL(item.thumbnail).pathname +
|
</div>
|
||||||
`?id=${new URL(item.thumbnail).searchParams.get('id')}`
|
))}
|
||||||
}
|
|
||||||
alt={item.title}
|
|
||||||
/>
|
|
||||||
<div className="px-6 py-4">
|
|
||||||
<div className="font-bold text-lg mb-2">
|
|
||||||
{item.title.slice(0, 100)}...
|
|
||||||
</div>
|
|
||||||
<p className="text-black-70 dark:text-white/70 text-sm">
|
|
||||||
{item.content.slice(0, 100)}...
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{loading ? (
|
||||||
|
<div className="flex flex-row items-center justify-center min-h-screen">
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
className="w-8 h-8 text-light-200 fill-light-secondary dark:text-[#202020] animate-spin dark:fill-[#ffffff3b]"
|
||||||
|
viewBox="0 0 100 101"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M100 50.5908C100.003 78.2051 78.1951 100.003 50.5908 100C22.9765 99.9972 0.997224 78.018 1 50.4037C1.00281 22.7993 22.8108 0.997224 50.4251 1C78.0395 1.00281 100.018 22.8108 100 50.4251ZM9.08164 50.594C9.06312 73.3997 27.7909 92.1272 50.5966 92.1457C73.4023 92.1642 92.1298 73.4365 92.1483 50.6308C92.1669 27.8251 73.4392 9.0973 50.6335 9.07878C27.8278 9.06026 9.10003 27.787 9.08164 50.594Z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M93.9676 39.0409C96.393 38.4037 97.8624 35.9116 96.9801 33.5533C95.1945 28.8227 92.871 24.3692 90.0681 20.348C85.6237 14.1775 79.4473 9.36872 72.0454 6.45794C64.6435 3.54717 56.3134 2.65431 48.3133 3.89319C45.869 4.27179 44.3768 6.77534 45.014 9.20079C45.6512 11.6262 48.1343 13.0956 50.5786 12.717C56.5073 11.8281 62.5542 12.5399 68.0406 14.7911C73.527 17.0422 78.2187 20.7487 81.5841 25.4923C83.7976 28.5886 85.4467 32.059 86.4416 35.7474C87.1273 38.1189 89.5423 39.6781 91.9676 39.0409Z"
|
||||||
|
fill="currentFill"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="grid lg:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-4 pb-28 pt-5 lg:pb-8 w-full justify-items-center lg:justify-items-start">
|
||||||
|
{discover &&
|
||||||
|
discover?.map((item, i) => (
|
||||||
|
<Link
|
||||||
|
href={`/?q=Summary: ${item.url}`}
|
||||||
|
key={i}
|
||||||
|
className="max-w-sm rounded-lg overflow-hidden bg-light-secondary dark:bg-dark-secondary hover:-translate-y-[1px] transition duration-200"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="object-cover w-full aspect-video"
|
||||||
|
src={
|
||||||
|
new URL(item.thumbnail).origin +
|
||||||
|
new URL(item.thumbnail).pathname +
|
||||||
|
`?id=${new URL(item.thumbnail).searchParams.get('id')}`
|
||||||
|
}
|
||||||
|
alt={item.title}
|
||||||
|
/>
|
||||||
|
<div className="px-6 py-4">
|
||||||
|
<div className="font-bold text-lg mb-2">
|
||||||
|
{item.title.slice(0, 100)}...
|
||||||
|
</div>
|
||||||
|
<p className="text-black-70 dark:text-white/70 text-sm">
|
||||||
|
{item.content.slice(0, 100)}...
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@@ -148,7 +148,9 @@ const Page = () => {
|
|||||||
const [automaticImageSearch, setAutomaticImageSearch] = useState(false);
|
const [automaticImageSearch, setAutomaticImageSearch] = useState(false);
|
||||||
const [automaticVideoSearch, setAutomaticVideoSearch] = useState(false);
|
const [automaticVideoSearch, setAutomaticVideoSearch] = useState(false);
|
||||||
const [systemInstructions, setSystemInstructions] = useState<string>('');
|
const [systemInstructions, setSystemInstructions] = useState<string>('');
|
||||||
const [temperatureUnit, setTemperatureUnit] = useState<'C' | 'F'>('C');
|
const [measureUnit, setMeasureUnit] = useState<'Imperial' | 'Metric'>(
|
||||||
|
'Metric',
|
||||||
|
);
|
||||||
const [savingStates, setSavingStates] = useState<Record<string, boolean>>({});
|
const [savingStates, setSavingStates] = useState<Record<string, boolean>>({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -211,7 +213,9 @@ const Page = () => {
|
|||||||
|
|
||||||
setSystemInstructions(localStorage.getItem('systemInstructions')!);
|
setSystemInstructions(localStorage.getItem('systemInstructions')!);
|
||||||
|
|
||||||
setTemperatureUnit(localStorage.getItem('temperatureUnit')! as 'C' | 'F');
|
setMeasureUnit(
|
||||||
|
localStorage.getItem('measureUnit')! as 'Imperial' | 'Metric',
|
||||||
|
);
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
@@ -371,8 +375,8 @@ const Page = () => {
|
|||||||
localStorage.setItem('embeddingModel', value);
|
localStorage.setItem('embeddingModel', value);
|
||||||
} else if (key === 'systemInstructions') {
|
} else if (key === 'systemInstructions') {
|
||||||
localStorage.setItem('systemInstructions', value);
|
localStorage.setItem('systemInstructions', value);
|
||||||
} else if (key === 'temperatureUnit') {
|
} else if (key === 'measureUnit') {
|
||||||
localStorage.setItem('temperatureUnit', value.toString());
|
localStorage.setItem('measureUnit', value.toString());
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to save:', err);
|
console.error('Failed to save:', err);
|
||||||
@@ -430,22 +434,22 @@ const Page = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-black/70 dark:text-white/70 text-sm">
|
<p className="text-black/70 dark:text-white/70 text-sm">
|
||||||
Temperature Unit
|
Measurement Units
|
||||||
</p>
|
</p>
|
||||||
<Select
|
<Select
|
||||||
value={temperatureUnit ?? undefined}
|
value={measureUnit ?? undefined}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setTemperatureUnit(e.target.value as 'C' | 'F');
|
setMeasureUnit(e.target.value as 'Imperial' | 'Metric');
|
||||||
saveConfig('temperatureUnit', e.target.value);
|
saveConfig('measureUnit', e.target.value);
|
||||||
}}
|
}}
|
||||||
options={[
|
options={[
|
||||||
{
|
{
|
||||||
label: 'Celsius',
|
label: 'Metric',
|
||||||
value: 'C',
|
value: 'Metric',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Fahrenheit',
|
label: 'Imperial',
|
||||||
value: 'F',
|
value: 'Imperial',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
@@ -354,7 +354,11 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
}
|
}
|
||||||
}, [isMessagesLoaded, isConfigReady]);
|
}, [isMessagesLoaded, isConfigReady]);
|
||||||
|
|
||||||
const sendMessage = async (message: string, messageId?: string) => {
|
const sendMessage = async (
|
||||||
|
message: string,
|
||||||
|
messageId?: string,
|
||||||
|
rewrite = false,
|
||||||
|
) => {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
if (!isConfigReady) {
|
if (!isConfigReady) {
|
||||||
toast.error('Cannot send message before the configuration is ready');
|
toast.error('Cannot send message before the configuration is ready');
|
||||||
@@ -482,6 +486,8 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const messageIndex = messages.findIndex((m) => m.messageId === messageId);
|
||||||
|
|
||||||
const res = await fetch('/api/chat', {
|
const res = await fetch('/api/chat', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -498,7 +504,9 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
files: fileIds,
|
files: fileIds,
|
||||||
focusMode: focusMode,
|
focusMode: focusMode,
|
||||||
optimizationMode: optimizationMode,
|
optimizationMode: optimizationMode,
|
||||||
history: chatHistory,
|
history: rewrite
|
||||||
|
? chatHistory.slice(0, messageIndex === -1 ? undefined : messageIndex)
|
||||||
|
: chatHistory,
|
||||||
chatModel: {
|
chatModel: {
|
||||||
name: chatModelProvider.name,
|
name: chatModelProvider.name,
|
||||||
provider: chatModelProvider.provider,
|
provider: chatModelProvider.provider,
|
||||||
@@ -552,7 +560,7 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
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);
|
sendMessage(message.content, message.messageId, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@@ -21,8 +21,16 @@ import SearchVideos from './SearchVideos';
|
|||||||
import { useSpeech } from 'react-text-to-speech';
|
import { useSpeech } from 'react-text-to-speech';
|
||||||
import ThinkBox from './ThinkBox';
|
import ThinkBox from './ThinkBox';
|
||||||
|
|
||||||
const ThinkTagProcessor = ({ children }: { children: React.ReactNode }) => {
|
const ThinkTagProcessor = ({
|
||||||
return <ThinkBox content={children as string} />;
|
children,
|
||||||
|
thinkingEnded,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
thinkingEnded: boolean;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<ThinkBox content={children as string} thinkingEnded={thinkingEnded} />
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const MessageBox = ({
|
const MessageBox = ({
|
||||||
@@ -46,6 +54,7 @@ const MessageBox = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [parsedMessage, setParsedMessage] = useState(message.content);
|
const [parsedMessage, setParsedMessage] = useState(message.content);
|
||||||
const [speechMessage, setSpeechMessage] = useState(message.content);
|
const [speechMessage, setSpeechMessage] = useState(message.content);
|
||||||
|
const [thinkingEnded, setThinkingEnded] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const citationRegex = /\[([^\]]+)\]/g;
|
const citationRegex = /\[([^\]]+)\]/g;
|
||||||
@@ -61,6 +70,10 @@ const MessageBox = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.role === 'assistant' && message.content.includes('</think>')) {
|
||||||
|
setThinkingEnded(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
message.role === 'assistant' &&
|
message.role === 'assistant' &&
|
||||||
message?.sources &&
|
message?.sources &&
|
||||||
@@ -88,7 +101,7 @@ const MessageBox = ({
|
|||||||
if (url) {
|
if (url) {
|
||||||
return `<a href="${url}" target="_blank" className="bg-light-secondary dark:bg-dark-secondary px-1 rounded ml-1 no-underline text-xs text-black/70 dark:text-white/70 relative">${numStr}</a>`;
|
return `<a href="${url}" target="_blank" className="bg-light-secondary dark:bg-dark-secondary px-1 rounded ml-1 no-underline text-xs text-black/70 dark:text-white/70 relative">${numStr}</a>`;
|
||||||
} else {
|
} else {
|
||||||
return `[${numStr}]`;
|
return ``;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.join('');
|
.join('');
|
||||||
@@ -99,6 +112,14 @@ const MessageBox = ({
|
|||||||
);
|
);
|
||||||
setSpeechMessage(message.content.replace(regex, ''));
|
setSpeechMessage(message.content.replace(regex, ''));
|
||||||
return;
|
return;
|
||||||
|
} else if (
|
||||||
|
message.role === 'assistant' &&
|
||||||
|
message?.sources &&
|
||||||
|
message.sources.length === 0
|
||||||
|
) {
|
||||||
|
setParsedMessage(processedMessage.replace(regex, ''));
|
||||||
|
setSpeechMessage(message.content.replace(regex, ''));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSpeechMessage(message.content.replace(regex, ''));
|
setSpeechMessage(message.content.replace(regex, ''));
|
||||||
@@ -111,6 +132,9 @@ const MessageBox = ({
|
|||||||
overrides: {
|
overrides: {
|
||||||
think: {
|
think: {
|
||||||
component: ThinkTagProcessor,
|
component: ThinkTagProcessor,
|
||||||
|
props: {
|
||||||
|
thinkingEnded: thinkingEnded,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -1,15 +1,23 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { cn } from '@/lib/utils';
|
|
||||||
import { ChevronDown, ChevronUp, BrainCircuit } from 'lucide-react';
|
import { ChevronDown, ChevronUp, BrainCircuit } from 'lucide-react';
|
||||||
|
|
||||||
interface ThinkBoxProps {
|
interface ThinkBoxProps {
|
||||||
content: string;
|
content: string;
|
||||||
|
thinkingEnded: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThinkBox = ({ content }: ThinkBoxProps) => {
|
const ThinkBox = ({ content, thinkingEnded }: ThinkBoxProps) => {
|
||||||
const [isExpanded, setIsExpanded] = useState(false);
|
const [isExpanded, setIsExpanded] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (thinkingEnded) {
|
||||||
|
setIsExpanded(false);
|
||||||
|
} else {
|
||||||
|
setIsExpanded(true);
|
||||||
|
}
|
||||||
|
}, [thinkingEnded]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-4 bg-light-secondary/50 dark:bg-dark-secondary/50 rounded-xl border border-light-200 dark:border-dark-200 overflow-hidden">
|
<div className="my-4 bg-light-secondary/50 dark:bg-dark-secondary/50 rounded-xl border border-light-200 dark:border-dark-200 overflow-hidden">
|
||||||
|
@@ -10,6 +10,7 @@ const WeatherWidget = () => {
|
|||||||
windSpeed: 0,
|
windSpeed: 0,
|
||||||
icon: '',
|
icon: '',
|
||||||
temperatureUnit: 'C',
|
temperatureUnit: 'C',
|
||||||
|
windSpeedUnit: 'm/s',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@@ -75,7 +76,7 @@ const WeatherWidget = () => {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
lat: location.latitude,
|
lat: location.latitude,
|
||||||
lng: location.longitude,
|
lng: location.longitude,
|
||||||
temperatureUnit: localStorage.getItem('temperatureUnit') ?? 'C',
|
measureUnit: localStorage.getItem('measureUnit') ?? 'Metric',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -95,6 +96,7 @@ const WeatherWidget = () => {
|
|||||||
windSpeed: data.windSpeed,
|
windSpeed: data.windSpeed,
|
||||||
icon: data.icon,
|
icon: data.icon,
|
||||||
temperatureUnit: data.temperatureUnit,
|
temperatureUnit: data.temperatureUnit,
|
||||||
|
windSpeedUnit: data.windSpeedUnit,
|
||||||
});
|
});
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
@@ -139,7 +141,7 @@ const WeatherWidget = () => {
|
|||||||
</span>
|
</span>
|
||||||
<span className="flex items-center text-xs text-black/60 dark:text-white/60">
|
<span className="flex items-center text-xs text-black/60 dark:text-white/60">
|
||||||
<Wind className="w-3 h-3 mr-1" />
|
<Wind className="w-3 h-3 mr-1" />
|
||||||
{data.windSpeed} km/h
|
{data.windSpeed} {data.windSpeedUnit}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs text-black/60 dark:text-white/60 mt-1">
|
<span className="text-xs text-black/60 dark:text-white/60 mt-1">
|
||||||
|
@@ -3,32 +3,18 @@ import {
|
|||||||
RunnableMap,
|
RunnableMap,
|
||||||
RunnableLambda,
|
RunnableLambda,
|
||||||
} from '@langchain/core/runnables';
|
} from '@langchain/core/runnables';
|
||||||
import { PromptTemplate } from '@langchain/core/prompts';
|
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
||||||
import formatChatHistoryAsString from '../utils/formatHistory';
|
import formatChatHistoryAsString from '../utils/formatHistory';
|
||||||
import { BaseMessage } from '@langchain/core/messages';
|
import { BaseMessage } from '@langchain/core/messages';
|
||||||
import { StringOutputParser } from '@langchain/core/output_parsers';
|
import { StringOutputParser } from '@langchain/core/output_parsers';
|
||||||
import { searchSearxng } from '../searxng';
|
import { searchSearxng } from '../searxng';
|
||||||
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||||
|
import LineOutputParser from '../outputParsers/lineOutputParser';
|
||||||
|
|
||||||
const imageSearchChainPrompt = `
|
const imageSearchChainPrompt = `
|
||||||
You will be given a conversation below and a follow up question. You need to rephrase the follow-up question so it is a standalone question that can be used by the LLM to search the web for images.
|
You will be given a conversation below and a follow up question. You need to rephrase the follow-up question so it is a standalone question that can be used by the LLM to search the web for images.
|
||||||
You need to make sure the rephrased question agrees with the conversation and is relevant to the conversation.
|
You need to make sure the rephrased question agrees with the conversation and is relevant to the conversation.
|
||||||
|
Output only the rephrased query wrapped in an XML <query> element. Do not include any explanation or additional text.
|
||||||
Example:
|
|
||||||
1. Follow up question: What is a cat?
|
|
||||||
Rephrased: A cat
|
|
||||||
|
|
||||||
2. Follow up question: What is a car? How does it works?
|
|
||||||
Rephrased: Car working
|
|
||||||
|
|
||||||
3. Follow up question: How does an AC work?
|
|
||||||
Rephrased: AC working
|
|
||||||
|
|
||||||
Conversation:
|
|
||||||
{chat_history}
|
|
||||||
|
|
||||||
Follow up question: {query}
|
|
||||||
Rephrased question:
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
type ImageSearchChainInput = {
|
type ImageSearchChainInput = {
|
||||||
@@ -54,12 +40,39 @@ const createImageSearchChain = (llm: BaseChatModel) => {
|
|||||||
return input.query;
|
return input.query;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
PromptTemplate.fromTemplate(imageSearchChainPrompt),
|
ChatPromptTemplate.fromMessages([
|
||||||
|
['system', imageSearchChainPrompt],
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>\n</conversation>\n<follow_up>\nWhat is a cat?\n</follow_up>',
|
||||||
|
],
|
||||||
|
['assistant', '<query>A cat</query>'],
|
||||||
|
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>\n</conversation>\n<follow_up>\nWhat is a car? How does it work?\n</follow_up>',
|
||||||
|
],
|
||||||
|
['assistant', '<query>Car working</query>'],
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>\n</conversation>\n<follow_up>\nHow does an AC work?\n</follow_up>',
|
||||||
|
],
|
||||||
|
['assistant', '<query>AC working</query>'],
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>{chat_history}</conversation>\n<follow_up>\n{query}\n</follow_up>',
|
||||||
|
],
|
||||||
|
]),
|
||||||
llm,
|
llm,
|
||||||
strParser,
|
strParser,
|
||||||
RunnableLambda.from(async (input: string) => {
|
RunnableLambda.from(async (input: string) => {
|
||||||
input = input.replace(/<think>.*?<\/think>/g, '');
|
const queryParser = new LineOutputParser({
|
||||||
|
key: 'query',
|
||||||
|
});
|
||||||
|
|
||||||
|
return await queryParser.parse(input);
|
||||||
|
}),
|
||||||
|
RunnableLambda.from(async (input: string) => {
|
||||||
const res = await searchSearxng(input, {
|
const res = await searchSearxng(input, {
|
||||||
engines: ['bing images', 'google images'],
|
engines: ['bing images', 'google images'],
|
||||||
});
|
});
|
||||||
|
@@ -3,33 +3,19 @@ import {
|
|||||||
RunnableMap,
|
RunnableMap,
|
||||||
RunnableLambda,
|
RunnableLambda,
|
||||||
} from '@langchain/core/runnables';
|
} from '@langchain/core/runnables';
|
||||||
import { PromptTemplate } from '@langchain/core/prompts';
|
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
||||||
import formatChatHistoryAsString from '../utils/formatHistory';
|
import formatChatHistoryAsString from '../utils/formatHistory';
|
||||||
import { BaseMessage } from '@langchain/core/messages';
|
import { BaseMessage } from '@langchain/core/messages';
|
||||||
import { StringOutputParser } from '@langchain/core/output_parsers';
|
import { StringOutputParser } from '@langchain/core/output_parsers';
|
||||||
import { searchSearxng } from '../searxng';
|
import { searchSearxng } from '../searxng';
|
||||||
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||||
|
import LineOutputParser from '../outputParsers/lineOutputParser';
|
||||||
|
|
||||||
const VideoSearchChainPrompt = `
|
const videoSearchChainPrompt = `
|
||||||
You will be given a conversation below and a follow up question. You need to rephrase the follow-up question so it is a standalone question that can be used by the LLM to search Youtube for videos.
|
You will be given a conversation below and a follow up question. You need to rephrase the follow-up question so it is a standalone question that can be used by the LLM to search Youtube for videos.
|
||||||
You need to make sure the rephrased question agrees with the conversation and is relevant to the conversation.
|
You need to make sure the rephrased question agrees with the conversation and is relevant to the conversation.
|
||||||
|
Output only the rephrased query wrapped in an XML <query> element. Do not include any explanation or additional text.
|
||||||
Example:
|
`;
|
||||||
1. Follow up question: How does a car work?
|
|
||||||
Rephrased: How does a car work?
|
|
||||||
|
|
||||||
2. Follow up question: What is the theory of relativity?
|
|
||||||
Rephrased: What is theory of relativity
|
|
||||||
|
|
||||||
3. Follow up question: How does an AC work?
|
|
||||||
Rephrased: How does an AC work
|
|
||||||
|
|
||||||
Conversation:
|
|
||||||
{chat_history}
|
|
||||||
|
|
||||||
Follow up question: {query}
|
|
||||||
Rephrased question:
|
|
||||||
`;
|
|
||||||
|
|
||||||
type VideoSearchChainInput = {
|
type VideoSearchChainInput = {
|
||||||
chat_history: BaseMessage[];
|
chat_history: BaseMessage[];
|
||||||
@@ -55,12 +41,37 @@ const createVideoSearchChain = (llm: BaseChatModel) => {
|
|||||||
return input.query;
|
return input.query;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
PromptTemplate.fromTemplate(VideoSearchChainPrompt),
|
ChatPromptTemplate.fromMessages([
|
||||||
|
['system', videoSearchChainPrompt],
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>\n</conversation>\n<follow_up>\nHow does a car work?\n</follow_up>',
|
||||||
|
],
|
||||||
|
['assistant', '<query>How does a car work?</query>'],
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>\n</conversation>\n<follow_up>\nWhat is the theory of relativity?\n</follow_up>',
|
||||||
|
],
|
||||||
|
['assistant', '<query>Theory of relativity</query>'],
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>\n</conversation>\n<follow_up>\nHow does an AC work?\n</follow_up>',
|
||||||
|
],
|
||||||
|
['assistant', '<query>AC working</query>'],
|
||||||
|
[
|
||||||
|
'user',
|
||||||
|
'<conversation>{chat_history}</conversation>\n<follow_up>\n{query}\n</follow_up>',
|
||||||
|
],
|
||||||
|
]),
|
||||||
llm,
|
llm,
|
||||||
strParser,
|
strParser,
|
||||||
RunnableLambda.from(async (input: string) => {
|
RunnableLambda.from(async (input: string) => {
|
||||||
input = input.replace(/<think>.*?<\/think>/g, '');
|
const queryParser = new LineOutputParser({
|
||||||
|
key: 'query',
|
||||||
|
});
|
||||||
|
return await queryParser.parse(input);
|
||||||
|
}),
|
||||||
|
RunnableLambda.from(async (input: string) => {
|
||||||
const res = await searchSearxng(input, {
|
const res = await searchSearxng(input, {
|
||||||
engines: ['youtube'],
|
engines: ['youtube'],
|
||||||
});
|
});
|
||||||
@@ -92,8 +103,8 @@ const handleVideoSearch = (
|
|||||||
input: VideoSearchChainInput,
|
input: VideoSearchChainInput,
|
||||||
llm: BaseChatModel,
|
llm: BaseChatModel,
|
||||||
) => {
|
) => {
|
||||||
const VideoSearchChain = createVideoSearchChain(llm);
|
const videoSearchChain = createVideoSearchChain(llm);
|
||||||
return VideoSearchChain.invoke(input);
|
return videoSearchChain.invoke(input);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default handleVideoSearch;
|
export default handleVideoSearch;
|
||||||
|
@@ -1,41 +1,63 @@
|
|||||||
export const webSearchRetrieverPrompt = `
|
export const webSearchRetrieverPrompt = `
|
||||||
You are an AI question rephraser. You will be given a conversation and a follow-up question; rephrase it into a standalone question that another LLM can use to search the web.
|
You are an AI question rephraser. You will be given a conversation and a follow-up question, you will have to rephrase the follow up question so it is a standalone question and can be used by another LLM to search the web for information to answer it.
|
||||||
|
If it is a simple writing task or a greeting (unless the greeting contains a question after it) like Hi, Hello, How are you, etc. than a question then you need to return \`not_needed\` as the response (This is because the LLM won't need to search the web for finding information on this topic).
|
||||||
|
If the user asks some question from some URL or wants you to summarize a PDF or a webpage (via URL) you need to return the links inside the \`links\` XML block and the question inside the \`question\` XML block. If the user wants to you to summarize the webpage or the PDF you need to return \`summarize\` inside the \`question\` XML block in place of a question and the link to summarize in the \`links\` XML block.
|
||||||
|
You must always return the rephrased question inside the \`question\` XML block, if there are no links in the follow-up question then don't insert a \`links\` XML block in your response.
|
||||||
|
|
||||||
Return ONLY a JSON object that matches this schema:
|
There are several examples attached for your reference inside the below \`examples\` XML block
|
||||||
query: string // the standalone question (or "summarize")
|
|
||||||
links: string[] // URLs extracted from the user query (empty if none)
|
|
||||||
searchRequired: boolean // true if web search is needed, false for greetings/simple writing tasks
|
|
||||||
searchMode: "" | "normal" | "news" // "" when searchRequired is false; "news" if the user asks for news/articles, otherwise "normal"
|
|
||||||
|
|
||||||
Rules
|
<examples>
|
||||||
- Greetings / simple writing tasks → query:"", links:[], searchRequired:false, searchMode:""
|
1. Follow up question: What is the capital of France
|
||||||
- Summarizing a URL → query:"summarize", links:[url...], searchRequired:true, searchMode:"normal"
|
Rephrased question:\`
|
||||||
- Asking for news/articles → searchMode:"news"
|
<question>
|
||||||
|
Capital of france
|
||||||
Examples
|
</question>
|
||||||
1. Follow-up: What is the capital of France?
|
\`
|
||||||
"query":"capital of France","links":[],"searchRequired":true,"searchMode":"normal"
|
|
||||||
|
|
||||||
2. Hi, how are you?
|
2. Hi, how are you?
|
||||||
"query":"","links":[],"searchRequired":false,"searchMode":""
|
Rephrased question\`
|
||||||
|
<question>
|
||||||
|
not_needed
|
||||||
|
</question>
|
||||||
|
\`
|
||||||
|
|
||||||
3. Follow-up: What is Docker?
|
3. Follow up question: What is Docker?
|
||||||
"query":"what is Docker","links":[],"searchRequired":true,"searchMode":"normal"
|
Rephrased question: \`
|
||||||
|
<question>
|
||||||
|
What is Docker
|
||||||
|
</question>
|
||||||
|
\`
|
||||||
|
|
||||||
4. Follow-up: Can you tell me what is X from https://example.com?
|
4. Follow up question: Can you tell me what is X from https://example.com
|
||||||
"query":"what is X","links":["https://example.com"],"searchRequired":true,"searchMode":"normal"
|
Rephrased question: \`
|
||||||
|
<question>
|
||||||
|
Can you tell me what is X?
|
||||||
|
</question>
|
||||||
|
|
||||||
5. Follow-up: Summarize the content from https://example.com
|
<links>
|
||||||
"query":"summarize","links":["https://example.com"],"searchRequired":true,"searchMode":"normal"
|
https://example.com
|
||||||
|
</links>
|
||||||
|
\`
|
||||||
|
|
||||||
6. Follow-up: Latest news about AI
|
5. Follow up question: Summarize the content from https://example.com
|
||||||
"query":"latest news about AI","links":[],"searchRequired":true,"searchMode":"news"
|
Rephrased question: \`
|
||||||
|
<question>
|
||||||
|
summarize
|
||||||
|
</question>
|
||||||
|
|
||||||
|
<links>
|
||||||
|
https://example.com
|
||||||
|
</links>
|
||||||
|
\`
|
||||||
|
</examples>
|
||||||
|
|
||||||
|
Anything below is the part of the actual conversation and you need to use conversation and the follow-up question to rephrase the follow-up question as a standalone question based on the guidelines shared above.
|
||||||
|
|
||||||
<conversation>
|
<conversation>
|
||||||
{chat_history}
|
{chat_history}
|
||||||
</conversation>
|
</conversation>
|
||||||
|
|
||||||
Follow-up question: {query}
|
Follow up question: {query}
|
||||||
Rephrased question:
|
Rephrased question:
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@@ -9,6 +9,18 @@ export const PROVIDER_INFO = {
|
|||||||
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||||
|
|
||||||
const anthropicChatModels: Record<string, string>[] = [
|
const anthropicChatModels: Record<string, string>[] = [
|
||||||
|
{
|
||||||
|
displayName: 'Claude 4.1 Opus',
|
||||||
|
key: 'claude-opus-4-1-20250805',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Claude 4 Opus',
|
||||||
|
key: 'claude-opus-4-20250514',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Claude 4 Sonnet',
|
||||||
|
key: 'claude-sonnet-4-20250514',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Claude 3.7 Sonnet',
|
displayName: 'Claude 3.7 Sonnet',
|
||||||
key: 'claude-3-7-sonnet-20250219',
|
key: 'claude-3-7-sonnet-20250219',
|
||||||
|
@@ -14,16 +14,16 @@ import { Embeddings } from '@langchain/core/embeddings';
|
|||||||
|
|
||||||
const geminiChatModels: Record<string, string>[] = [
|
const geminiChatModels: Record<string, string>[] = [
|
||||||
{
|
{
|
||||||
displayName: 'Gemini 2.5 Flash Preview 05-20',
|
displayName: 'Gemini 2.5 Flash',
|
||||||
key: 'gemini-2.5-flash-preview-05-20',
|
key: 'gemini-2.5-flash',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Gemini 2.5 Pro Preview',
|
displayName: 'Gemini 2.5 Flash-Lite',
|
||||||
key: 'gemini-2.5-pro-preview-05-06',
|
key: 'gemini-2.5-flash-lite',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Gemini 2.5 Pro Experimental',
|
displayName: 'Gemini 2.5 Pro',
|
||||||
key: 'gemini-2.5-pro-preview-05-06',
|
key: 'gemini-2.5-pro',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Gemini 2.0 Flash',
|
displayName: 'Gemini 2.0 Flash',
|
||||||
@@ -75,7 +75,7 @@ export const loadGeminiChatModels = async () => {
|
|||||||
displayName: model.displayName,
|
displayName: model.displayName,
|
||||||
model: new ChatGoogleGenerativeAI({
|
model: new ChatGoogleGenerativeAI({
|
||||||
apiKey: geminiApiKey,
|
apiKey: geminiApiKey,
|
||||||
modelName: model.key,
|
model: model.key,
|
||||||
temperature: 0.7,
|
temperature: 0.7,
|
||||||
}) as unknown as BaseChatModel,
|
}) as unknown as BaseChatModel,
|
||||||
};
|
};
|
||||||
@@ -108,7 +108,7 @@ export const loadGeminiEmbeddingModels = async () => {
|
|||||||
|
|
||||||
return embeddingModels;
|
return embeddingModels;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Error loading OpenAI embeddings models: ${err}`);
|
console.error(`Error loading Gemini embeddings models: ${err}`);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ChatOpenAI } from '@langchain/openai';
|
import { ChatGroq } from '@langchain/groq';
|
||||||
import { getGroqApiKey } from '../config';
|
import { getGroqApiKey } from '../config';
|
||||||
import { ChatModel } from '.';
|
import { ChatModel } from '.';
|
||||||
|
|
||||||
@@ -28,16 +28,10 @@ export const loadGroqChatModels = async () => {
|
|||||||
groqChatModels.forEach((model: any) => {
|
groqChatModels.forEach((model: any) => {
|
||||||
chatModels[model.id] = {
|
chatModels[model.id] = {
|
||||||
displayName: model.id,
|
displayName: model.id,
|
||||||
model: new ChatOpenAI({
|
model: new ChatGroq({
|
||||||
apiKey: groqApiKey,
|
apiKey: groqApiKey,
|
||||||
modelName: model.id,
|
model: model.id,
|
||||||
temperature: 0.7,
|
temperature: 0.7,
|
||||||
configuration: {
|
|
||||||
baseURL: 'https://api.groq.com/openai/v1',
|
|
||||||
},
|
|
||||||
metadata: {
|
|
||||||
'model-type': 'groq',
|
|
||||||
},
|
|
||||||
}) as unknown as BaseChatModel,
|
}) as unknown as BaseChatModel,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@@ -42,6 +42,18 @@ const openaiChatModels: Record<string, string>[] = [
|
|||||||
displayName: 'GPT 4.1',
|
displayName: 'GPT 4.1',
|
||||||
key: 'gpt-4.1',
|
key: 'gpt-4.1',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'GPT 5 nano',
|
||||||
|
key: 'gpt-5-nano',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'GPT 5 mini',
|
||||||
|
key: 'gpt-5-mini',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'GPT 5',
|
||||||
|
key: 'gpt-5',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const openaiEmbeddingModels: Record<string, string>[] = [
|
const openaiEmbeddingModels: Record<string, string>[] = [
|
||||||
@@ -69,7 +81,7 @@ export const loadOpenAIChatModels = async () => {
|
|||||||
model: new ChatOpenAI({
|
model: new ChatOpenAI({
|
||||||
apiKey: openaiApiKey,
|
apiKey: openaiApiKey,
|
||||||
modelName: model.key,
|
modelName: model.key,
|
||||||
temperature: 0.7,
|
temperature: model.key.includes('gpt-5') ? 1 : 0.7,
|
||||||
}) as unknown as BaseChatModel,
|
}) as unknown as BaseChatModel,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@@ -24,7 +24,6 @@ import computeSimilarity from '../utils/computeSimilarity';
|
|||||||
import formatChatHistoryAsString from '../utils/formatHistory';
|
import formatChatHistoryAsString from '../utils/formatHistory';
|
||||||
import eventEmitter from 'events';
|
import eventEmitter from 'events';
|
||||||
import { StreamEvent } from '@langchain/core/tracers/log_stream';
|
import { StreamEvent } from '@langchain/core/tracers/log_stream';
|
||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
export interface MetaSearchAgentType {
|
export interface MetaSearchAgentType {
|
||||||
searchAndAnswer: (
|
searchAndAnswer: (
|
||||||
@@ -53,17 +52,6 @@ type BasicChainInput = {
|
|||||||
query: string;
|
query: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const retrieverLLMOutputSchema = z.object({
|
|
||||||
query: z.string().describe('The query to search the web for.'),
|
|
||||||
links: z
|
|
||||||
.array(z.string())
|
|
||||||
.describe('The links to search/summarize if present'),
|
|
||||||
searchRequired: z
|
|
||||||
.boolean()
|
|
||||||
.describe('Wether there is a need to search the web'),
|
|
||||||
searchMode: z.enum(['', 'normal', 'news']).describe('The search mode.'),
|
|
||||||
});
|
|
||||||
|
|
||||||
class MetaSearchAgent implements MetaSearchAgentType {
|
class MetaSearchAgent implements MetaSearchAgentType {
|
||||||
private config: Config;
|
private config: Config;
|
||||||
private strParser = new StringOutputParser();
|
private strParser = new StringOutputParser();
|
||||||
@@ -74,71 +62,73 @@ class MetaSearchAgent implements MetaSearchAgentType {
|
|||||||
|
|
||||||
private async createSearchRetrieverChain(llm: BaseChatModel) {
|
private async createSearchRetrieverChain(llm: BaseChatModel) {
|
||||||
(llm as unknown as ChatOpenAI).temperature = 0;
|
(llm as unknown as ChatOpenAI).temperature = 0;
|
||||||
|
|
||||||
return RunnableSequence.from([
|
return RunnableSequence.from([
|
||||||
PromptTemplate.fromTemplate(this.config.queryGeneratorPrompt),
|
PromptTemplate.fromTemplate(this.config.queryGeneratorPrompt),
|
||||||
Object.assign(
|
llm,
|
||||||
Object.create(Object.getPrototypeOf(llm)),
|
this.strParser,
|
||||||
llm,
|
RunnableLambda.from(async (input: string) => {
|
||||||
).withStructuredOutput(retrieverLLMOutputSchema, {
|
const linksOutputParser = new LineListOutputParser({
|
||||||
...(llm.metadata?.['model-type'] === 'groq'
|
key: 'links',
|
||||||
? {
|
});
|
||||||
method: 'json-object',
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
}),
|
|
||||||
RunnableLambda.from(
|
|
||||||
async (input: z.infer<typeof retrieverLLMOutputSchema>) => {
|
|
||||||
let question = input.query;
|
|
||||||
const links = input.links;
|
|
||||||
|
|
||||||
if (!input.searchRequired) {
|
const questionOutputParser = new LineOutputParser({
|
||||||
return { query: '', docs: [] };
|
key: 'question',
|
||||||
|
});
|
||||||
|
|
||||||
|
const links = await linksOutputParser.parse(input);
|
||||||
|
let question = this.config.summarizer
|
||||||
|
? await questionOutputParser.parse(input)
|
||||||
|
: input;
|
||||||
|
|
||||||
|
if (question === 'not_needed') {
|
||||||
|
return { query: '', docs: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (links.length > 0) {
|
||||||
|
if (question.length === 0) {
|
||||||
|
question = 'summarize';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (links.length > 0) {
|
let docs: Document[] = [];
|
||||||
if (question.length === 0) {
|
|
||||||
question = 'summarize';
|
const linkDocs = await getDocumentsFromLinks({ links });
|
||||||
|
|
||||||
|
const docGroups: Document[] = [];
|
||||||
|
|
||||||
|
linkDocs.map((doc) => {
|
||||||
|
const URLDocExists = docGroups.find(
|
||||||
|
(d) =>
|
||||||
|
d.metadata.url === doc.metadata.url &&
|
||||||
|
d.metadata.totalDocs < 10,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!URLDocExists) {
|
||||||
|
docGroups.push({
|
||||||
|
...doc,
|
||||||
|
metadata: {
|
||||||
|
...doc.metadata,
|
||||||
|
totalDocs: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let docs: Document[] = [];
|
const docIndex = docGroups.findIndex(
|
||||||
|
(d) =>
|
||||||
|
d.metadata.url === doc.metadata.url &&
|
||||||
|
d.metadata.totalDocs < 10,
|
||||||
|
);
|
||||||
|
|
||||||
const linkDocs = await getDocumentsFromLinks({ links });
|
if (docIndex !== -1) {
|
||||||
|
docGroups[docIndex].pageContent =
|
||||||
|
docGroups[docIndex].pageContent + `\n\n` + doc.pageContent;
|
||||||
|
docGroups[docIndex].metadata.totalDocs += 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const docGroups: Document[] = [];
|
await Promise.all(
|
||||||
|
docGroups.map(async (doc) => {
|
||||||
linkDocs.map((doc) => {
|
const res = await llm.invoke(`
|
||||||
const URLDocExists = docGroups.find(
|
|
||||||
(d) =>
|
|
||||||
d.metadata.url === doc.metadata.url &&
|
|
||||||
d.metadata.totalDocs < 10,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!URLDocExists) {
|
|
||||||
docGroups.push({
|
|
||||||
...doc,
|
|
||||||
metadata: {
|
|
||||||
...doc.metadata,
|
|
||||||
totalDocs: 1,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const docIndex = docGroups.findIndex(
|
|
||||||
(d) =>
|
|
||||||
d.metadata.url === doc.metadata.url &&
|
|
||||||
d.metadata.totalDocs < 10,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (docIndex !== -1) {
|
|
||||||
docGroups[docIndex].pageContent =
|
|
||||||
docGroups[docIndex].pageContent + `\n\n` + doc.pageContent;
|
|
||||||
docGroups[docIndex].metadata.totalDocs += 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
docGroups.map(async (doc) => {
|
|
||||||
const res = await llm.invoke(`
|
|
||||||
You are a web search summarizer, tasked with summarizing a piece of text retrieved from a web search. Your job is to summarize the
|
You are a web search summarizer, tasked with summarizing a piece of text retrieved from a web search. Your job is to summarize the
|
||||||
text into a detailed, 2-4 paragraph explanation that captures the main ideas and provides a comprehensive answer to the query.
|
text into a detailed, 2-4 paragraph explanation that captures the main ideas and provides a comprehensive answer to the query.
|
||||||
If the query is \"summarize\", you should provide a detailed summary of the text. If the query is a specific question, you should answer it in the summary.
|
If the query is \"summarize\", you should provide a detailed summary of the text. If the query is a specific question, you should answer it in the summary.
|
||||||
@@ -199,50 +189,46 @@ class MetaSearchAgent implements MetaSearchAgentType {
|
|||||||
Make sure to answer the query in the summary.
|
Make sure to answer the query in the summary.
|
||||||
`);
|
`);
|
||||||
|
|
||||||
const document = new Document({
|
const document = new Document({
|
||||||
pageContent: res.content as string,
|
pageContent: res.content as string,
|
||||||
metadata: {
|
metadata: {
|
||||||
title: doc.metadata.title,
|
title: doc.metadata.title,
|
||||||
url: doc.metadata.url,
|
url: doc.metadata.url,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
docs.push(document);
|
docs.push(document);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
return { query: question, docs: docs };
|
||||||
|
} else {
|
||||||
|
question = question.replace(/<think>.*?<\/think>/g, '');
|
||||||
|
|
||||||
|
const res = await searchSearxng(question, {
|
||||||
|
language: 'en',
|
||||||
|
engines: this.config.activeEngines,
|
||||||
|
});
|
||||||
|
|
||||||
|
const documents = res.results.map(
|
||||||
|
(result) =>
|
||||||
|
new Document({
|
||||||
|
pageContent:
|
||||||
|
result.content ||
|
||||||
|
(this.config.activeEngines.includes('youtube')
|
||||||
|
? result.title
|
||||||
|
: '') /* Todo: Implement transcript grabbing using Youtubei (source: https://www.npmjs.com/package/youtubei) */,
|
||||||
|
metadata: {
|
||||||
|
title: result.title,
|
||||||
|
url: result.url,
|
||||||
|
...(result.img_src && { img_src: result.img_src }),
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return { query: question, docs: docs };
|
return { query: question, docs: documents };
|
||||||
} else {
|
}
|
||||||
question = question.replace(/<think>.*?<\/think>/g, '');
|
}),
|
||||||
|
|
||||||
const res = await searchSearxng(question, {
|
|
||||||
language: 'en',
|
|
||||||
engines:
|
|
||||||
input.searchMode === 'normal'
|
|
||||||
? this.config.activeEngines
|
|
||||||
: ['bing news'],
|
|
||||||
});
|
|
||||||
|
|
||||||
const documents = res.results.map(
|
|
||||||
(result) =>
|
|
||||||
new Document({
|
|
||||||
pageContent:
|
|
||||||
result.content ||
|
|
||||||
(this.config.activeEngines.includes('youtube')
|
|
||||||
? result.title
|
|
||||||
: '') /* Todo: Implement transcript grabbing using Youtubei (source: https://www.npmjs.com/package/youtubei) */,
|
|
||||||
metadata: {
|
|
||||||
title: result.title,
|
|
||||||
url: result.url,
|
|
||||||
...(result.img_src && { img_src: result.img_src }),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
return { query: question, docs: documents };
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
import { BaseMessage } from '@langchain/core/messages';
|
import { BaseMessage, isAIMessage } from '@langchain/core/messages';
|
||||||
|
|
||||||
const formatChatHistoryAsString = (history: BaseMessage[]) => {
|
const formatChatHistoryAsString = (history: BaseMessage[]) => {
|
||||||
return history
|
return history
|
||||||
.map((message) => `${message._getType()}: ${message.content}`)
|
.map(
|
||||||
|
(message) =>
|
||||||
|
`${isAIMessage(message) ? 'AI' : 'User'}: ${message.content}`,
|
||||||
|
)
|
||||||
.join('\n');
|
.join('\n');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
21
yarn.lock
21
yarn.lock
@@ -653,6 +653,14 @@
|
|||||||
"@google/generative-ai" "^0.24.0"
|
"@google/generative-ai" "^0.24.0"
|
||||||
uuid "^11.1.0"
|
uuid "^11.1.0"
|
||||||
|
|
||||||
|
"@langchain/groq@^0.2.3":
|
||||||
|
version "0.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@langchain/groq/-/groq-0.2.3.tgz#3bfcbfc827cf469df3a1b5bb9799f4b0212b4625"
|
||||||
|
integrity sha512-r+yjysG36a0IZxTlCMr655Feumfb4IrOyA0jLLq4l7gEhVyMpYXMwyE6evseyU2LRP+7qOPbGRVpGqAIK0MsUA==
|
||||||
|
dependencies:
|
||||||
|
groq-sdk "^0.19.0"
|
||||||
|
zod "^3.22.4"
|
||||||
|
|
||||||
"@langchain/ollama@^0.2.3":
|
"@langchain/ollama@^0.2.3":
|
||||||
version "0.2.3"
|
version "0.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/@langchain/ollama/-/ollama-0.2.3.tgz#4868e66db4fc480f08c42fc652274abbab0416f0"
|
resolved "https://registry.yarnpkg.com/@langchain/ollama/-/ollama-0.2.3.tgz#4868e66db4fc480f08c42fc652274abbab0416f0"
|
||||||
@@ -2732,6 +2740,19 @@ graphql@^16.11.0:
|
|||||||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.11.0.tgz#96d17f66370678027fdf59b2d4c20b4efaa8a633"
|
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.11.0.tgz#96d17f66370678027fdf59b2d4c20b4efaa8a633"
|
||||||
integrity sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==
|
integrity sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==
|
||||||
|
|
||||||
|
groq-sdk@^0.19.0:
|
||||||
|
version "0.19.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/groq-sdk/-/groq-sdk-0.19.0.tgz#564ce018172dc3e2e2793398e0227a035a357d09"
|
||||||
|
integrity sha512-vdh5h7ORvwvOvutA80dKF81b0gPWHxu6K/GOJBOM0n6p6CSqAVLhFfeS79Ef0j/yCycDR09jqY7jkYz9dLiS6w==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "^18.11.18"
|
||||||
|
"@types/node-fetch" "^2.6.4"
|
||||||
|
abort-controller "^3.0.0"
|
||||||
|
agentkeepalive "^4.2.1"
|
||||||
|
form-data-encoder "1.7.2"
|
||||||
|
formdata-node "^4.3.2"
|
||||||
|
node-fetch "^2.6.7"
|
||||||
|
|
||||||
guid-typescript@^1.0.9:
|
guid-typescript@^1.0.9:
|
||||||
version "1.0.9"
|
version "1.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/guid-typescript/-/guid-typescript-1.0.9.tgz#e35f77003535b0297ea08548f5ace6adb1480ddc"
|
resolved "https://registry.yarnpkg.com/guid-typescript/-/guid-typescript-1.0.9.tgz#e35f77003535b0297ea08548f5ace6adb1480ddc"
|
||||||
|
Reference in New Issue
Block a user