mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2026-04-09 05:14:26 +00:00
Compare commits
7 Commits
b02f5aa37f
...
476c4ec8c2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
476c4ec8c2 | ||
|
|
8c061f20a5 | ||
|
|
72ac815294 | ||
|
|
d16b7e271a | ||
|
|
58ed869b3d | ||
|
|
3fede054da | ||
|
|
21bd88787e |
@@ -37,7 +37,8 @@ const getStepTitle = (
|
||||
if (step.type === 'reasoning') {
|
||||
return isStreaming && !step.reasoning ? 'Thinking...' : 'Thinking';
|
||||
} else if (step.type === 'searching') {
|
||||
return `Searching ${step.searching.length} ${step.searching.length === 1 ? 'query' : 'queries'}`;
|
||||
const queries = Array.isArray(step.searching) ? step.searching : [];
|
||||
return `Searching ${queries.length} ${queries.length === 1 ? 'query' : 'queries'}`;
|
||||
} else if (step.type === 'search_results') {
|
||||
return `Found ${step.reading.length} ${step.reading.length === 1 ? 'result' : 'results'}`;
|
||||
} else if (step.type === 'reading') {
|
||||
@@ -160,6 +161,7 @@ const AssistantSteps = ({
|
||||
)}
|
||||
|
||||
{step.type === 'searching' &&
|
||||
Array.isArray(step.searching) &&
|
||||
step.searching.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5 mt-1.5">
|
||||
{step.searching.map((query, idx) => (
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { Cloud, Sun, CloudRain, CloudSnow, Wind } from 'lucide-react';
|
||||
'use client';
|
||||
|
||||
import { Wind } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getApproxLocation } from '@/lib/actions';
|
||||
|
||||
const WeatherWidget = () => {
|
||||
const [data, setData] = useState({
|
||||
@@ -15,17 +18,6 @@ const WeatherWidget = () => {
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const getApproxLocation = async () => {
|
||||
const res = await fetch('https://ipwhois.app/json/');
|
||||
const data = await res.json();
|
||||
|
||||
return {
|
||||
latitude: data.latitude,
|
||||
longitude: data.longitude,
|
||||
city: data.city,
|
||||
};
|
||||
};
|
||||
|
||||
const getLocation = async (
|
||||
callback: (location: {
|
||||
latitude: number;
|
||||
|
||||
@@ -20,3 +20,17 @@ export const getSuggestions = async (chatHistory: [string, string][]) => {
|
||||
|
||||
return data.suggestions;
|
||||
};
|
||||
|
||||
export const getApproxLocation = async () => {
|
||||
const res = await fetch('https://free.freeipapi.com/api/json', {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
return {
|
||||
latitude: data.latitude,
|
||||
longitude: data.longitude,
|
||||
city: data.cityName,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -30,7 +30,9 @@ const academicSearchAction: ResearchAction<typeof schema> = {
|
||||
config.classification.classification.skipSearch === false &&
|
||||
config.classification.classification.academicSearch === true,
|
||||
execute: async (input, additionalConfig) => {
|
||||
input.queries = input.queries.slice(0, 3);
|
||||
input.queries = (
|
||||
Array.isArray(input.queries) ? input.queries : [input.queries]
|
||||
).slice(0, 3);
|
||||
|
||||
const researchBlock = additionalConfig.session.getBlock(
|
||||
additionalConfig.researchBlockId,
|
||||
|
||||
@@ -30,7 +30,9 @@ const socialSearchAction: ResearchAction<typeof schema> = {
|
||||
config.classification.classification.skipSearch === false &&
|
||||
config.classification.classification.discussionSearch === true,
|
||||
execute: async (input, additionalConfig) => {
|
||||
input.queries = input.queries.slice(0, 3);
|
||||
input.queries = (
|
||||
Array.isArray(input.queries) ? input.queries : [input.queries]
|
||||
).slice(0, 3);
|
||||
|
||||
const researchBlock = additionalConfig.session.getBlock(
|
||||
additionalConfig.researchBlockId,
|
||||
|
||||
@@ -85,7 +85,9 @@ const webSearchAction: ResearchAction<typeof actionSchema> = {
|
||||
config.sources.includes('web') &&
|
||||
config.classification.classification.skipSearch === false,
|
||||
execute: async (input, additionalConfig) => {
|
||||
input.queries = input.queries.slice(0, 3);
|
||||
input.queries = (
|
||||
Array.isArray(input.queries) ? input.queries : [input.queries]
|
||||
).slice(0, 3);
|
||||
|
||||
const researchBlock = additionalConfig.session.getBlock(
|
||||
additionalConfig.researchBlockId,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import path from 'node:path';
|
||||
import fs from 'fs';
|
||||
import { Config, ConfigModelProvider, UIConfigSections } from './types';
|
||||
import { hashObj } from '../serverUtils';
|
||||
import { hashObj } from '../utils/hash';
|
||||
import { getModelProvidersUIConfigSection } from '../models/providers';
|
||||
|
||||
class ConfigManager {
|
||||
|
||||
1
src/lib/serverActions.ts
Normal file
1
src/lib/serverActions.ts
Normal file
@@ -0,0 +1 @@
|
||||
'use server';
|
||||
@@ -2,8 +2,7 @@ import BaseEmbedding from "../models/base/embedding";
|
||||
import UploadManager from "./manager";
|
||||
import computeSimilarity from "../utils/computeSimilarity";
|
||||
import { Chunk } from "../types";
|
||||
import { hashObj } from "../serverUtils";
|
||||
import fs from 'fs';
|
||||
import { hashObj } from '../utils/hash';
|
||||
|
||||
type UploadStoreParams = {
|
||||
embeddingModel: BaseEmbedding<any>;
|
||||
|
||||
Reference in New Issue
Block a user