Skip to content

Commit 1b40e19

Browse files
authored
w (#8)
1 parent 8794df3 commit 1b40e19

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

codex-cli/src/utils/config.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export type MemoryConfig = {
6363
enabled: boolean;
6464
};
6565

66-
// Represents full runtime config, including loaded instructions
66+
// Represents full runtime config, including loaded instructions.
6767
export type AppConfig = {
6868
apiKey?: string;
6969
model: string;
@@ -91,7 +91,7 @@ export function discoverProjectDocPath(startDir: string): string | null {
9191
}
9292
}
9393

94-
// 2) Fallback: walk up to the Git root and look there
94+
// 2) Fallback: walk up to the Git root and look there.
9595
let dir = cwd;
9696
// eslint-disable-next-line no-constant-condition
9797
while (true) {
@@ -104,13 +104,13 @@ export function discoverProjectDocPath(startDir: string): string | null {
104104
return candidate;
105105
}
106106
}
107-
// If Git root but no doc, stop looking
107+
// If Git root but no doc, stop looking.
108108
return null;
109109
}
110110

111111
const parent = dirname(dir);
112112
if (parent === dir) {
113-
// Reached filesystem root without finding Git
113+
// Reached filesystem root without finding Git.
114114
return null;
115115
}
116116
dir = parent;
@@ -157,7 +157,6 @@ export function loadProjectDoc(cwd: string, explicitPath?: string): string {
157157
}
158158
}
159159

160-
// (Receives params for testing)
161160
export type LoadConfigOptions = {
162161
/** Working directory used for project doc discovery */
163162
cwd?: string;
@@ -210,7 +209,7 @@ export const loadConfig = (
210209
? readFileSync(instructionsFilePathResolved, "utf-8")
211210
: DEFAULT_INSTRUCTIONS;
212211

213-
// Project doc -----------------------------------------------------------
212+
// Project doc support.
214213
const shouldLoadProjectDoc =
215214
!options.disableProjectDoc &&
216215
process.env["CODEX_DISABLE_PROJECT_DOC"] !== "1";

codex-cli/src/utils/model-utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { OPENAI_API_KEY } from "./config";
22
import OpenAI from "openai";
33

4+
const MODEL_LIST_TIMEOUT_MS = 2_000; // 2 seconds
45
export const RECOMMENDED_MODELS: Array<string> = ["o4-mini", "o3"];
56

67
/**
@@ -14,9 +15,9 @@ export const RECOMMENDED_MODELS: Array<string> = ["o4-mini", "o3"];
1415
let modelsPromise: Promise<Array<string>> | null = null;
1516

1617
async function fetchModels(): Promise<Array<string>> {
17-
// If the user has not configured an API key we cannot hit the network
18+
// If the user has not configured an API key we cannot hit the network.
1819
if (!OPENAI_API_KEY) {
19-
return ["o4-mini"];
20+
return RECOMMENDED_MODELS;
2021
}
2122

2223
try {
@@ -67,8 +68,6 @@ export async function isModelSupportedForResponses(
6768
return true;
6869
}
6970

70-
const MODEL_LIST_TIMEOUT_MS = 2_000;
71-
7271
try {
7372
const models = await Promise.race<Array<string>>([
7473
getAvailableModels(),

0 commit comments

Comments
 (0)