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') {
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) => (

View File

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

View File

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

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 { 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;

View File

@@ -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,
};
};

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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 {

View File

@@ -25,7 +25,9 @@ const reasoningModels = [
'qwen3',
'deepseek-v3.1',
'magistral',
'nemotron-3-nano',
'nemotron-3',
'nemotron-cascade-2',
'glm-4.7-flash',
];
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 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>;