Merge pull request #9 from gnanam1990/feat/ollama-provider
fix: resolve frozen terminal for OpenAI/3P provider users (#3)
This commit is contained in:
@@ -103,13 +103,16 @@ export async function renderAndRun(root: Root, element: React.ReactNode): Promis
|
|||||||
}
|
}
|
||||||
export async function showSetupScreens(root: Root, permissionMode: PermissionMode, allowDangerouslySkipPermissions: boolean, commands?: Command[], claudeInChrome?: boolean, devChannels?: ChannelEntry[]): Promise<boolean> {
|
export async function showSetupScreens(root: Root, permissionMode: PermissionMode, allowDangerouslySkipPermissions: boolean, commands?: Command[], claudeInChrome?: boolean, devChannels?: ChannelEntry[]): Promise<boolean> {
|
||||||
if ("production" === 'test' || isEnvTruthy(false) || process.env.IS_DEMO // Skip onboarding in demo mode
|
if ("production" === 'test' || isEnvTruthy(false) || process.env.IS_DEMO // Skip onboarding in demo mode
|
||||||
|| isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) // Skip onboarding for OpenAI provider
|
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isOpenAIProvider = isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI);
|
||||||
const config = getGlobalConfig();
|
const config = getGlobalConfig();
|
||||||
let onboardingShown = false;
|
let onboardingShown = false;
|
||||||
if (!config.theme || !config.hasCompletedOnboarding // always show onboarding at least once
|
|
||||||
|
// Skip onboarding dialog for OpenAI provider (no Anthropic account needed)
|
||||||
|
if (!isOpenAIProvider && (!config.theme || !config.hasCompletedOnboarding) // always show onboarding at least once
|
||||||
) {
|
) {
|
||||||
onboardingShown = true;
|
onboardingShown = true;
|
||||||
const {
|
const {
|
||||||
@@ -130,10 +133,9 @@ export async function showSetupScreens(root: Root, permissionMode: PermissionMod
|
|||||||
// Note: non-interactive sessions (CI/CD with -p) never reach showSetupScreens at all.
|
// Note: non-interactive sessions (CI/CD with -p) never reach showSetupScreens at all.
|
||||||
// Skip permission checks in claubbit
|
// Skip permission checks in claubbit
|
||||||
if (!isEnvTruthy(process.env.CLAUBBIT)) {
|
if (!isEnvTruthy(process.env.CLAUBBIT)) {
|
||||||
// Fast-path: skip TrustDialog import+render when CWD is already trusted.
|
// Skip trust dialog UI for OpenAI provider (no Anthropic auth), but still
|
||||||
// If it returns true, the TrustDialog would auto-resolve regardless of
|
// run trust state initialization below so the REPL mounts correctly.
|
||||||
// security features, so we can skip the dynamic import and render cycle.
|
if (!isOpenAIProvider && !checkHasTrustDialogAccepted()) {
|
||||||
if (!checkHasTrustDialogAccepted()) {
|
|
||||||
const {
|
const {
|
||||||
TrustDialog
|
TrustDialog
|
||||||
} = await import('./components/TrustDialog/TrustDialog.js');
|
} = await import('./components/TrustDialog/TrustDialog.js');
|
||||||
@@ -142,6 +144,8 @@ export async function showSetupScreens(root: Root, permissionMode: PermissionMod
|
|||||||
|
|
||||||
// Signal that trust has been verified for this session.
|
// Signal that trust has been verified for this session.
|
||||||
// GrowthBook checks this to decide whether to include auth headers.
|
// GrowthBook checks this to decide whether to include auth headers.
|
||||||
|
// Critical for OpenAI provider: without this, downstream config lookups
|
||||||
|
// may fail silently, preventing the REPL from mounting (frozen terminal).
|
||||||
setSessionTrustAccepted(true);
|
setSessionTrustAccepted(true);
|
||||||
|
|
||||||
// Reset and reinitialize GrowthBook after trust is established.
|
// Reset and reinitialize GrowthBook after trust is established.
|
||||||
@@ -153,6 +157,8 @@ export async function showSetupScreens(root: Root, permissionMode: PermissionMod
|
|||||||
// Now that trust is established, prefetch system context if it wasn't already
|
// Now that trust is established, prefetch system context if it wasn't already
|
||||||
void getSystemContext();
|
void getSystemContext();
|
||||||
|
|
||||||
|
// Skip MCP approval dialogs for OpenAI provider (no interactive auth prompts)
|
||||||
|
if (!isOpenAIProvider) {
|
||||||
// If settings are valid, check for any mcp.json servers that need approval
|
// If settings are valid, check for any mcp.json servers that need approval
|
||||||
const {
|
const {
|
||||||
errors: allErrors
|
errors: allErrors
|
||||||
@@ -170,6 +176,7 @@ export async function showSetupScreens(root: Root, permissionMode: PermissionMod
|
|||||||
await showSetupDialog(root, done => <ClaudeMdExternalIncludesDialog onDone={done} isStandaloneDialog externalIncludes={externalIncludes} />);
|
await showSetupDialog(root, done => <ClaudeMdExternalIncludesDialog onDone={done} isStandaloneDialog externalIncludes={externalIncludes} />);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Track current repo path for teleport directory switching (fire-and-forget)
|
// Track current repo path for teleport directory switching (fire-and-forget)
|
||||||
// This must happen AFTER trust to prevent untrusted directories from poisoning the mapping
|
// This must happen AFTER trust to prevent untrusted directories from poisoning the mapping
|
||||||
|
|||||||
@@ -193,6 +193,11 @@ export function getRuntimeMainLoopModel(params: {
|
|||||||
* @returns The default model setting to use
|
* @returns The default model setting to use
|
||||||
*/
|
*/
|
||||||
export function getDefaultMainLoopModelSetting(): ModelName | ModelAlias {
|
export function getDefaultMainLoopModelSetting(): ModelName | ModelAlias {
|
||||||
|
// OpenAI provider: always use the configured OpenAI model
|
||||||
|
if (getAPIProvider() === 'openai') {
|
||||||
|
return process.env.OPENAI_MODEL || 'gpt-4o'
|
||||||
|
}
|
||||||
|
|
||||||
// Ants default to defaultModel from flag config, or Opus 1M if not configured
|
// Ants default to defaultModel from flag config, or Opus 1M if not configured
|
||||||
if (process.env.USER_TYPE === 'ant') {
|
if (process.env.USER_TYPE === 'ant') {
|
||||||
return (
|
return (
|
||||||
@@ -364,6 +369,10 @@ export function renderModelSetting(setting: ModelName | ModelAlias): string {
|
|||||||
* if the model is not recognized as a public model.
|
* if the model is not recognized as a public model.
|
||||||
*/
|
*/
|
||||||
export function getPublicModelDisplayName(model: ModelName): string | null {
|
export function getPublicModelDisplayName(model: ModelName): string | null {
|
||||||
|
// For OpenAI provider, show the actual model name (e.g. 'gpt-4o') not a Claude alias
|
||||||
|
if (getAPIProvider() === 'openai') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
switch (model) {
|
switch (model) {
|
||||||
case getModelStrings().opus46:
|
case getModelStrings().opus46:
|
||||||
return 'Opus 4.6'
|
return 'Opus 4.6'
|
||||||
|
|||||||
Reference in New Issue
Block a user