feat(agents): support local LLMs
This commit is contained in:
parent
28a7175afc
commit
d37a1a8020
15 changed files with 135 additions and 100 deletions
|
@ -1,6 +1,6 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import toml, { JsonMap } from '@iarna/toml';
|
||||
import toml from '@iarna/toml';
|
||||
|
||||
const configFileName = 'config.toml';
|
||||
|
||||
|
@ -8,18 +8,21 @@ interface Config {
|
|||
GENERAL: {
|
||||
PORT: number;
|
||||
SIMILARITY_MEASURE: string;
|
||||
CHAT_MODEL_PROVIDER: string;
|
||||
CHAT_MODEL: string;
|
||||
};
|
||||
API_KEYS: {
|
||||
OPENAI: string;
|
||||
};
|
||||
API_ENDPOINTS: {
|
||||
SEARXNG: string;
|
||||
OLLAMA: string;
|
||||
};
|
||||
}
|
||||
|
||||
const loadConfig = () =>
|
||||
toml.parse(
|
||||
fs.readFileSync(path.join(process.cwd(), `${configFileName}`), 'utf-8'),
|
||||
fs.readFileSync(path.join(__dirname, `../${configFileName}`), 'utf-8'),
|
||||
) as any as Config;
|
||||
|
||||
export const getPort = () => loadConfig().GENERAL.PORT;
|
||||
|
@ -27,6 +30,13 @@ export const getPort = () => loadConfig().GENERAL.PORT;
|
|||
export const getSimilarityMeasure = () =>
|
||||
loadConfig().GENERAL.SIMILARITY_MEASURE;
|
||||
|
||||
export const getChatModelProvider = () =>
|
||||
loadConfig().GENERAL.CHAT_MODEL_PROVIDER;
|
||||
|
||||
export const getChatModel = () => loadConfig().GENERAL.CHAT_MODEL;
|
||||
|
||||
export const getOpenaiApiKey = () => loadConfig().API_KEYS.OPENAI;
|
||||
|
||||
export const getSearxngApiEndpoint = () => loadConfig().API_ENDPOINTS.SEARXNG;
|
||||
|
||||
export const getOllamaApiEndpoint = () => loadConfig().API_ENDPOINTS.OLLAMA;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue