Compare commits

...

10 Commits

Author SHA1 Message Date
ItzCrazyKns
3098622cb0 Merge branch 'pr/1082' 2026-03-27 17:53:59 +05:30
ItzCrazyKns
3646495bdf feat(ollama): update reasoning model list 2026-03-27 17:16:57 +05:30
ItzCrazyKns
476c4ec8c2 feat(app): lint & beautify 2026-03-27 01:24:04 +05:30
Nick
0e33641927 fix: handle upload errors and reset spinner state 2026-03-26 19:20:24 +00:00
ItzCrazyKns
8c061f20a5 Merge branch 'master' of https://github.com/ItzCrazyKns/Vane 2026-03-26 22:34:18 +05:30
ItzCrazyKns
72ac815294 feat(weather): change to freeipapi, move getApproxLocation to actions 2026-03-26 22:34:01 +05:30
ItzCrazyKns
d16b7e271a Delete serverUtils.ts 2026-03-26 22:20:13 +05:30
ItzCrazyKns
58ed869b3d feat(utils): move hash into utils 2026-03-26 22:19:48 +05:30
Kushagra Srivastava
3fede054da Merge pull request #1076 from saschabuehrle/fix/issue-1075
fix: guard against non-array searching queries in research steps
2026-03-26 20:35:51 +05:30
saschabuehrle
21bd88787e fix: guard against non-array searching queries in research steps (fixes #1075) 2026-03-22 18:11:17 +01:00
13 changed files with 130 additions and 56 deletions

View File

@@ -37,7 +37,8 @@ const getStepTitle = (
if (step.type === 'reasoning') { if (step.type === 'reasoning') {
return isStreaming && !step.reasoning ? 'Thinking...' : 'Thinking'; return isStreaming && !step.reasoning ? 'Thinking...' : 'Thinking';
} else if (step.type === 'searching') { } 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') { } else if (step.type === 'search_results') {
return `Found ${step.reading.length} ${step.reading.length === 1 ? 'result' : 'results'}`; return `Found ${step.reading.length} ${step.reading.length === 1 ? 'result' : 'results'}`;
} else if (step.type === 'reading') { } else if (step.type === 'reading') {
@@ -160,6 +161,7 @@ const AssistantSteps = ({
)} )}
{step.type === 'searching' && {step.type === 'searching' &&
Array.isArray(step.searching) &&
step.searching.length > 0 && ( step.searching.length > 0 && (
<div className="flex flex-wrap gap-1.5 mt-1.5"> <div className="flex flex-wrap gap-1.5 mt-1.5">
{step.searching.map((query, idx) => ( {step.searching.map((query, idx) => (

View File

@@ -18,6 +18,7 @@ import { Fragment, useRef, useState } from 'react';
import { useChat } from '@/lib/hooks/useChat'; import { useChat } from '@/lib/hooks/useChat';
import { AnimatePresence } from 'motion/react'; import { AnimatePresence } from 'motion/react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import { toast } from 'sonner';
const Attach = () => { const Attach = () => {
const { files, setFiles, setFileIds, fileIds } = useChat(); const { files, setFiles, setFileIds, fileIds } = useChat();
@@ -26,31 +27,59 @@ const Attach = () => {
const fileInputRef = useRef<any>(); const fileInputRef = useRef<any>();
const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => { const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
setLoading(true); const selectedFiles = e.target.files;
const data = new FormData();
for (let i = 0; i < e.target.files!.length; i++) { if (!selectedFiles?.length) {
data.append('files', e.target.files![i]); return;
} }
const embeddingModelProvider = localStorage.getItem( setLoading(true);
'embeddingModelProviderId',
);
const embeddingModel = localStorage.getItem('embeddingModelKey');
data.append('embedding_model_provider_id', embeddingModelProvider!); try {
data.append('embedding_model_key', embeddingModel!); const data = new FormData();
const res = await fetch(`/api/uploads`, { for (let i = 0; i < selectedFiles.length; i++) {
method: 'POST', data.append('files', selectedFiles[i]);
body: data, }
});
const resData = await res.json(); const embeddingModelProvider = localStorage.getItem(
'embeddingModelProviderId',
);
const embeddingModel = localStorage.getItem('embeddingModelKey');
setFiles([...files, ...resData.files]); if (!embeddingModelProvider || !embeddingModel) {
setFileIds([...fileIds, ...resData.files.map((file: any) => file.fileId)]); throw new Error('Please select an embedding model before uploading.');
setLoading(false); }
data.append('embedding_model_provider_id', embeddingModelProvider);
data.append('embedding_model_key', embeddingModel);
const res = await fetch(`/api/uploads`, {
method: 'POST',
body: data,
});
const resData = await res.json().catch(() => ({}));
if (!res.ok) {
throw new Error(resData.message || 'Failed to upload file(s).');
}
if (!Array.isArray(resData.files)) {
throw new Error('Invalid upload response from server.');
}
setFiles([...files, ...resData.files]);
setFileIds([
...fileIds,
...resData.files.map((file: any) => file.fileId),
]);
} catch (err: any) {
toast(err?.message || 'Failed to upload file(s).');
} finally {
setLoading(false);
e.target.value = '';
}
}; };
return loading ? ( return loading ? (

View File

@@ -9,6 +9,7 @@ import { Fragment, useRef, useState } from 'react';
import { useChat } from '@/lib/hooks/useChat'; import { useChat } from '@/lib/hooks/useChat';
import { AnimatePresence } from 'motion/react'; import { AnimatePresence } from 'motion/react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import { toast } from 'sonner';
const AttachSmall = () => { const AttachSmall = () => {
const { files, setFiles, setFileIds, fileIds } = useChat(); const { files, setFiles, setFileIds, fileIds } = useChat();
@@ -17,31 +18,59 @@ const AttachSmall = () => {
const fileInputRef = useRef<any>(); const fileInputRef = useRef<any>();
const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => { const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
setLoading(true); const selectedFiles = e.target.files;
const data = new FormData();
for (let i = 0; i < e.target.files!.length; i++) { if (!selectedFiles?.length) {
data.append('files', e.target.files![i]); return;
} }
const embeddingModelProvider = localStorage.getItem( setLoading(true);
'embeddingModelProviderId',
);
const embeddingModel = localStorage.getItem('embeddingModelKey');
data.append('embedding_model_provider_id', embeddingModelProvider!); try {
data.append('embedding_model_key', embeddingModel!); const data = new FormData();
const res = await fetch(`/api/uploads`, { for (let i = 0; i < selectedFiles.length; i++) {
method: 'POST', data.append('files', selectedFiles[i]);
body: data, }
});
const resData = await res.json(); const embeddingModelProvider = localStorage.getItem(
'embeddingModelProviderId',
);
const embeddingModel = localStorage.getItem('embeddingModelKey');
setFiles([...files, ...resData.files]); if (!embeddingModelProvider || !embeddingModel) {
setFileIds([...fileIds, ...resData.files.map((file: any) => file.fileId)]); throw new Error('Please select an embedding model before uploading.');
setLoading(false); }
data.append('embedding_model_provider_id', embeddingModelProvider);
data.append('embedding_model_key', embeddingModel);
const res = await fetch(`/api/uploads`, {
method: 'POST',
body: data,
});
const resData = await res.json().catch(() => ({}));
if (!res.ok) {
throw new Error(resData.message || 'Failed to upload file(s).');
}
if (!Array.isArray(resData.files)) {
throw new Error('Invalid upload response from server.');
}
setFiles([...files, ...resData.files]);
setFileIds([
...fileIds,
...resData.files.map((file: any) => file.fileId),
]);
} catch (err: any) {
toast(err?.message || 'Failed to upload file(s).');
} finally {
setLoading(false);
e.target.value = '';
}
}; };
return loading ? ( return loading ? (

View File

@@ -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 { useEffect, useState } from 'react';
import { getApproxLocation } from '@/lib/actions';
const WeatherWidget = () => { const WeatherWidget = () => {
const [data, setData] = useState({ const [data, setData] = useState({
@@ -15,17 +18,6 @@ const WeatherWidget = () => {
const [loading, setLoading] = useState(true); 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 ( const getLocation = async (
callback: (location: { callback: (location: {
latitude: number; latitude: number;

View File

@@ -20,3 +20,17 @@ export const getSuggestions = async (chatHistory: [string, string][]) => {
return data.suggestions; 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,
};
};

View File

@@ -30,7 +30,9 @@ const academicSearchAction: ResearchAction<typeof schema> = {
config.classification.classification.skipSearch === false && config.classification.classification.skipSearch === false &&
config.classification.classification.academicSearch === true, config.classification.classification.academicSearch === true,
execute: async (input, additionalConfig) => { 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( const researchBlock = additionalConfig.session.getBlock(
additionalConfig.researchBlockId, additionalConfig.researchBlockId,

View File

@@ -30,7 +30,9 @@ const socialSearchAction: ResearchAction<typeof schema> = {
config.classification.classification.skipSearch === false && config.classification.classification.skipSearch === false &&
config.classification.classification.discussionSearch === true, config.classification.classification.discussionSearch === true,
execute: async (input, additionalConfig) => { 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( const researchBlock = additionalConfig.session.getBlock(
additionalConfig.researchBlockId, additionalConfig.researchBlockId,

View File

@@ -85,7 +85,9 @@ const webSearchAction: ResearchAction<typeof actionSchema> = {
config.sources.includes('web') && config.sources.includes('web') &&
config.classification.classification.skipSearch === false, config.classification.classification.skipSearch === false,
execute: async (input, additionalConfig) => { 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( const researchBlock = additionalConfig.session.getBlock(
additionalConfig.researchBlockId, additionalConfig.researchBlockId,

View File

@@ -1,7 +1,7 @@
import path from 'node:path'; import path from 'node:path';
import fs from 'fs'; import fs from 'fs';
import { Config, ConfigModelProvider, UIConfigSections } from './types'; import { Config, ConfigModelProvider, UIConfigSections } from './types';
import { hashObj } from '../serverUtils'; import { hashObj } from '../utils/hash';
import { getModelProvidersUIConfigSection } from '../models/providers'; import { getModelProvidersUIConfigSection } from '../models/providers';
class ConfigManager { class ConfigManager {

View File

@@ -25,7 +25,9 @@ const reasoningModels = [
'qwen3', 'qwen3',
'deepseek-v3.1', 'deepseek-v3.1',
'magistral', 'magistral',
'nemotron-3-nano', 'nemotron-3',
'nemotron-cascade-2',
'glm-4.7-flash',
]; ];
class OllamaLLM extends BaseLLM<OllamaConfig> { class OllamaLLM extends BaseLLM<OllamaConfig> {

1
src/lib/serverActions.ts Normal file
View File

@@ -0,0 +1 @@
'use server';

View File

@@ -2,8 +2,7 @@ import BaseEmbedding from "../models/base/embedding";
import UploadManager from "./manager"; import UploadManager from "./manager";
import computeSimilarity from "../utils/computeSimilarity"; import computeSimilarity from "../utils/computeSimilarity";
import { Chunk } from "../types"; import { Chunk } from "../types";
import { hashObj } from "../serverUtils"; import { hashObj } from '../utils/hash';
import fs from 'fs';
type UploadStoreParams = { type UploadStoreParams = {
embeddingModel: BaseEmbedding<any>; embeddingModel: BaseEmbedding<any>;