feat(config): add searxngURL

This commit is contained in:
ItzCrazyKns
2025-10-15 13:02:08 +05:30
parent 626cb646e2
commit b67ca79e2a
3 changed files with 8 additions and 2 deletions

View File

@@ -10,3 +10,5 @@ export const getConfiguredModelProviderById = (
): ConfigModelProvider | undefined => { ): ConfigModelProvider | undefined => {
return getConfiguredModelProviders().find((p) => p.id === id) ?? undefined; return getConfiguredModelProviders().find((p) => p.id === id) ?? undefined;
}; };
export const getSearxngURL = () => configManager.getConfig('search.searxngURL', '')

View File

@@ -55,6 +55,9 @@ type Config = {
[key: string]: any; [key: string]: any;
}; };
modelProviders: ConfigModelProvider[]; modelProviders: ConfigModelProvider[];
search: {
[key: string]: any
}
}; };
type EnvMap = { type EnvMap = {
@@ -73,6 +76,7 @@ type ModelProviderUISection = {
type UIConfigSections = { type UIConfigSections = {
general: UIConfigField[]; general: UIConfigField[];
modelProviders: ModelProviderUISection[]; modelProviders: ModelProviderUISection[];
search: UIConfigField[];
}; };
export type { export type {

View File

@@ -1,5 +1,5 @@
import axios from 'axios'; import axios from 'axios';
import { getSearxngApiEndpoint } from './config'; import { getSearxngURL } from './config/serverRegistry';
interface SearxngSearchOptions { interface SearxngSearchOptions {
categories?: string[]; categories?: string[];
@@ -23,7 +23,7 @@ export const searchSearxng = async (
query: string, query: string,
opts?: SearxngSearchOptions, opts?: SearxngSearchOptions,
) => { ) => {
const searxngURL = getSearxngApiEndpoint(); const searxngURL = getSearxngURL();
const url = new URL(`${searxngURL}/search?format=json`); const url = new URL(`${searxngURL}/search?format=json`);
url.searchParams.append('q', query); url.searchParams.append('q', query);