feat: add support for custom provider configuration in the user config (#537)
### What - Add support for loading and merging custom provider configurations from a local `providers.json` file. - Allow users to override or extend default providers with their own settings. ### Why This change enables users to flexibly customize and extend provider endpoints and API keys without modifying the codebase, making the CLI more adaptable for various LLM backends and enterprise use cases. ### How - Introduced `loadProvidersFromFile` and `getMergedProviders` in config logic. - Added/updated related tests in [tests/config.test.tsx] ### Checklist - [x] Lint passes for changed files - [x] Tests pass for all files - [x] Documentation/comments updated as needed --------- Co-authored-by: Thibault Sottiaux <tibo@openai.com>
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
getAvailableModels,
|
||||
RECOMMENDED_MODELS as _RECOMMENDED_MODELS,
|
||||
} from "../utils/model-utils.js";
|
||||
import { providers } from "../utils/providers.js";
|
||||
import { Box, Text, useInput } from "ink";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
@@ -19,6 +18,7 @@ type Props = {
|
||||
currentModel: string;
|
||||
currentProvider?: string;
|
||||
hasLastResponse: boolean;
|
||||
providers?: Record<string, { name: string; baseURL: string; envKey: string }>;
|
||||
onSelect: (model: string) => void;
|
||||
onSelectProvider?: (provider: string) => void;
|
||||
onExit: () => void;
|
||||
@@ -26,6 +26,7 @@ type Props = {
|
||||
|
||||
export default function ModelOverlay({
|
||||
currentModel,
|
||||
providers = {},
|
||||
currentProvider = "openai",
|
||||
hasLastResponse,
|
||||
onSelect,
|
||||
|
||||
Reference in New Issue
Block a user