Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VS Code] Temp add Omnibox FF #6846

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/shared/src/experimentation/FeatureFlagProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export enum FeatureFlag {
* Whether the user will see the CTA about upgrading to Sourcegraph Teams
*/
SourcegraphTeamsUpgradeCTA = 'teams-upgrade-available-cta',

TempCodyExperimentalOnebox = 'cody-experimental-one-box',
}

const ONE_HOUR = 60 * 60 * 1000
Expand Down
10 changes: 9 additions & 1 deletion vscode/src/chat/chat-view/ChatController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
DOTCOM_URL,
type DefaultChatCommands,
type EventSource,
FeatureFlag,
type Guardrails,
ModelUsage,
type NLSSearchDynamicFilter,
Expand Down Expand Up @@ -58,6 +59,7 @@ import {
skip,
skipPendingOperation,
startWith,
storeLastValue,
subscriptionDisposable,
telemetryRecorder,
tracer,
Expand Down Expand Up @@ -193,6 +195,7 @@ export class ChatController implements vscode.Disposable, vscode.WebviewViewProv

public dispose(): void {
vscode.Disposable.from(...this.disposables).dispose()
this.featureCodyExperimentalOneBox.subscription.unsubscribe()
this.disposables = []
}

Expand Down Expand Up @@ -693,10 +696,15 @@ export class ChatController implements vscode.Disposable, vscode.WebviewViewProv
})
}

// TODO(naman/tom): Remove this FF check before the Cody release on 29th.
private featureCodyExperimentalOneBox = storeLastValue(
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.TempCodyExperimentalOnebox)
)

private async isOmniBoxEnabled(): Promise<boolean> {
const config = await ClientConfigSingleton.getInstance().getConfig()

return !!config?.omniBoxEnabled
return !!config?.omniBoxEnabled && !!this.featureCodyExperimentalOneBox.value.last
}

private async getIntentAndScores({
Expand Down
4 changes: 3 additions & 1 deletion vscode/webviews/utils/useOmniBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { useFeatureFlag } from './useFeatureFlags'

export const useOmniBox = (): boolean => {
const config = useClientConfig()
// TODO(naman/tom): Remove this FF check before the Cody release on 29th.
const tempFFCheck = useFeatureFlag(FeatureFlag.TempCodyExperimentalOnebox)

return !!config?.omniBoxEnabled
return !!config?.omniBoxEnabled && !!tempFFCheck
}

export const useOmniBoxDebug = (): boolean | undefined => {
Expand Down
Loading