Skip to content

Commit

Permalink
Dev (#1643)
Browse files Browse the repository at this point in the history
* docs: add docs and schema for "OS" provider (#1536)

* ignore .env

* ✨ use and cache imports for autocomplete (#1456)

* ✨ use and cache imports for autocomplete

* fix tsc

* add voyage rerank-1

* import Handlebars

* feat: update onboarding w/ embeddings model (#1570)

* chore(gui): remove unused pages

* feat: add embeddings step

* feat: update styles

* feat: copy button updates

* fix: correct pull command for embed model

* fix: remove commented code

* fix: remove commented code

* feat: simplify copy btn props

* chore: rename onboarding selection event

* feat: add provider config

* fix: undo msg name

* remove dead code

* fix: invalid mode check

* fix: remove testing logic

* fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582)

* small UI tweaks

* media query

* feat: add best experience onboarding

* small fixes

* feat: add free trial card to onboarding (#1600)

* feat: add free trial card to onboarding

* add import

* chore: add telemetry for full screen toggle (#1618)

* rerank-lite-1

* basic tests for VS Code extension

* chore: onboarding metrics (#1626)

* fix: pageview tracking

* feat: add onboarding telemetry

* create single `onboardingStatus` type

* improved var naming

* remove console logs

* fix double adding of context providers

* fix cross-platform build validation

* Update troubleshooting.md (#1637)

* add back skip onboarding button

* fix free trial embeddings error

* Nate/indexing fixes (#1642)

* fix pausing of indexing

* don't send empty array to openai embeddings

* catch embeddings errors without stopping entire indexing process

* update version

---------

Co-authored-by: Patrick Erichsen <[email protected]>
Co-authored-by: Jonah Wagner <[email protected]>
  • Loading branch information
3 people authored Jul 3, 2024
1 parent b770863 commit a96f7a7
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 23 deletions.
8 changes: 4 additions & 4 deletions core/config/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ function loadSerializedConfig(
// Set defaults if undefined (this lets us keep config.json uncluttered for new users)
config.contextProviders ??=
ideType === "vscode"
? defaultContextProvidersVsCode
: defaultContextProvidersJetBrains;
? [...defaultContextProvidersVsCode]
: [...defaultContextProvidersJetBrains];
config.slashCommands ??=
ideType === "vscode"
? defaultSlashCommandsVscode
: defaultSlashCommandsJetBrains;
? [...defaultSlashCommandsVscode]
: [...defaultSlashCommandsJetBrains];

return config;
}
Expand Down
10 changes: 5 additions & 5 deletions core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export class Core {
indexingState: IndexingProgressUpdate;
private globalContext = new GlobalContext();
private docsService = DocsService.getInstance();
private readonly indexingPauseToken = new PauseToken(
this.globalContext.get("indexingPaused") === true,
);

private abortedMessageIds: Set<string> = new Set();

Expand Down Expand Up @@ -79,9 +82,6 @@ export class Core {
);

// Codebase Indexer and ContinueServerClient depend on IdeSettings
const indexingPauseToken = new PauseToken(
this.globalContext.get("indexingPaused") === true,
);
let codebaseIndexerResolve: (_: any) => void | undefined;
this.codebaseIndexerPromise = new Promise(
async (resolve) => (codebaseIndexerResolve = resolve),
Expand All @@ -103,7 +103,7 @@ export class Core {
new CodebaseIndexer(
this.configHandler,
this.ide,
new PauseToken(false),
this.indexingPauseToken,
continueServerClient,
),
);
Expand Down Expand Up @@ -569,7 +569,7 @@ export class Core {
});
on("index/setPaused", (msg) => {
new GlobalContext().update("indexingPaused", msg.data);
indexingPauseToken.paused = msg.data;
this.indexingPauseToken.paused = msg.data;
});
on("index/indexingProgressBarInitialized", async (msg) => {
// Triggered when progress bar is initialized.
Expand Down
18 changes: 14 additions & 4 deletions core/indexing/LanceDbIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,20 @@ export class LanceDbIndex implements CodebaseIndex {
continue;
}

// Calculate embeddings
const embeddings = await this.embeddingsProvider.embed(
chunks.map((c) => c.content),
);
let embeddings: number[][];
try {
// Calculate embeddings
embeddings = await this.embeddingsProvider.embed(
chunks.map((c) => c.content),
);
} catch (e) {
// Rather than fail the entire indexing process, we'll just skip this file
// so that it may be picked up on the next indexing attempt
console.warn(
`Failed to generate embedding for ${chunks[0]?.filepath} with provider: ${this.embeddingsProvider.id}: ${e}`,
);
continue;
}

if (embeddings.some((emb) => emb === undefined)) {
throw new Error(
Expand Down
3 changes: 3 additions & 0 deletions core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class FreeTrialEmbeddingsProvider extends BaseEmbeddingsProvider {
return (
await Promise.all(
batchedChunks.map(async (batch) => {
if (batch.length === 0) {
return [];
}
const fetchWithBackoff = () =>
withExponentialBackoff<Response>(async () =>
this.fetch(new URL("embeddings", constants.a), {
Expand Down
4 changes: 4 additions & 0 deletions core/indexing/embeddings/OpenAIEmbeddingsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class OpenAIEmbeddingsProvider extends BaseEmbeddingsProvider {
return (
await Promise.all(
batchedChunks.map(async (batch) => {
if (batch.length === 0) {
return [];
}

const fetchWithBackoff = () =>
withExponentialBackoff<Response>(() =>
this.fetch(this._getEndpoint(), {
Expand Down
3 changes: 2 additions & 1 deletion core/indexing/indexCodebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ export class CodebaseIndexer {
progress =
(completedDirs +
(completedRelativeExpectedTime +
indexProgress * codebaseIndex.relativeExpectedTime) /
Math.min(1.0, indexProgress) *
codebaseIndex.relativeExpectedTime) /
totalRelativeExpectedTime) /
workspaceDirs.length;
yield {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To solve many problems, the first step is reading the logs to find the relevant
If you're getting a response from the LLM that doesn't seem to make sense, you can

1. Open the "Output" panel (right next to the terminal)
2. In the dropdown, select "Continue - LLM Prompts/Completions
2. In the dropdown, select "Continue - LLM Prompts/Completions"
3. View the exact prompts that were sent to the LLM and the completions recieved

### JetBrains
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "continue",
"icon": "media/icon.png",
"version": "0.9.169",
"version": "0.9.170",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/scripts/prepackage-cross-platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async function package(target, os, arch, exe) {
// Validate the all of the necessary files are present
validateFilesPresent([
// Queries used to create the index for @code context provider
"tree-sitter/code-snippet-queries/tree-sitter-c_sharp-tags.scm",
"tree-sitter/code-snippet-queries/c_sharp.scm",

// Queries used for @outline and @highlights context providers
"tag-qry/tree-sitter-c_sharp-tags.scm",
Expand Down
2 changes: 1 addition & 1 deletion gui/src/components/loaders/IndexingProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const IndexingProgressBar = ({
}}
></BlinkingDot>
<StatusHeading>
Click to resume indexing ({Math.trunc(indexingState.progress * 100)}
Indexing paused ({Math.trunc(indexingState.progress * 100)}
%)
</StatusHeading>
</FlexDiv>
Expand Down
39 changes: 34 additions & 5 deletions gui/src/pages/onboarding/Onboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
import {
CheckBadgeIcon,
GiftIcon,
Cog6ToothIcon,
ComputerDesktopIcon,
GiftIcon,
} from "@heroicons/react/24/outline";
import { ToCoreFromIdeOrWebviewProtocol } from "core/protocol/core";
import { useContext, useState } from "react";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import { lightGray } from "../../components";
import ConfirmationDialog from "../../components/dialogs/ConfirmationDialog";
import GitHubSignInButton from "../../components/modelSelection/quickSetup/GitHubSignInButton";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import {
setDialogMessage,
setShowDialog,
} from "../../redux/slices/uiStateSlice";
import { isJetBrains } from "../../util";
import { Div, StyledButton } from "./components";
import { FREE_TRIAL_LIMIT_REQUESTS, hasPassedFTL } from "../../util/freeTrial";
import { Div, StyledButton } from "./components";
import { useOnboarding } from "./utils";

type OnboardingMode =
ToCoreFromIdeOrWebviewProtocol["completeOnboarding"][0]["mode"];

function Onboarding() {
const navigate = useNavigate();
const dispatch = useDispatch();
const ideMessenger = useContext(IdeMessengerContext);

const [hasSignedIntoGh, setHasSignedIntoGh] = useState(false);
Expand Down Expand Up @@ -173,9 +181,30 @@ function Onboarding() {
</div>

<div className="flex justify-end">
<StyledButton disabled={!selectedOnboardingMode} onClick={onSubmit}>
Continue
</StyledButton>
<div className="flex items-center gap-4 ml-auto">
<div
className="cursor-pointer"
style={{ color: lightGray }}
onClick={(e) => {
dispatch(setShowDialog(true));
dispatch(
setDialogMessage(
<ConfirmationDialog
text="Are you sure you want to skip onboarding? Unless you are an existing user or already have a config.json we don't recommend this."
onConfirm={() => {
completeOnboarding();
}}
/>,
),
);
}}
>
Skip
</div>
<StyledButton disabled={!selectedOnboardingMode} onClick={onSubmit}>
Continue
</StyledButton>
</div>
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions gui/src/pages/onboarding/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type OnboardingStatus = "Started" | "Completed";
// If there is no value in local storage for "onboardingStatus",
// it implies that the user has not begun or completed onboarding.
export function shouldBeginOnboarding() {
// We used to use "onboardingComplete", but switched to "onboardingStatus"
const onboardingCompleteLegacyValue =
localStorage.getItem("onboardingComplete");
if (onboardingCompleteLegacyValue === "true") {
Expand Down

0 comments on commit a96f7a7

Please sign in to comment.