chore: sync providers.ts (Grok), Config.tsx, poorMode.ts from upstream
This commit is contained in:
parent
1201d88c37
commit
b21ed0506b
27
src/commands/poor/poorMode.ts
Normal file
27
src/commands/poor/poorMode.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Poor mode state — when active, skips extract_memories and prompt_suggestion
|
||||
* to reduce token consumption.
|
||||
*
|
||||
* Persisted to settings.json so it survives session restarts.
|
||||
*/
|
||||
|
||||
import {
|
||||
getInitialSettings,
|
||||
updateSettingsForSource,
|
||||
} from '../../utils/settings/settings.js'
|
||||
|
||||
let poorModeActive: boolean | null = null
|
||||
|
||||
export function isPoorModeActive(): boolean {
|
||||
if (poorModeActive === null) {
|
||||
poorModeActive = getInitialSettings().poorMode === true
|
||||
}
|
||||
return poorModeActive
|
||||
}
|
||||
|
||||
export function setPoorMode(active: boolean): void {
|
||||
poorModeActive = active
|
||||
updateSettingsForSource('userSettings', {
|
||||
poorMode: active || undefined,
|
||||
})
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,6 @@
|
|||
import type { AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS } from '../../services/analytics/index.js'
|
||||
import { getInitialSettings } from '../settings/settings.js'
|
||||
import type { SettingsJson } from '../settings/types.js'
|
||||
import { isEnvTruthy } from '../envUtils.js'
|
||||
|
||||
export type APIProvider =
|
||||
|
|
@ -9,11 +10,15 @@ export type APIProvider =
|
|||
| 'foundry'
|
||||
| 'openai'
|
||||
| 'gemini'
|
||||
| 'grok'
|
||||
|
||||
export function getAPIProvider(): APIProvider {
|
||||
const modelType = getInitialSettings().modelType
|
||||
export function getAPIProvider(
|
||||
settings: Pick<SettingsJson, 'modelType'> = getInitialSettings(),
|
||||
): APIProvider {
|
||||
const modelType = settings.modelType
|
||||
if (modelType === 'openai') return 'openai'
|
||||
if (modelType === 'gemini') return 'gemini'
|
||||
if (modelType === 'grok') return 'grok'
|
||||
|
||||
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK)) return 'bedrock'
|
||||
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX)) return 'vertex'
|
||||
|
|
@ -21,6 +26,7 @@ export function getAPIProvider(): APIProvider {
|
|||
|
||||
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI)) return 'openai'
|
||||
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_GEMINI)) return 'gemini'
|
||||
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_GROK)) return 'grok'
|
||||
|
||||
return 'firstParty'
|
||||
}
|
||||
|
|
@ -36,6 +42,7 @@ export function getAPIProviderForStatsig(): AnalyticsMetadata_I_VERIFIED_THIS_IS
|
|||
*/
|
||||
export function isFirstPartyAnthropicBaseUrl(): boolean {
|
||||
const baseUrl = process.env.ANTHROPIC_BASE_URL
|
||||
// TODO: 这里会有问题, 只配置了 openai 协议的用户, 按理说会为 true 导致问题
|
||||
if (!baseUrl) {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user