fix: inconsistent usage of base URL and API key (#507)
A recent commit introduced the ability to use third-party model providers. (Really appreciate it!) However, the usage is inconsistent: some pieces of code use the custom providers, whereas others still have the old behavior. Additionally, `OPENAI_BASE_URL` is now being disregarded when it shouldn't be. This PR normalizes the usage to `getApiKey` and `getBaseUrl`, and enables the use of `OPENAI_BASE_URL` if present. --------- Co-authored-by: Gabriel Bianconi <GabrielBianconi@users.noreply.github.com>
This commit is contained in:
@@ -5,12 +5,7 @@ import type { FileOperation } from "../utils/singlepass/file_ops";
|
||||
|
||||
import Spinner from "./vendor/ink-spinner"; // Third‑party / vendor components
|
||||
import TextInput from "./vendor/ink-text-input";
|
||||
import {
|
||||
OPENAI_TIMEOUT_MS,
|
||||
OPENAI_BASE_URL as _OPENAI_BASE_URL,
|
||||
getBaseUrl,
|
||||
getApiKey,
|
||||
} from "../utils/config";
|
||||
import { OPENAI_TIMEOUT_MS, getBaseUrl, getApiKey } from "../utils/config";
|
||||
import {
|
||||
generateDiffSummary,
|
||||
generateEditSummary,
|
||||
@@ -399,8 +394,8 @@ export function SinglePassApp({
|
||||
});
|
||||
|
||||
const openai = new OpenAI({
|
||||
apiKey: getApiKey(config.provider ?? "openai"),
|
||||
baseURL: getBaseUrl(config.provider ?? "openai"),
|
||||
apiKey: getApiKey(config.provider),
|
||||
baseURL: getBaseUrl(config.provider),
|
||||
timeout: OPENAI_TIMEOUT_MS,
|
||||
});
|
||||
const chatResp = await openai.beta.chat.completions.parse({
|
||||
|
||||
Reference in New Issue
Block a user