From 62fa541a246a214a05bf6528ea11cf3695777667 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:32:47 -0700 Subject: [PATCH] Dev (#1780) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Nate/control plane client (#1691) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * fix(gui): ctx rendering w/ renderInlineAs: "" (#1541) * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * fix codeqwen autocomplete leading space * add voyage rerank-1 * feat: `--noEmit` for tsc checks in CI (#1559) * docs: update CustomContextProvider docs (#1557) * add stop tokens to qwen prompt * update docs to reflect 3.5 sonnet being best * docs: comment out unused providers (#1561) * import Handlebars * feat: toast notification for config updates (#1560) * feat: toast notification for config updates * feat: only trigger toast on config.json save * displayRawMarkdown option * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * update to reflect 16 stop words limit for deepseek * feat: only trigger config update toast in vscode (#1571) * docs(prompt-files): fix typos + clarify (#1575) * doc: prompt file typo + clarifications * fix: add back correct docs * chore: add telemetry for pageviews (#1576) * 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 * docs(telemetry): add pageviews to tracking list (#1581) * Add reranker configuration options to codebase embedding docs (#1584) - Introduce reranker concept - List available reranker options - Provide configuration instructions - Update keywords to include "reranker" * chore: update pr template with screenshots (#1590) * Refactor ConfirmationDialog to use SecondaryButton for cancel action (#1586) * Added instructions for running docs server locally (#1578) - Added NPM script method - Added VS Code task method - Update contributing guidelines * Update branch policy (#1577) - Change PR target to `dev` branch - Update `CONTRIBUTING.md` instructions * Consolidate example configurations into the main configuration guide (#1579) - Moved examples to configuration.md - Deleted the separate examples.md file - Updated sidebar order and links - Improved readability and structure in configuration.md * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * Update completionProvider.ts (warning tab-autocomplete models) (#1566) * feat: enhanced IndexingProgressBar with blinking dot feature - Integrated BlinkingDot component - Added STATUS_COLORS for various states - Replaced CircleDiv with BlinkingDot in UI - Updated status messages and layout * small UI tweaks * feat(gui): enhance ModelCard, ModelProviderTag, and Toggle components (#1595) - add styling and adjustments to ModelCard - update ModelProviderTag font size - remove box shadow from Toggle component - tweak icon styles in ModelCard - improve alignment and spacing * media query * feat: add best experience onboarding * fix: file rename * stop movement on button hover by keeping same border thickness * fix mistake in setting cursor: pointer * fix when free trial option is shown * Support Node.js versions below 20 for streaming response handling (#1591) - Add fallback for Node < 20 - Implement toAsyncIterable for streaming - Use TextDecoder for manual decoding - Maintain existing streaming for Node 20+ * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * fix hasPassedFTL * fix /edit cancellation from UI * feat: add `applyCodeBlock` experimental prop (#1601) * feat: add new model styling improvements (#1609) * feat: add new model styling improvements * better gap size * feat: update bug_report.yml (#1610) * chore: update bug_report.yml * typo fix * feat: add labels to "Add docs" dialog (#1612) * feat: add labels to "Add docs" dialog * remove autofocus * don't double load config * small fixes * speed up directory traversal, and use correct native path module * option not to show config update toast * merge air-gapped and recommended setup pages * chore: add telemetry for full screen toggle (#1618) * Fix headings in codebase-embeddings.md (#1617) * mention jetbrains * docs: update changie (#1619) * feat: updated changie config * hide toc and autogenerate * Update changelog.mdx * link to deeper explanation of embeddings models * ensure target="_blank" for all links in sidebar * fix gif links in intellij README.md * don't require rust in dependency installation * chore: fix padding on gh button (#1620) * chore: adjust button padding * Update tasks.json * escape colons in diff path * smoother lancedb indexing reporting * smooth progress updates for indexing * fix tsc err * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * docs: add docs and schema for "OS" provider (#1536) * ignore .env * πŸš‘ fix constant warnings when onboarding with Ollama * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * team analytics * apply control plane settings * workos auth * ide protocol get session info * UI for auth * profile switching * small fixes * updates * refresh tokens * updates * fix tsc errs * model select in toolbar to make room for profile selector * prod client id * link to prod URL * internal beta option * profiles change listener --------- Co-authored-by: Patrick Erichsen Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu * temporary patch for type errs * Dev (#1689) * Fix an issue where CMD+K does not clear the terminal when the terminal has focus (#1671) On MacOS, ⌘+K is bound, by default, to Terminal:Clear. Without this change ⌘+K does not clear the terminal but instead iniates a chord sequence and waits for the next stroke of the chord. Co-authored-by: Rob Leidle * Change treeSitter to cache the Language objects it loads from wasm (#1672) Without this change, for a repository with 600 typescript files, the indexer would fail to finish correctly and there would be many of the following errors in the webview console log: 'Unable to load language for file ${path} RuntimeError: table index is out of bounds' The following bash will create a repo that reproduces the problem: current_path="." for ((i=1; i<=20; i++)); do new_folder="folder-$i" mkdir -p "$current_path/$new_folder" current_path="$current_path/$new_folder" for ((a=1; a<=30; a++)); do head -c 10000 /dev/urandom | base64 > "$current_path/file-$a.ts" done done Co-authored-by: Rob Leidle * acknowledge sourcemap flag in esbuild.js * don't run jetbrains-release.yaml on vscode releases * further testing for walkDir * chore: add telemetry to commands (#1673) * test: Add basic unit test to baseLLM (#1668) * update version * test: Add basic unit test to baseLLM --------- Co-authored-by: Nate Sesti Co-authored-by: inimaz * feat: add Quick Actions CodeLens feature (#1674) * 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: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * 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 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables * "stash" instead of "delete" in indexing progress * fix preview.yaml * also fix main.yaml * Update troubleshooting.md (#1637) * feat: add quick actions * Update index.d.ts * quick actions mvp * update docs * subscribe to vscode change settings * Update commands.ts * cleanup * Update quick-actions.md * Update VerticalPerLineCodeLensProvider.ts * resolve feedback --------- Co-authored-by: Nate Sesti Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner * chore: add `isCommandEvent` to command telemetry (#1675) * chore: add `isCommandEvent` to command telemetry * Update commands.ts * Nate/better retrieval (#1677) * deduplicatearray tests * break out separate retrieval pipelines * IConfigHandler * tests for codebase indexer * better .continueignore for continue * indexing fixes * ignore .gitignore and .continueignore when indexing * retrieval pipeline improvements * fix formatting err in out .continueignore * add necessary filter to lance_db_cache * update package.json version * skip unused tests * don't ignore .prompt files * update version * Update pull_request_template.md * don't use multi-media format when there are multiple text items * add free trial experience (#1685) * fix: add code range for quick actions/fixes (#1687) * fix: add code range for quick actions/fixes * Update test.js * add pathSep message type * docs improvements * jetbrains fix * update package.json version --------- Co-authored-by: Rob Leidle Co-authored-by: Rob Leidle Co-authored-by: Patrick Erichsen Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com> Co-authored-by: inimaz Co-authored-by: Jonah Wagner Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> * update package.json version * skip extension tests * update package.json version * handlebars import * don't push package.json version change from CI * fix: scroll issues w/ code blocks (#1688) * fix: scroll issues w/ code blocks * chore: name offset * chore: remove docs start * chore: update headings on troubleshooting.md (#1696) * ignore .svn folder for indexing (#1699) * chore: clearer naming for `useSuffix` (#1702) * chore: clearer naming for `useSuffix` * schema updates * fix: cmd+shft+l closes sidebar if focused (#1638) * 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: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * 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 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables * "stash" instead of "delete" in indexing progress * fix preview.yaml * also fix main.yaml * Update troubleshooting.md (#1637) * feat: close panel if main input is focused * add skip param * Update TipTapEditor.tsx * merge dev * Update commands.ts --------- Co-authored-by: Nate Sesti Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner * bugfix: quick actions undefined array (#1704) * feat: add rich quick pick for quick edit (#1706) * feat: multistep quick pick * fix: multi step for context provider * Update test.js * Create deepseek.md (#1708) * style: add max height to model selector (#1712) * update styling * remove testing code * remove comments * feat: add tutorial card (#1716) * feat: create tutorial card * Update TutorialCard.tsx * feat: add file search to quick edit (#1714) * feat: multistep quick pick * fix: multi step for context provider * Update test.js * add file search * complete file search * remove unused import * add comments * Update utils.ts * update naming * chore: move quick pick instantiation (#1723) * Break out into NPM modules (#1726) * config.json types * export all schemas * break out request logic into packages * update openai adapters to export body types * update packaging of npm modules * update packages * continue proxy * mistral * Fix typo in documentation (#1722) In set-up-codestral.md "Trobleshooting" -> "Troubleshooting" * update package.json version * πŸͺ„ model dropdown, control plane (#1692) * Nate/control plane client (#1691) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * fix(gui): ctx rendering w/ renderInlineAs: "" (#1541) * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * fix codeqwen autocomplete leading space * add voyage rerank-1 * feat: `--noEmit` for tsc checks in CI (#1559) * docs: update CustomContextProvider docs (#1557) * add stop tokens to qwen prompt * update docs to reflect 3.5 sonnet being best * docs: comment out unused providers (#1561) * import Handlebars * feat: toast notification for config updates (#1560) * feat: toast notification for config updates * feat: only trigger toast on config.json save * displayRawMarkdown option * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * update to reflect 16 stop words limit for deepseek * feat: only trigger config update toast in vscode (#1571) * docs(prompt-files): fix typos + clarify (#1575) * doc: prompt file typo + clarifications * fix: add back correct docs * chore: add telemetry for pageviews (#1576) * 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 * docs(telemetry): add pageviews to tracking list (#1581) * Add reranker configuration options to codebase embedding docs (#1584) - Introduce reranker concept - List available reranker options - Provide configuration instructions - Update keywords to include "reranker" * chore: update pr template with screenshots (#1590) * Refactor ConfirmationDialog to use SecondaryButton for cancel action (#1586) * Added instructions for running docs server locally (#1578) - Added NPM script method - Added VS Code task method - Update contributing guidelines * Update branch policy (#1577) - Change PR target to `dev` branch - Update `CONTRIBUTING.md` instructions * Consolidate example configurations into the main configuration guide (#1579) - Moved examples to configuration.md - Deleted the separate examples.md file - Updated sidebar order and links - Improved readability and structure in configuration.md * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * Update completionProvider.ts (warning tab-autocomplete models) (#1566) * feat: enhanced IndexingProgressBar with blinking dot feature - Integrated BlinkingDot component - Added STATUS_COLORS for various states - Replaced CircleDiv with BlinkingDot in UI - Updated status messages and layout * small UI tweaks * feat(gui): enhance ModelCard, ModelProviderTag, and Toggle components (#1595) - add styling and adjustments to ModelCard - update ModelProviderTag font size - remove box shadow from Toggle component - tweak icon styles in ModelCard - improve alignment and spacing * media query * feat: add best experience onboarding * fix: file rename * stop movement on button hover by keeping same border thickness * fix mistake in setting cursor: pointer * fix when free trial option is shown * Support Node.js versions below 20 for streaming response handling (#1591) - Add fallback for Node < 20 - Implement toAsyncIterable for streaming - Use TextDecoder for manual decoding - Maintain existing streaming for Node 20+ * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * fix hasPassedFTL * fix /edit cancellation from UI * feat: add `applyCodeBlock` experimental prop (#1601) * feat: add new model styling improvements (#1609) * feat: add new model styling improvements * better gap size * feat: update bug_report.yml (#1610) * chore: update bug_report.yml * typo fix * feat: add labels to "Add docs" dialog (#1612) * feat: add labels to "Add docs" dialog * remove autofocus * don't double load config * small fixes * speed up directory traversal, and use correct native path module * option not to show config update toast * merge air-gapped and recommended setup pages * chore: add telemetry for full screen toggle (#1618) * Fix headings in codebase-embeddings.md (#1617) * mention jetbrains * docs: update changie (#1619) * feat: updated changie config * hide toc and autogenerate * Update changelog.mdx * link to deeper explanation of embeddings models * ensure target="_blank" for all links in sidebar * fix gif links in intellij README.md * don't require rust in dependency installation * chore: fix padding on gh button (#1620) * chore: adjust button padding * Update tasks.json * escape colons in diff path * smoother lancedb indexing reporting * smooth progress updates for indexing * fix tsc err * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * docs: add docs and schema for "OS" provider (#1536) * ignore .env * πŸš‘ fix constant warnings when onboarding with Ollama * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * team analytics * apply control plane settings * workos auth * ide protocol get session info * UI for auth * profile switching * small fixes * updates * refresh tokens * updates * fix tsc errs * model select in toolbar to make room for profile selector * prod client id * link to prod URL * internal beta option * profiles change listener --------- Co-authored-by: Patrick Erichsen Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu * temporary patch for type errs --------- Co-authored-by: Patrick Erichsen Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu * skip extension tests * JetBrains status bar spinner for autocomplete * Remove unused images * partial accept jetbrains * fix double-rendering of jetbrains completions * fix offset of multi-line jetbrains completions * enable/disable actions * upgrade to version 0.0.54 * fix: wrap editor buttons when out of space (#1727) * Add .continuerc file to config directory on activation to prevent it's indexing. (#1733) * Updated the content links that were deprecated in the document (#1709) Co-authored-by: Ihe Fan * Nate/dev (#1739) * JetBrains status bar spinner for autocomplete * Remove unused images * partial accept jetbrains * fix double-rendering of jetbrains completions * fix offset of multi-line jetbrains completions * enable/disable actions * upgrade to version 0.0.54 * llm-info package * small profile switching improvements * instruct cmd+I not to leave placeholders * @ files in context-providers docs * onboarding fix * update jetbrains ci to build gui * feat: single default quick pick to edit (#1743) * feat: single default quick pick to edit * Update quick-actions.md * Update quick-actions.md * use defaultQuickAction * quick fixes * fix: handle line removal diff (#1744) * fix: handle line removal diff * remove comments * Configurable `maxChunkSize` for embedding providers (#1746) * Add `maxChunkSize` to `EmbeddingsProvider` * Add `maxChunkSize` to schema * add support for docs via config (#1594) * mistral mamba (#1748) * 🐍 mistral mamba * autoscale retrieval based on context length * autoscale retrieval based on context length * fix input box movement * update jetbrains build * test: add myers diff tests (#1754) * feat: enhance help center (#1755) * feat: enhance help center * Update help.tsx * feat: add azure provider config (#1764) * autocomplete reload fix * logout of control plane * Update QuickEditQuickPick.ts (#1772) * Update QuickEditQuickPick.ts * updates * Update QuickEditQuickPick.ts * pass refreshed access token to continue-proxy model * test: add dir read check for walkDir (#1773) * test: add dir read check for walkDir * Update ignore.ts * Update walkDir.test.ts * Update walkDir.test.ts * gpt-4o-mini * gpt-4o-mini * gpt4omini to ui selector * fix: layout alignment (#1779) * fix: delete old docs index on force re-index (#1778) * add "Codebase Force Re-Index" command (#1757) * Add `HuggingFaceTEIReranker` (#1711) * Add `HuggingFaceTEIReranker` * Add `huggingface-tei` to `config_schema.json` * update package.json version * update config schemas --------- Co-authored-by: Patrick Erichsen Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu Co-authored-by: Rob Leidle Co-authored-by: Rob Leidle Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com> Co-authored-by: inimaz Co-authored-by: AnaΓ«l Bonnafous <71386173+AnaelBonnafous@users.noreply.github.com> Co-authored-by: Huy Tran <119860259+tranquochuy645@users.noreply.github.com> Co-authored-by: Gabriel Gordbegli Co-authored-by: Raven-1027 <83693755+Raven-1027@users.noreply.github.com> Co-authored-by: Ihe Fan Co-authored-by: Lukas Kreussel <65088241+LLukas22@users.noreply.github.com> --- core/config/types.ts | 1 + core/context/rerankers/index.ts | 2 + core/context/rerankers/tei.ts | 49 ++++ core/diff/streamDiff.ts | 26 ++- core/diff/util.ts | 2 + core/index.d.ts | 7 +- core/indexing/docs/DocsService.ts | 18 +- core/indexing/ignore.ts | 1 + core/indexing/walkDir.ts | 9 +- core/llm/autodetect.ts | 1 + core/llm/constants.ts | 1 + core/llm/llms/Azure.ts | 8 + core/llm/llms/OpenAI.ts | 1 + core/llm/llms/index.ts | 2 + core/llm/llms/stubs/ContinueProxy.ts | 1 + core/package-lock.json | 10 + core/package.json | 1 + core/protocol/ide.ts | 1 + core/test/streamDiff.test.ts | 212 +++++++++-------- core/test/walkDir.test.ts | 33 ++- core/util/filesystem.ts | 4 +- docs/docs/walkthroughs/codebase-embeddings.md | 19 +- docs/static/schemas/config.json | 49 +++- eval/repos/amplified-dev | 1 + eval/repos/continue | 1 + eval/repos/the-x | 1 + eval/repos/trayracer | 1 + .../src/main/resources/config_schema.json | 49 +++- extensions/vscode/config_schema.json | 49 +++- extensions/vscode/continue_rc_schema.json | 61 ++++- extensions/vscode/package-lock.json | 5 +- extensions/vscode/package.json | 8 +- extensions/vscode/src/activation/activate.ts | 10 +- extensions/vscode/src/commands.ts | 35 +-- .../vscode/src/extension/VsCodeExtension.ts | 21 +- .../vscode/src/extension/VsCodeMessenger.ts | 12 +- .../src/quickEdit/QuickEditQuickPick.ts | 46 ++-- gui/package-lock.json | 1 + gui/src/components/Layout.tsx | 14 +- gui/src/components/ProfileSwitcher.tsx | 5 +- gui/src/components/loaders/BlinkingDot.tsx | 34 --- gui/src/components/loaders/StatusDot.tsx | 2 +- gui/src/components/mainInput/InputToolbar.tsx | 4 +- .../components/modelSelection/ModelSelect.tsx | 11 +- gui/src/hooks/useAuth.tsx | 9 +- gui/src/pages/AddNewModel/configs/models.ts | 15 ++ .../pages/AddNewModel/configs/providers.ts | 1 + gui/src/pages/gui.tsx | 6 +- gui/src/pages/help.tsx | 215 ++++++++---------- gui/src/pages/stats.tsx | 2 +- packages/llm-info/src/models/openai.ts | 15 +- 51 files changed, 736 insertions(+), 356 deletions(-) create mode 100644 core/context/rerankers/tei.ts create mode 100644 core/llm/llms/Azure.ts create mode 160000 eval/repos/amplified-dev create mode 160000 eval/repos/continue create mode 160000 eval/repos/the-x create mode 160000 eval/repos/trayracer delete mode 100644 gui/src/components/loaders/BlinkingDot.tsx diff --git a/core/config/types.ts b/core/config/types.ts index 00af67836..d950c15f7 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -523,6 +523,7 @@ declare global { | "gpt-4-32k" | "gpt-4-turbo" | "gpt-4o" + | "gpt-4o-mini" | "gpt-4-turbo-preview" | "gpt-4-vision-preview" // Mistral diff --git a/core/context/rerankers/index.ts b/core/context/rerankers/index.ts index 0a7cc685a..af3f91556 100644 --- a/core/context/rerankers/index.ts +++ b/core/context/rerankers/index.ts @@ -3,10 +3,12 @@ import { CohereReranker } from "./cohere.js"; import { FreeTrialReranker } from "./freeTrial.js"; import { LLMReranker } from "./llm.js"; import { VoyageReranker } from "./voyage.js"; +import {HuggingFaceTEIReranker} from "./tei.js" export const AllRerankers: { [key in RerankerName]: any } = { cohere: CohereReranker, llm: LLMReranker, voyage: VoyageReranker, "free-trial": FreeTrialReranker, + "huggingface-tei": HuggingFaceTEIReranker }; diff --git a/core/context/rerankers/tei.ts b/core/context/rerankers/tei.ts new file mode 100644 index 000000000..667181ae3 --- /dev/null +++ b/core/context/rerankers/tei.ts @@ -0,0 +1,49 @@ +import fetch from "node-fetch"; +import { Chunk, Reranker } from "../../index.js"; + +export class HuggingFaceTEIReranker implements Reranker { + name = "huggingface-tei"; + + static defaultOptions = { + apiBase: "http://localhost:8080", + truncate: true, + truncation_direction: "Right" + }; + + constructor( + private readonly params: { + apiBase?: string; + truncate?: boolean; + truncation_direction?: string; + }, + ) {} + + async rerank(query: string, chunks: Chunk[]): Promise { + let apiBase = this.params.apiBase ?? HuggingFaceTEIReranker.defaultOptions.apiBase; + if (!apiBase.endsWith("/")) { + apiBase += "/"; + } + + const resp = await fetch(new URL("rerank", apiBase), { + method: "POST", + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + query: query, + return_text: false, + raw_scores: false, + texts: chunks.map((chunk) => chunk.content), + truncation_direction: this.params.truncation_direction ?? HuggingFaceTEIReranker.defaultOptions.truncation_direction, + truncate: this.params.truncate ?? HuggingFaceTEIReranker.defaultOptions.truncate + }), + }); + + if (!resp.ok) { + throw new Error(await resp.text()); + } + + const data = (await resp.json()) as any; + // Resort into original order and extract scores + const results = data.sort((a: any, b: any) => a.index - b.index); + return results.map((result: any) => result.score); + } +} diff --git a/core/diff/streamDiff.ts b/core/diff/streamDiff.ts index 62173eb93..42c8409b9 100644 --- a/core/diff/streamDiff.ts +++ b/core/diff/streamDiff.ts @@ -1,11 +1,11 @@ -import { DiffLine } from "../index.js"; +import { DiffLine, DiffLineType } from "../index.js"; import { LineStream, matchLine } from "./util.js"; /** * https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/ * Invariants: * - new + same = newLines.length - * - old + same = oldLines.length + * - old + same = oldLinesCopy.length * ^ (above two guarantee that all lines get represented) * - Lines are always output in order, at least among old and new separately */ @@ -13,15 +13,17 @@ export async function* streamDiff( oldLines: string[], newLines: LineStream, ): AsyncGenerator { + const oldLinesCopy = [...oldLines]; + // If one indentation mistake is made, others are likely. So we are more permissive about matching let seenIndentationMistake = false; let newLineResult = await newLines.next(); - while (oldLines.length > 0 && !newLineResult.done) { + while (oldLinesCopy.length > 0 && !newLineResult.done) { const { matchIndex, isPerfectMatch, newLine } = matchLine( newLineResult.value, - oldLines, + oldLinesCopy, seenIndentationMistake, ); @@ -29,7 +31,7 @@ export async function* streamDiff( seenIndentationMistake = true; } - let type: DiffLine["type"]; + let type: DiffLineType; let isLineRemoval = false; const isNewLine = matchIndex === -1; @@ -39,7 +41,7 @@ export async function* streamDiff( } else { // Insert all deleted lines before match for (let i = 0; i < matchIndex; i++) { - yield { type: "old", line: oldLines.shift()! }; + yield { type: "old", line: oldLinesCopy.shift()! }; } type = isPerfectMatch ? "same" : "old"; @@ -51,13 +53,13 @@ export async function* streamDiff( break; case "same": - yield { type, line: oldLines.shift()! }; + yield { type, line: oldLinesCopy.shift()! }; break; case "old": - yield { type, line: oldLines.shift()! }; + yield { type, line: oldLinesCopy.shift()! }; - if (oldLines[0] !== newLine) { + if (oldLinesCopy[0] !== newLine) { yield { type: "new", line: newLine }; } else { isLineRemoval = true; @@ -75,13 +77,13 @@ export async function* streamDiff( } // Once at the edge, only one choice - if (newLineResult.done && oldLines.length > 0) { - for (const oldLine of oldLines) { + if (newLineResult.done && oldLinesCopy.length > 0) { + for (const oldLine of oldLinesCopy) { yield { type: "old", line: oldLine }; } } - if (!newLineResult.done && oldLines.length === 0) { + if (!newLineResult.done && oldLinesCopy.length === 0) { yield { type: "new", line: newLineResult.value }; for await (const newLine of newLines) { yield { type: "new", line: newLine }; diff --git a/core/diff/util.ts b/core/diff/util.ts index 8583838d4..69b4e160e 100644 --- a/core/diff/util.ts +++ b/core/diff/util.ts @@ -38,6 +38,8 @@ function linesMatch(lineA: string, lineB: string, linesBetween = 0): boolean { } /** + * Used to find a match for a new line in an array of old lines. + * * Return the index of the first match and whether it is a perfect match * Also return a version of the line with correct indentation if needs fixing */ diff --git a/core/index.d.ts b/core/index.d.ts index f56ba46ac..55969eed8 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -374,8 +374,10 @@ export type CustomLLM = RequireAtLeastOne< // IDE +export type DiffLineType = "new" | "old" | "same"; + export interface DiffLine { - type: "new" | "old" | "same"; + type: DiffLineType; line: string; } @@ -596,6 +598,7 @@ export type ModelName = | "gpt-3.5-turbo-0613" | "gpt-4-32k" | "gpt-4o" + | "gpt-4o-mini" | "gpt-4-turbo" | "gpt-4-turbo-preview" | "gpt-4-vision-preview" @@ -756,7 +759,7 @@ export interface EmbeddingsProvider { embed(chunks: string[]): Promise; } -export type RerankerName = "cohere" | "voyage" | "llm" | "free-trial"; +export type RerankerName = "cohere" | "voyage" | "llm" | "free-trial" | "huggingface-tei"; export interface RerankerDescription { name: RerankerName; diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 9cd8feb5f..bbec8cc65 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -214,7 +214,7 @@ export class DocsService { return; } - if (!reIndex && await this.has(startUrl.toString())) { + if (!reIndex && (await this.has(startUrl.toString()))) { yield { progress: 1, desc: "Already indexed", @@ -275,11 +275,13 @@ export class DocsService { try { const subpathEmbeddings = await embeddingsProvider.embed( - chunkArticle(article, embeddingsProvider.maxChunkSize).map((chunk) => { - chunks.push(chunk); + chunkArticle(article, embeddingsProvider.maxChunkSize).map( + (chunk) => { + chunks.push(chunk); - return chunk.content; - }), + return chunk.content; + }, + ), ); embeddings.push(...subpathEmbeddings); @@ -296,6 +298,12 @@ export class DocsService { status: "indexing", }; + // Clear old index if re-indexing. + if (reIndex) { + console.log("Deleting old embeddings"); + await this.delete(startUrl.toString()); + } + await this.add(siteIndexingConfig.title, startUrl, chunks, embeddings); this.docsIndexingQueue.delete(startUrl.toString()); diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index 07e6d873f..35fd84aa1 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -64,6 +64,7 @@ export const DEFAULT_IGNORE_FILETYPES = [ ".gitkeep", ".continueignore", "config.json", + ".csv", // "*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt ]; export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES); diff --git a/core/indexing/walkDir.ts b/core/indexing/walkDir.ts index 98636b857..7a3c2573e 100644 --- a/core/indexing/walkDir.ts +++ b/core/indexing/walkDir.ts @@ -1,8 +1,8 @@ import { EventEmitter } from "events"; import { Minimatch } from "minimatch"; import path from "node:path"; -import { FileType, IDE } from ".."; -import { DEFAULT_IGNORE_DIRS, DEFAULT_IGNORE_FILETYPES } from "./ignore"; +import { FileType, IDE } from "../index.js"; +import { DEFAULT_IGNORE_DIRS, DEFAULT_IGNORE_FILETYPES } from "./ignore.js"; export interface WalkerOptions { isSymbolicLink?: boolean; @@ -34,10 +34,7 @@ class Walker extends EventEmitter { sawError: boolean; exact: boolean | undefined; onlyDirs: boolean | undefined; - constructor( - opts: WalkerOptions = {}, - protected readonly ide: IDE, - ) { + constructor(opts: WalkerOptions = {}, protected readonly ide: IDE) { super(opts as any); this.isSymbolicLink = opts.isSymbolicLink || false; this.path = opts.path || process.cwd(); diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 6f09839c2..32ef68a3a 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -61,6 +61,7 @@ const MODEL_SUPPORTS_IMAGES: string[] = [ "llava", "gpt-4-turbo", "gpt-4o", + "gpt-4o-mini", "gpt-4-vision", "claude-3", "gemini-ultra", diff --git a/core/llm/constants.ts b/core/llm/constants.ts index 0d63c6f6a..a31dbbe3d 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -20,6 +20,7 @@ const CONTEXT_LENGTH_FOR_MODEL: { [name: string]: number } = { "gpt-4-32k": GPT_4_CTX_LEN, "gpt-4-turbo-preview": GPT_4_CTX_LEN, "gpt-4o": GPT_4_CTX_LEN, + "gpt-4o-mini": GPT_4_CTX_LEN, "gpt-4-vision": GPT_4_CTX_LEN, "gpt-4-0125-preview": GPT_4_CTX_LEN, "gpt-4-1106-preview": GPT_4_CTX_LEN, diff --git a/core/llm/llms/Azure.ts b/core/llm/llms/Azure.ts new file mode 100644 index 000000000..ce20b4ecc --- /dev/null +++ b/core/llm/llms/Azure.ts @@ -0,0 +1,8 @@ +import { ModelProvider } from "../../index.js"; +import OpenAI from "./OpenAI.js"; + +class Azure extends OpenAI { + static providerName: ModelProvider = "azure"; +} + +export default Azure; diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index 470f5184b..71f463ac3 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -36,6 +36,7 @@ const CHAT_ONLY_MODELS = [ "gpt-4-vision", "gpt-4-0125-preview", "gpt-4-1106-preview", + "gpt-4o-mini", ]; class OpenAI extends BaseLLM { diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index a245f025c..20f77c850 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -27,6 +27,7 @@ import LlamaCpp from "./LlamaCpp.js"; import Llamafile from "./Llamafile.js"; import Mistral from "./Mistral.js"; import Msty from "./Msty.js"; +import Azure from "./Azure.js"; import Ollama from "./Ollama.js"; import OpenAI from "./OpenAI.js"; import Replicate from "./Replicate.js"; @@ -124,6 +125,7 @@ const LLMs = [ Cloudflare, Deepseek, Msty, + Azure, ]; export async function llmFromDescription( diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 7c085bf75..850ac7410 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -18,6 +18,7 @@ class ContinueProxy extends OpenAI { static defaultOptions: Partial = { apiBase: "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/model-proxy/v1", + useLegacyCompletionsEndpoint: false, }; supportsFim(): boolean { diff --git a/core/package-lock.json b/core/package-lock.json index cc2167bf1..e52c1435e 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -74,6 +74,7 @@ "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", "ts-jest": "^29.1.1" @@ -11218,6 +11219,15 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/myers-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/myers-diff/-/myers-diff-2.1.0.tgz", + "integrity": "sha512-6s/caiGUb5vNH9kq5HPw9t9OzAq6hTJ5V5N5Damd/npcp+stLg2LxQIcgJa9o51qbfTVgfth6/yVCoJvZY85BQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/mysql2": { "version": "3.9.7", "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.7.tgz", diff --git a/core/package.json b/core/package.json index cfd12929f..16c88a868 100644 --- a/core/package.json +++ b/core/package.json @@ -24,6 +24,7 @@ "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", "ts-jest": "^29.1.1" diff --git a/core/protocol/ide.ts b/core/protocol/ide.ts index 400906af5..13988a0d1 100644 --- a/core/protocol/ide.ts +++ b/core/protocol/ide.ts @@ -80,6 +80,7 @@ export type ToIdeFromWebviewOrCoreProtocol = { { silent: boolean }, ControlPlaneSessionInfo | undefined, ]; + logoutOfControlPlane: [undefined, void]; pathSep: [undefined, string]; }; diff --git a/core/test/streamDiff.test.ts b/core/test/streamDiff.test.ts index b539ec5ee..72be00746 100644 --- a/core/test/streamDiff.test.ts +++ b/core/test/streamDiff.test.ts @@ -1,5 +1,10 @@ import { streamDiff } from "../diff/streamDiff.js"; -import { DiffLine } from "../index.js"; +import { DiffLine, DiffLineType } from "../index.js"; +// @ts-ignore no typings available +import { changed, diff as myersDiff } from "myers-diff"; + +// "modification" is an extra type used to represent an "old" + "new" diff line +type MyersDiffTypes = Extract | "modification"; async function* generateLines(lines: string[]): AsyncGenerator { for (const line of lines) { @@ -7,158 +12,169 @@ async function* generateLines(lines: string[]): AsyncGenerator { } } -const collectDiff = async ( +async function collectDiffs( oldLines: string[], newLines: string[], -): Promise => { - const result: DiffLine[] = []; +): Promise<{ streamDiffs: DiffLine[]; myersDiffs: any }> { + const streamDiffs: DiffLine[] = []; for await (const diffLine of streamDiff(oldLines, generateLines(newLines))) { - result.push(diffLine); + streamDiffs.push(diffLine); } - return result; -}; + const myersDiffs = myersDiff(oldLines.join("\n"), newLines.join("\n")); -// We use a longer `console.log()` string here to not get + return { streamDiffs, myersDiffs }; +} + +function getMyersDiffType(diff: any): MyersDiffTypes | undefined { + if (changed(diff.rhs) && !changed(diff.lhs)) { + return "new"; + } + + if (!changed(diff.rhs) && changed(diff.lhs)) { + return "old"; + } + + if (changed(diff.rhs) && changed(diff.lhs)) { + return "modification"; + } + + return undefined; +} + +// We use a longer `)` string here to not get // caught by the fuzzy matcher -describe("streamDiff()", () => { +describe("streamDiff(", () => { test("no changes", async () => { - const oldLines = [ - "console.log(first)", - "console.log(second)", - "console.log(third)", - ]; - const newLines = [ - "console.log(first)", - "console.log(second)", - "console.log(third)", - ]; + const oldLines = ["first item", "second arg", "third param"]; + const newLines = ["first item", "second arg", "third param"]; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "same", line: "console.log(first)" }, - { type: "same", line: "console.log(second)" }, - { type: "same", line: "console.log(third)" }, + expect(streamDiffs).toEqual([ + { type: "same", line: "first item" }, + { type: "same", line: "second arg" }, + { type: "same", line: "third param" }, ]); + + expect(myersDiffs).toEqual([]); }); test("add new line", async () => { - const oldLines = ["console.log(first)", "console.log(second)"]; - const newLines = [ - "console.log(first)", - "console.log(second)", - "console.log(third)", - ]; + const oldLines = ["first item", "second arg"]; + const newLines = ["first item", "second arg", "third param"]; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "same", line: "console.log(first)" }, - { type: "same", line: "console.log(second)" }, - { type: "new", line: "console.log(third)" }, + expect(streamDiffs).toEqual([ + { type: "same", line: "first item" }, + { type: "same", line: "second arg" }, + { type: "new", line: "third param" }, ]); + + expect(myersDiffs.length).toEqual(1); + expect(getMyersDiffType(myersDiffs[0])).toBe("new"); }); test("remove line", async () => { - const oldLines = [ - "console.log(first)", - "console.log(second)", - "console.log(third)", - ]; - const newLines = ["console.log(first)", "console.log(third)"]; + const oldLines = ["first item", "second arg", "third param"]; + const newLines = ["first item", "third param"]; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "same", line: "console.log(first)" }, - { type: "old", line: "console.log(second)" }, - { type: "same", line: "console.log(third)" }, + expect(streamDiffs).toEqual([ + { type: "same", line: "first item" }, + { type: "old", line: "second arg" }, + { type: "same", line: "third param" }, ]); + + expect(myersDiffs.length).toEqual(1); + expect(getMyersDiffType(myersDiffs[0])).toBe("old"); }); test("modify line", async () => { - const oldLines = [ - "console.log(first)", - "console.log(second)", - "console.log(third)", - ]; - const newLines = [ - "console.log(first)", - "console.log(modified second)", - "console.log(third)", - ]; + const oldLines = ["first item", "second arg", "third param"]; + const newLines = ["first item", "modified second arg", "third param"]; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "same", line: "console.log(first)" }, - { type: "old", line: "console.log(second)" }, - { type: "new", line: "console.log(modified second)" }, - { type: "same", line: "console.log(third)" }, + expect(streamDiffs).toEqual([ + { type: "same", line: "first item" }, + { type: "old", line: "second arg" }, + { type: "new", line: "modified second arg" }, + { type: "same", line: "third param" }, ]); + + expect(myersDiffs.length).toEqual(1); + expect(getMyersDiffType(myersDiffs[0])).toBe("modification"); }); test("add multiple lines", async () => { - const oldLines = ["console.log(first)", "fourth"]; - const newLines = [ - "console.log(first)", - "console.log(second)", - "console.log(third)", - "fourth", - ]; + const oldLines = ["first item", "fourth val"]; + const newLines = ["first item", "second arg", "third param", "fourth val"]; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "same", line: "console.log(first)" }, - { type: "new", line: "console.log(second)" }, - { type: "new", line: "console.log(third)" }, - { type: "same", line: "fourth" }, + expect(streamDiffs).toEqual([ + { type: "same", line: "first item" }, + { type: "new", line: "second arg" }, + { type: "new", line: "third param" }, + { type: "same", line: "fourth val" }, ]); + + // Multi-line addition + expect(myersDiffs[0].rhs.add).toEqual(2); + expect(getMyersDiffType(myersDiffs[0])).toBe("new"); }); test("remove multiple lines", async () => { - const oldLines = [ - "console.log(first)", - "console.log(second)", - "console.log(third)", - "fourth", - ]; - const newLines = ["console.log(first)", "fourth"]; + const oldLines = ["first item", "second arg", "third param", "fourth val"]; + const newLines = ["first item", "fourth val"]; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "same", line: "console.log(first)" }, - { type: "old", line: "console.log(second)" }, - { type: "old", line: "console.log(third)" }, - { type: "same", line: "fourth" }, + expect(streamDiffs).toEqual([ + { type: "same", line: "first item" }, + { type: "old", line: "second arg" }, + { type: "old", line: "third param" }, + { type: "same", line: "fourth val" }, ]); + + // Multi-line deletion + expect(myersDiffs[0].lhs.del).toEqual(2); + expect(getMyersDiffType(myersDiffs[0])).toBe("old"); }); test("empty old lines", async () => { const oldLines: string[] = []; - const newLines = ["console.log(first)", "console.log(second)"]; + const newLines = ["first item", "second arg"]; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "new", line: "console.log(first)" }, - { type: "new", line: "console.log(second)" }, + expect(streamDiffs).toEqual([ + { type: "new", line: "first item" }, + { type: "new", line: "second arg" }, ]); + + // Multi-line addition + expect(myersDiffs[0].rhs.add).toEqual(2); + expect(getMyersDiffType(myersDiffs[0])).toBe("new"); }); test("empty new lines", async () => { - const oldLines = ["console.log(first)", "console.log(second)"]; + const oldLines = ["first item", "second arg"]; const newLines: string[] = []; - const diff = await collectDiff(oldLines, newLines); + const { streamDiffs, myersDiffs } = await collectDiffs(oldLines, newLines); - expect(diff).toEqual([ - { type: "old", line: "console.log(first)" }, - { type: "old", line: "console.log(second)" }, + expect(streamDiffs).toEqual([ + { type: "old", line: "first item" }, + { type: "old", line: "second arg" }, ]); + + // Multi-line deletion + expect(myersDiffs[0].lhs.del).toEqual(2); + expect(getMyersDiffType(myersDiffs[0])).toBe("old"); }); }); diff --git a/core/test/walkDir.test.ts b/core/test/walkDir.test.ts index 5ed3851f0..0f9ad602f 100644 --- a/core/test/walkDir.test.ts +++ b/core/test/walkDir.test.ts @@ -1,12 +1,13 @@ import path from "path"; -import { walkDir, WalkerOptions } from "../indexing/walkDir"; -import FileSystemIde from "../util/filesystem"; +import { walkDir, WalkerOptions } from "../indexing/walkDir.js"; +import FileSystemIde from "../util/filesystem.js"; import { addToTestDir, setUpTestDir, tearDownTestDir, TEST_DIR, -} from "./testUtils/testDir"; +} from "./testUtils/testDir.js"; + const ide = new FileSystemIde(TEST_DIR); async function walkTestDir( @@ -273,4 +274,30 @@ describe("walkDir", () => { ); expect(results.some((file) => file.includes(".tmLanguage"))).toBe(false); }); + + test("should perform the same number of dir reads as 1 + the number of dirs that contain files", async () => { + const files = [ + "a.txt", + "b.py", + "c.ts", + "d/", + "d/e.txt", + "d/f.py", + "d/g/", + "d/g/h.ts", + "d/g/i/", + "d/g/i/j.ts", + ]; + + const numDirs = files.filter((file) => !file.includes(".")).length; + const numDirsPlusTopLevelRead = numDirs + 1; + + addToTestDir(files); + + const mockListDir = jest.spyOn(ide, "listDir"); + + await walkTestDir(); + + expect(mockListDir).toHaveBeenCalledTimes(numDirsPlusTopLevelRead); + }); }); diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index dd8e152a9..7b849cb33 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -61,8 +61,8 @@ class FileSystemIde implements IDE { dirent.isDirectory() ? (2 as FileType.Directory) : dirent.isSymbolicLink() - ? (64 as FileType.SymbolicLink) - : (1 as FileType.File), + ? (64 as FileType.SymbolicLink) + : (1 as FileType.File), ]); return Promise.resolve(all); } diff --git a/docs/docs/walkthroughs/codebase-embeddings.md b/docs/docs/walkthroughs/codebase-embeddings.md index 8b2764c1c..21945734b 100644 --- a/docs/docs/walkthroughs/codebase-embeddings.md +++ b/docs/docs/walkthroughs/codebase-embeddings.md @@ -231,7 +231,7 @@ export function modifyConfig(config: Config): Config { The reranker plays a crucial role in refining the results retrieved from your codebase. It processes the initial set of results obtained through embeddings-based retrieval, improving their relevance and accuracy for your queries. -Continue offers several reranking options: `cohere`, `voyage`, `llm`, and `free-trial`, which can be configured in `config.json`. +Continue offers several reranking options: `cohere`, `voyage`, `llm`, `hugginface-tei`, and `free-trial`, which can be configured in `config.json`. ### Voyage AI @@ -282,6 +282,23 @@ If you only have access to a single LLM, then you can use it as a reranker. This The `"modelTitle"` field must match one of the models in your "models" array in config.json. +### Text Embeddings Inference + +[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own [reranker endpoint](https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/rerank). You can configure your reranker as follows: + +```json title="~/.continue/config.json" +{ + "reranker": { + "name": "huggingface-tei", + "params": { + "apiBase": "http://localhost:8080", + "truncate": true, + "truncation_direction": "Right" + } + }, +} +``` + ### Free Trial (Voyage AI) Continue offers a free trial of Voyage AI's reranking model. diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index a93e891ae..19813eb6a 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -481,6 +481,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -581,6 +582,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -1095,6 +1097,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -1952,7 +1955,7 @@ "type": "object", "properties": { "name": { - "enum": ["cohere", "voyage", "llm", "free-trial"] + "enum": ["cohere", "voyage", "llm", "free-trial", "huggingface-tei"] }, "params": { "type": "object" @@ -2042,6 +2045,50 @@ } } } + }, + { + "if": { + "properties": { + "name": { + "enum": ["huggingface-tei"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiBase": { + "type": "string", + "default": "http://localhost:8080" + }, + "truncate": { + "type": "boolean", + "description": "Wether to truncate long sequences to the maximum allowed context length.", + "default": false + }, + "truncation_direction": { + "enum": ["Right","Left"], + "markdownDescription": "Wether to truncate sequences from the `left` or `right`.", + "default": "Right" + } + }, + "required": ["apiBase"] + } + }, + "if": { + "properties": { + "truncate": { + "const": true + } + } + }, + "then": { + "required": ["truncation_direction"] + } + } } ] }, diff --git a/eval/repos/amplified-dev b/eval/repos/amplified-dev new file mode 160000 index 000000000..4cf94d702 --- /dev/null +++ b/eval/repos/amplified-dev @@ -0,0 +1 @@ +Subproject commit 4cf94d7023f5063f912d376027194fbd67670ba5 diff --git a/eval/repos/continue b/eval/repos/continue new file mode 160000 index 000000000..2eafdff54 --- /dev/null +++ b/eval/repos/continue @@ -0,0 +1 @@ +Subproject commit 2eafdff54b1a77c6d403fa26a64c6793d7a4dfb9 diff --git a/eval/repos/the-x b/eval/repos/the-x new file mode 160000 index 000000000..9218fea44 --- /dev/null +++ b/eval/repos/the-x @@ -0,0 +1 @@ +Subproject commit 9218fea4483ffcbbdf1471c83f65c01f3c25f554 diff --git a/eval/repos/trayracer b/eval/repos/trayracer new file mode 160000 index 000000000..2f0e7fbe9 --- /dev/null +++ b/eval/repos/trayracer @@ -0,0 +1 @@ +Subproject commit 2f0e7fbe962312a1b8bef8a29ed1ac4111ab11c4 diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index a93e891ae..19813eb6a 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -481,6 +481,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -581,6 +582,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -1095,6 +1097,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -1952,7 +1955,7 @@ "type": "object", "properties": { "name": { - "enum": ["cohere", "voyage", "llm", "free-trial"] + "enum": ["cohere", "voyage", "llm", "free-trial", "huggingface-tei"] }, "params": { "type": "object" @@ -2042,6 +2045,50 @@ } } } + }, + { + "if": { + "properties": { + "name": { + "enum": ["huggingface-tei"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiBase": { + "type": "string", + "default": "http://localhost:8080" + }, + "truncate": { + "type": "boolean", + "description": "Wether to truncate long sequences to the maximum allowed context length.", + "default": false + }, + "truncation_direction": { + "enum": ["Right","Left"], + "markdownDescription": "Wether to truncate sequences from the `left` or `right`.", + "default": "Right" + } + }, + "required": ["apiBase"] + } + }, + "if": { + "properties": { + "truncate": { + "const": true + } + } + }, + "then": { + "required": ["truncation_direction"] + } + } } ] }, diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index a93e891ae..19813eb6a 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -481,6 +481,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -581,6 +582,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -1095,6 +1097,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -1952,7 +1955,7 @@ "type": "object", "properties": { "name": { - "enum": ["cohere", "voyage", "llm", "free-trial"] + "enum": ["cohere", "voyage", "llm", "free-trial", "huggingface-tei"] }, "params": { "type": "object" @@ -2042,6 +2045,50 @@ } } } + }, + { + "if": { + "properties": { + "name": { + "enum": ["huggingface-tei"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiBase": { + "type": "string", + "default": "http://localhost:8080" + }, + "truncate": { + "type": "boolean", + "description": "Wether to truncate long sequences to the maximum allowed context length.", + "default": false + }, + "truncation_direction": { + "enum": ["Right","Left"], + "markdownDescription": "Wether to truncate sequences from the `left` or `right`.", + "default": "Right" + } + }, + "required": ["apiBase"] + } + }, + "if": { + "properties": { + "truncate": { + "const": true + } + } + }, + "then": { + "required": ["truncation_direction"] + } + } } ] }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 1b5e677c2..e1da75f39 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -516,6 +516,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -628,6 +629,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -1222,6 +1224,7 @@ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4o", + "gpt-4o-mini", "gpt-4", "gpt-3.5-turbo-0613", "gpt-4-32k", @@ -2183,7 +2186,8 @@ "cohere", "voyage", "llm", - "free-trial" + "free-trial", + "huggingface-tei" ] }, "params": { @@ -2297,6 +2301,61 @@ } } } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "huggingface-tei" + ] + } + }, + "required": [ + "name" + ] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiBase": { + "type": "string", + "default": "http://localhost:8080" + }, + "truncate": { + "type": "boolean", + "description": "Wether to truncate long sequences to the maximum allowed context length.", + "default": false + }, + "truncation_direction": { + "enum": [ + "Right", + "Left" + ], + "markdownDescription": "Wether to truncate sequences from the `left` or `right`.", + "default": "Right" + } + }, + "required": [ + "apiBase" + ] + } + }, + "if": { + "properties": { + "truncate": { + "const": true + } + } + }, + "then": { + "required": [ + "truncation_direction" + ] + } + } } ] }, diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 8cc798c0b..c1382a701 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.184", + "version": "0.9.185", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.184", + "version": "0.9.185", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", @@ -160,6 +160,7 @@ "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", "ts-jest": "^29.1.1" diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 0152eb02a..201226546 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -1,7 +1,7 @@ { "name": "continue", "icon": "media/icon.png", - "version": "0.9.184", + "version": "0.9.185", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -230,6 +230,12 @@ "title": "Fix Grammar / Spelling", "group": "Continue" }, + { + "command": "continue.codebaseForceReIndex", + "category": "Continue", + "title": "Codebase Force Re-Index", + "group": "Continue" + }, { "command": "continue.docsIndex", "category": "Continue", diff --git a/extensions/vscode/src/activation/activate.ts b/extensions/vscode/src/activation/activate.ts index 529372814..9af977b2d 100644 --- a/extensions/vscode/src/activation/activate.ts +++ b/extensions/vscode/src/activation/activate.ts @@ -1,10 +1,9 @@ -import { getTsConfigPath, getContinueRcPath, migrate } from "core/util/paths"; +import { getContinueRcPath, getTsConfigPath, migrate } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; import path from "node:path"; import * as vscode from "vscode"; import { VsCodeExtension } from "../extension/VsCodeExtension"; import registerQuickFixProvider from "../lang-server/codeActions"; -import { WorkOsAuthProvider } from "../stubs/WorkOsAuthProvider"; import { getExtensionVersion } from "../util/util"; import { getExtensionUri } from "../util/vscode"; import { VsCodeContinueApi } from "./api"; @@ -19,11 +18,6 @@ export async function activateExtension(context: vscode.ExtensionContext) { registerQuickFixProvider(); setupInlineTips(context); - // Register auth provider - const workOsAuthProvider = new WorkOsAuthProvider(context); - await workOsAuthProvider.initialize(); - context.subscriptions.push(workOsAuthProvider); - const vscodeExtension = new VsCodeExtension(context); migrate("showWelcome_1", () => { @@ -62,4 +56,4 @@ export async function activateExtension(context: vscode.ExtensionContext) { extension: vscodeExtension, } : continuePublicApi; -} \ No newline at end of file +} diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 7b1c9e623..578c8e69c 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -8,6 +8,7 @@ import { ContextMenuConfig, IDE } from "core"; import { CompletionProvider } from "core/autocomplete/completionProvider"; import { ConfigHandler } from "core/config/ConfigHandler"; import { ContinueServerClient } from "core/continueServer/stubs/client"; +import { Core } from "core/core"; import { GlobalContext } from "core/util/GlobalContext"; import { getConfigJsonPath, getDevDataFilePath } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; @@ -25,7 +26,6 @@ import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager"; import { QuickEdit, QuickEditShowParams } from "./quickEdit/QuickEditQuickPick"; import { Battery } from "./util/battery"; import type { VsCodeWebviewProtocol } from "./webviewProtocol"; -import { Core } from "core/core"; let fullScreenPanel: vscode.WebviewPanel | undefined; @@ -182,7 +182,7 @@ const commandsMap: ( continueServerClientPromise, battery, quickEdit, - core + core, ) => { /** * Streams an inline edit to the vertical diff manager. @@ -288,11 +288,14 @@ const commandsMap: ( "continue.toggleAuxiliaryBar": () => { vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar"); }, + "continue.codebaseForceReIndex": async () => { + core.invoke("index/forceReIndex", undefined); + }, "continue.docsIndex": async () => { - core.invoke("context/indexDocs", {reIndex: false}); + core.invoke("context/indexDocs", { reIndex: false }); }, "continue.docsReIndex": async () => { - core.invoke("context/indexDocs", {reIndex: true}); + core.invoke("context/indexDocs", { reIndex: true }); }, "continue.focusContinueInput": async () => { const fullScreenTab = getFullScreenTab(); @@ -573,12 +576,18 @@ const commandsMap: ( const config = vscode.workspace.getConfiguration("continue"); const quickPick = vscode.window.createQuickPick(); - const selected = new GlobalContext().get("selectedTabAutocompleteModel"); - const autocompleteModelTitles = (( - await configHandler.loadConfig() - ).tabAutocompleteModels - ?.map((model) => model.title) - .filter((t) => t !== undefined) || []) as string[]; + const autocompleteModels = + (await configHandler.loadConfig())?.tabAutocompleteModels ?? []; + const autocompleteModelTitles = autocompleteModels + .map((model) => model.title) + .filter((t) => t !== undefined) as string[]; + let selected = new GlobalContext().get("selectedTabAutocompleteModel"); + if ( + !selected || + !autocompleteModelTitles.some((title) => title === selected) + ) { + selected = autocompleteModelTitles[0]; + } // Toggle between Disabled, Paused, and Enabled const pauseOnBattery = @@ -593,8 +602,8 @@ const commandsMap: ( currentStatus === StatusBarStatus.Paused ? StatusBarStatus.Enabled : currentStatus === StatusBarStatus.Disabled - ? StatusBarStatus.Paused - : StatusBarStatus.Disabled; + ? StatusBarStatus.Paused + : StatusBarStatus.Disabled; } else { // Toggle between Disabled and Enabled targetStatus = @@ -691,7 +700,7 @@ export function registerAllCommands( continueServerClientPromise, battery, quickEdit, - core + core, ), )) { context.subscriptions.push( diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index b0f5950fe..d0b406a8a 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -9,9 +9,9 @@ import { v4 as uuidv4 } from "uuid"; import * as vscode from "vscode"; import { ContinueCompletionProvider } from "../autocomplete/completionProvider"; import { - StatusBarStatus, monitorBatteryChanges, setupStatusBar, + StatusBarStatus, } from "../autocomplete/statusBar"; import { registerAllCommands } from "../commands"; import { ContinueGUIWebviewViewProvider } from "../ContinueGUIWebviewViewProvider"; @@ -22,7 +22,10 @@ import { VsCodeIde } from "../ideProtocol"; import { registerAllCodeLensProviders } from "../lang-server/codeLens"; import { QuickEdit } from "../quickEdit/QuickEditQuickPick"; import { setupRemoteConfigSync } from "../stubs/activation"; -import { getControlPlaneSessionInfo } from "../stubs/WorkOsAuthProvider"; +import { + getControlPlaneSessionInfo, + WorkOsAuthProvider, +} from "../stubs/WorkOsAuthProvider"; import { Battery } from "../util/battery"; import { TabAutocompleteModel } from "../util/loadAutocompleteModel"; import type { VsCodeWebviewProtocol } from "../webviewProtocol"; @@ -42,8 +45,14 @@ export class VsCodeExtension { webviewProtocolPromise: Promise; private core: Core; private battery: Battery; + private workOsAuthProvider: WorkOsAuthProvider; constructor(context: vscode.ExtensionContext) { + // Register auth provider + this.workOsAuthProvider = new WorkOsAuthProvider(context); + this.workOsAuthProvider.initialize(); + context.subscriptions.push(this.workOsAuthProvider); + let resolveWebviewProtocol: any = undefined; this.webviewProtocolPromise = new Promise( (resolve) => { @@ -99,6 +108,7 @@ export class VsCodeExtension { this.ide, verticalDiffManagerPromise, configHandlerPromise, + this.workOsAuthProvider, ); this.core = new Core(inProcessMessenger, this.ide, async (log: string) => { @@ -142,7 +152,7 @@ export class VsCodeExtension { this.configHandler.onConfigUpdate((newConfig) => { this.sidebar.webviewProtocol?.request("configUpdate", undefined); - this.tabAutocompleteModel.clearLlm.bind(this.tabAutocompleteModel); + this.tabAutocompleteModel.clearLlm(); registerAllCodeLensProviders( context, @@ -196,7 +206,7 @@ export class VsCodeExtension { this.core.continueServerClientPromise, this.battery, quickEdit, - this.core + this.core, ); registerDebugTracker(this.sidebar.webviewProtocol, this.ide); @@ -256,6 +266,9 @@ export class VsCodeExtension { webviewProtocol.request("didChangeControlPlaneSessionInfo", { sessionInfo, }); + + // To make sure continue-proxy models and anything else requiring it get updated access token + this.configHandler.reloadConfig(); }); } }); diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 7865d49be..e5866da6a 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -18,7 +18,10 @@ import * as path from "node:path"; import * as vscode from "vscode"; import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager"; import { VsCodeIde } from "../ideProtocol"; -import { getControlPlaneSessionInfo } from "../stubs/WorkOsAuthProvider"; +import { + getControlPlaneSessionInfo, + WorkOsAuthProvider, +} from "../stubs/WorkOsAuthProvider"; import { getExtensionUri } from "../util/vscode"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; @@ -71,6 +74,7 @@ export class VsCodeMessenger { private readonly ide: VsCodeIde, private readonly verticalDiffManagerPromise: Promise, private readonly configHandlerPromise: Promise, + private readonly workOsAuthProvider: WorkOsAuthProvider, ) { /** WEBVIEW ONLY LISTENERS **/ this.onWebview("showFile", (msg) => { @@ -294,5 +298,11 @@ export class VsCodeMessenger { this.onWebviewOrCore("getControlPlaneSessionInfo", async (msg) => { return getControlPlaneSessionInfo(msg.data.silent); }); + this.onWebviewOrCore("logoutOfControlPlane", async (msg) => { + const sessions = await this.workOsAuthProvider.getSessions(); + await Promise.all( + sessions.map((session) => workOsAuthProvider.removeSession(session.id)), + ); + }); } } diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index 5c6e87221..4be583ccd 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -91,20 +91,10 @@ export class QuickEdit { private readonly ide: IDE, private readonly context: vscode.ExtensionContext, ) { - this.initializeQuickEditState(); + this.initializeFileSearchState(); } - private async initializeQuickEditState() { - const editor = vscode.window.activeTextEditor; - - if (!editor) { - return; - } - - const existingHandler = this.verticalDiffManager.getHandlerForFile( - editor.document.uri.fsPath ?? "", - ); - + private async initializeFileSearchState() { const workspaceDirs = await this.ide.getWorkspaceDirs(); const results = await Promise.all( @@ -119,6 +109,13 @@ export class QuickEdit { })); this.miniSearch.addAll(filenames); + } + + private setActiveEditorAndPrevInput(editor: vscode.TextEditor) { + const existingHandler = this.verticalDiffManager.getHandlerForFile( + editor.document.uri.fsPath ?? "", + ); + this.editorWhenOpened = editor; this.previousInput = existingHandler?.input; } @@ -152,11 +149,7 @@ export class QuickEdit { * // "Edit myFile.ts", "Edit myFile.ts:5-10", "Edit myFile.ts:15" */ _getQuickPickTitle = () => { - const uri = this.editorWhenOpened.document.uri; - - if (!uri) { - return "Edit"; - } + const { uri } = this.editorWhenOpened.document; const fileName = vscode.workspace.asRelativePath(uri, true); @@ -210,6 +203,7 @@ export class QuickEdit { async _getInitialQuickPickVal(): Promise { const modelTitle = await this._getCurModelTitle(); + const { uri } = this.editorWhenOpened.document; const initialItems: vscode.QuickPickItem[] = [ { @@ -241,9 +235,7 @@ export class QuickEdit { * as soon as the user types the search character */ const currentFileItem: vscode.QuickPickItem = { - label: vscode.workspace.asRelativePath( - this.editorWhenOpened.document.uri, - ), + label: vscode.workspace.asRelativePath(uri), description: "Current file", alwaysShow: true, }; @@ -380,6 +372,20 @@ export class QuickEdit { // Clean up state from previous quick picks, e.g. if a user pressed `esc` this.clear(); + const editor = vscode.window.activeTextEditor; + + // We only allow users to interact with a quick edit if there is an open editor + if (!editor) { + return; + } + + // Set state that is unique to each quick pick instance + this.setActiveEditorAndPrevInput(editor); + + if (!this.editorWhenOpened) { + return; + } + const config = await this.configHandler.loadConfig(); if (!!args?.initialPrompt) { diff --git a/gui/package-lock.json b/gui/package-lock.json index 92f1a4d1f..47df1bfbb 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -153,6 +153,7 @@ "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", "ts-jest": "^29.1.1" diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 1df23324e..2ce44d6c1 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -36,6 +36,17 @@ const FOOTER_HEIGHT = "1.8em"; const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; border-radius: ${defaultBorderRadius}; + position: relative; + + &::after { + position: absolute; + content: ""; + width: 100%; + height: 1px; + background-color: rgba(136, 136, 136, 0.3); + top: 0; + left: 0; + } `; const BottomMessageDiv = styled.div<{ displayOnBottom: boolean }>` @@ -66,7 +77,8 @@ const Footer = styled.footer` height: ${FOOTER_HEIGHT}; background-color: transparent; backdrop-filter: blur(12px); - + border-top: 1px solid rgba(136, 136, 136, 0.3); + border-bottom: 1px solid rgba(136, 136, 136, 0.3); overflow: hidden; `; diff --git a/gui/src/components/ProfileSwitcher.tsx b/gui/src/components/ProfileSwitcher.tsx index 9cd03f5c0..e1545ba5a 100644 --- a/gui/src/components/ProfileSwitcher.tsx +++ b/gui/src/components/ProfileSwitcher.tsx @@ -7,7 +7,7 @@ import { import { ProfileDescription } from "core/config/ConfigHandler"; import { Fragment, useContext, useEffect, useState } from "react"; import ReactDOM from "react-dom"; -import { useDispatch, useSelector } from "react-redux"; +import { useSelector } from "react-redux"; import styled from "styled-components"; import { defaultBorderRadius, @@ -101,9 +101,6 @@ function ListBoxOption({ showDelete?: boolean; selected: boolean; }) { - const ideMessenger = useContext(IdeMessengerContext); - - const dispatch = useDispatch(); const [hovered, setHovered] = useState(false); return ( diff --git a/gui/src/components/loaders/BlinkingDot.tsx b/gui/src/components/loaders/BlinkingDot.tsx deleted file mode 100644 index db8feb5a5..000000000 --- a/gui/src/components/loaders/BlinkingDot.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import styled, { css, keyframes } from "styled-components"; - -const DEFAULT_DIAMETER = 6; - -const blink = keyframes` - 0%, 100% { - transform: scale(1); - opacity: 1; - } - 50% { - opacity: 0.25; - } -`; - -const blinkAnimation = css` - animation: ${blink} 3s infinite; -`; - -const BlinkingDot = styled.div<{ - color: string; - diameter?: number; - shouldBlink?: boolean; -}>` - background-color: ${(props) => props.color}; - box-shadow: 0px 0px 2px 1px ${(props) => props.color}; - width: ${(props) => props.diameter ?? DEFAULT_DIAMETER}px; - height: ${(props) => props.diameter ?? DEFAULT_DIAMETER}px; - border-radius: 50%; - border: 1px solid rgba(255, 255, 255, 0.75); - margin: 0 2px; - ${(props) => (props.shouldBlink ?? false) && blinkAnimation}; -`; - -export default BlinkingDot; diff --git a/gui/src/components/loaders/StatusDot.tsx b/gui/src/components/loaders/StatusDot.tsx index 24c8cdc3d..e558f373a 100644 --- a/gui/src/components/loaders/StatusDot.tsx +++ b/gui/src/components/loaders/StatusDot.tsx @@ -27,7 +27,7 @@ const StatusDot = styled.div<{ height: ${(props) => props.diameter ?? DEFAULT_DIAMETER}px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.75); - margin: 0 2px; + margin: 0 4px 0 8px; ${(props) => (props.shouldBlink ?? false) && blinkAnimation}; `; diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index f78afb71d..f854cbafa 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -151,7 +151,7 @@ function InputToolbar(props: InputToolbarProps) { ⏎ Enter - + setFileSelectHovered(false)} onMouseEnter={() => setFileSelectHovered(true)} > diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 867f166a6..fae117615 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -28,10 +28,10 @@ import ConfirmationDialog from "../dialogs/ConfirmationDialog"; const StyledListboxButton = styled(Listbox.Button)` display: flex; align-items: center; - gap: 4px; + gap: 2px; border: none; cursor: pointer; - font-size: ${() => `${getFontSize() - 4}px`}; + font-size: ${() => `${getFontSize() - 3}px`}; background: transparent; color: ${() => lightGray}; &:focus { @@ -212,11 +212,14 @@ function ModelSelect() { }} >
- +
{modelSelectTitle(defaultModel) || "Select model"}
diff --git a/gui/src/hooks/useAuth.tsx b/gui/src/hooks/useAuth.tsx index e8100ca7d..868b22779 100644 --- a/gui/src/hooks/useAuth.tsx +++ b/gui/src/hooks/useAuth.tsx @@ -60,10 +60,11 @@ export function useAuth(): { dispatch( setDialogMessage( {}} + confirmText="Yes, log out" + text={"Are you sure you want to log out of Continue?"} + onConfirm={() => { + ideMessenger.request("logoutOfControlPlane", undefined); + }} />, ), ); diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index c0105f241..62fa6bb9e 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -484,6 +484,21 @@ export const models: { [key: string]: ModelPackage } = { icon: "openai.png", isOpenSource: false, }, + gpt4omini: { + title: "GPT-4o Mini", + description: + "A model at less than half the price of gpt-3.5-turbo, but near gpt-4 in capabilities.", + params: { + model: "gpt-4o-mini", + contextLength: 128_000, + title: "GPT-4o mini", + systemMessage: + "You are an expert software developer. You give helpful and concise responses.", + }, + providerOptions: ["openai"], + icon: "openai.png", + isOpenSource: false, + }, gpt35turbo: { title: "GPT-3.5-Turbo", description: diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 5c81efdb2..975170f98 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -61,6 +61,7 @@ export const providers: Partial> = { tags: [ModelProviderTags.RequiresApiKey], packages: [ models.gpt4o, + models.gpt4omini, models.gpt4turbo, models.gpt35turbo, { diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index 08ec5fc6e..9ca321eb3 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -108,9 +108,9 @@ const StepsDiv = styled.div` const NewSessionButton = styled.div` width: fit-content; margin-right: auto; - margin-left: 8px; - margin-top: 4px; - + margin-left: 6px; + margin-top: 2px; + margin-bottom: 8px; font-size: ${getFontSize() - 2}px; border-radius: ${defaultBorderRadius}; diff --git a/gui/src/pages/help.tsx b/gui/src/pages/help.tsx index 5c01fd30c..cf2093269 100644 --- a/gui/src/pages/help.tsx +++ b/gui/src/pages/help.tsx @@ -12,46 +12,7 @@ import { import KeyboardShortcutsDialog from "../components/dialogs/KeyboardShortcuts"; import { IdeMessengerContext } from "../context/IdeMessenger"; import { useNavigationListener } from "../hooks/useNavigationListener"; - -const ResourcesDiv = styled.div` - margin: 4px; - border-top: 0.5px solid ${lightGray}; - border-bottom: 0.5px solid ${lightGray}; -`; - -const IconDiv = styled.div<{ backgroundColor?: string }>` - display: flex; - align-items: center; - justify-content: center; - cursor: pointer; - - padding: 12px; - - & > a { - color: ${vscForeground}; - text-decoration: none; - display: flex; - align-items: center; - width: 100%; - justify-content: center; - } - - &:hover { - background-color: ${(props) => props.backgroundColor || lightGray}; - } -`; - -const TutorialButton = styled(Button)` - padding: 2px 4px; - margin-left: auto; - margin-right: 12px; - background-color: transparent; - color: ${vscForeground}; - border: 1px solid ${lightGray}; - &:hover { - background-color: ${lightGray}; - } -`; +import { SecondaryButton } from "../components"; function HelpPage() { useNavigationListener(); @@ -74,93 +35,117 @@ function HelpPage() { className="inline-block ml-4 cursor-pointer" />

Help Center

- { - ideMessenger.post("showTutorial", undefined); - navigate("/onboarding"); - }} - > - Open tutorial -
-

{ - navigate("/stats"); - }} - > - View My Usage -

-
-

Resources

- - +
+
+
+

Documentation

+

+ Visit the documentation site to learn how to configure and use + Continue. +

+
- - - - Demo Video + View docs - - - + + + +
+
+

Token usage stats

+

+ See how many tokens you're using each day and how they're + distributed across your models. +

+
+ { + navigate("/stats"); + }} + > + View token usage + +
+ +
+
+

Have an issue?

+

Let us know on GitHub and we'll do our best to resolve it.

+
- - - - GitHub Issues + + + + + Create a GitHub issue + - - +
+ +
+
+

Join the community!

+

+ Join us on Discord to stay up-to-date on the latest developments +

+
+ + + + + + Continue Discord + + +
+
diff --git a/gui/src/pages/stats.tsx b/gui/src/pages/stats.tsx index 47515ddda..c07adc864 100644 --- a/gui/src/pages/stats.tsx +++ b/gui/src/pages/stats.tsx @@ -71,7 +71,7 @@ function Stats() { navigate("/")} + onClick={() => navigate(-1)} className="inline-block ml-4 cursor-pointer" />

My Usage

diff --git a/packages/llm-info/src/models/openai.ts b/packages/llm-info/src/models/openai.ts index 2c7b70e1e..c7b0cd778 100644 --- a/packages/llm-info/src/models/openai.ts +++ b/packages/llm-info/src/models/openai.ts @@ -44,26 +44,31 @@ export const OpenAiLlms: LlmInfo[] = [ { model: "gpt-4-turbo-preview", displayName: "GPT-4 Turbo Preview", - contextLength: 4096, + contextLength: 128_000, }, { model: "gpt-4o", displayName: "GPT-4o", - contextLength: 4096, + contextLength: 128_000, + }, + { + model: "gpt-4o-mini", + displayName: "GPT-4o Mini", + contextLength: 128_000, }, { model: "gpt-4-vision", displayName: "GPT-4 Vision", - contextLength: 4096, + contextLength: 128_000, }, { model: "gpt-4-0125-preview", displayName: "GPT-4 (0125 Preview)", - contextLength: 4096, + contextLength: 128_000, }, { model: "gpt-4-1106-preview", displayName: "GPT-4 (1106 Preview)", - contextLength: 4096, + contextLength: 128_000, }, ];