fix(server): respect disabled text generation providers #8821
ClosedMichel-Liao(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromrefs/pull/8821/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
- apps/server/src/serverSettings.ts line 304OutdatedResolvedby Michel-Liao(GitHub profile, opens in a new tab)@@ -299,6 +300,5 @@299300 }300301301302 function fallbackTextGenerationProvider(settings: ServerSettings): ServerSettings {302- const fallbackEntry = Object.entries(settings.providers).find(([, provider]) => provider.enabled);303- const fallback = fallbackEntry ? ProviderDriverKind.make(fallbackEntry[0]) : undefined;304- if (!fallback) {303+ const providerInstanceEntries = Object.entries(settings.providerInstances);304+ const enabledInstance = providerInstanceEntries.find(([, instance]) =>
- apps/server/src/serverSettings.ts line 330OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -305,10 +313,18 @@313+ enabledInstance?.[1].driver ??314+ (enabledLegacyProvider ? ProviderDriverKind.make(enabledLegacyProvider[0]) : undefined);315+ const fallbackInstanceId = enabledInstance316+ ? ProviderInstanceId.make(enabledInstance[0])317+ : fallbackDriver318+ ? ProviderInstanceId.make(fallbackDriver)319+ : undefined;320+ if (!fallbackDriver || !fallbackInstanceId) {305321 return settings;306322 }307323308324 return {309325 ...settings,310326 textGenerationModelSelection: {311- instanceId: ProviderInstanceId.make(fallback),327+ instanceId: fallbackInstanceId,312328 model:313- DEFAULT_TEXT_GENERATION_MODEL_BY_PROVIDER[fallback] ??314- DEFAULT_MODEL_BY_PROVIDER[fallback] ??329+ DEFAULT_TEXT_GENERATION_MODEL_BY_PROVIDER[fallbackDriver] ??330+ DEFAULT_MODEL_BY_PROVIDER[fallbackDriver] ??
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
b42ffda4-f31c-48be-8ec8-b257f55ce55fYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Warning
Your free Security trial is over. An organization admin can activate Security or dismiss this notice.
Comment `@coderabbitai help` to get the list of available commands.