From 805984f0ad1a68470393f596c1fb98c82058b146 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:12:03 -0700 Subject: [PATCH 1/2] Improved walkDir performance (#1814) 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 * skip test failing only due to type error * fix: convert `walkDir` to an async generator (#1783) * walkdir to async generator * add yields * handle ignore files * Update CodebaseIndexer.ts * Update walkDir.ts * chore: bump VS Code ext version * fix completions support in ContinueProxy * add test for walkDir * IAnalyticsProvider * feat: crawl `.mdx` docs * update workspaces on session info change * rename from profile to workspace (user-facing) * update config schema files * feat: improve chat thread ui for better readability (#1786) * add "language" template variable for autocomplete * Enable debug logs (#1800) * Add an enableDebugLogs flag * Send logs to VSCode * Refresh index fixes (#1795) * Use the resultType given to markComplete This fixes an issue where if there were multiple result types in itemToAction such as an update with UpdateNewVersion and UpdateOldVersion, only the UpdateOldVersion would be hit (which is a noop) and the UpdateNewVersion would never be fired, causing us to never update the timestamp of the tag_catalog. * Add a Compute and UpdateLastUpdated to refreshIndex Removes the ability to insert duplicate rows if we're just computing the result. Instead we replace the existing row instead. * Don't insert compute tags They are REPLACEd in markComplete now. * docs: change page heading to model providers (#1684) * feat: allow JetBrains users to index docs (#1797) * feat: allow JetBrains users to index docs * update docs service * update global context * throw error popup on jetbrains + transformers * update toast notifications * update typings * fix tsc errors * Index on file change (#1785) * Reload the submenu items when the context provider data is refreshed * update version * Just call refreshSubmenuItems * remove log statements * cleanup * Remove the Promise declaration * Copy currentFiles to a new dict since we're going to mutate it Don't mutate the caller's currentFiles unexpectedly * Remove reIndexFile and just call index/forceReIndex * We MUST await the refreshCodebaseIndex call * Expose send on core * remove unused import * Reindex the workspaces on save * Call core.send Ideally, we can implement externalRequest on the webview later so we don't have to expose messenger to the VSCode extension * Always refreshSubmenuItems in refreshCodebaseIndex * whitespace * Change messenger back to private * Add Pause Codebase On Start setting (#1788) * Add a skipInitialSync function * Add pauseInitialCodebaseIndex * docs * version bump * Rename to pauseCodebaseIndexOnStart * Un-shadow file context provider (#1801) * allow FileContextProvider to handle files * remove commented-out lines * chore: add telemetry to alt-enter (#1805) * Set the indexProgress indicator to paused on startup if pauseCodebaseIndexOnStart is set (#1804) * Fix Input Toolbar layout (#1792) * set to flex flex-column * Remove fixed height and always show the StyledDivs content to hold its size * Add a Delete Message button to the StepContainer (#1790) * Add a delete button * add a delete message action to the GUI * Fix off by one error * format * This index should be less than length * Update to trash icon * Simplify walkDir(...) and improve performance by roughly 10x in larger repos (#1806) The performance of WalkDir is improved by replacing the recursive DFS with a stack based implementation (less memory in-use during peak exploration). In addition, some unnecessary flags and options were removed which allowed the code to be overall simplified. Much less rule matching is occuring with the same files returned. Some performance results on my linux host: small repo: - 649 files returned by walkDir() - 9 .gitignore files - walkDir() old vs new duration: 918 ms to 143 ms medium sized repo: - 9271 returned by walkDir() - 35 .gitignore files - walkDir() old vs new duration: 10,886 ms to 970ms large sized repo: - 197,900 files returned by walkDir() - 929 .gitignore files - walkDir() old vs new duration: 498,151 ms to 37,353 ms Co-authored-by: Rob Leidle * modified assistant indicator in UI * update package.json version * feat: add Llama 3.1 8B to cloudflare provider options (#1811) Co-authored-by: jdelorey@cloudflare.com * increase gemini pro contextLength (#1809) * fix indentation (#1808) * Llama 3.1 405b model selection (#1813) * add support for llama3 405b * 3.1 * name mapping * updates to model setup * fix walkDir tests on windows --------- 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> Co-authored-by: Josh Vera Co-authored-by: Peter Zaback Co-authored-by: James Delorey Co-authored-by: jdelorey@cloudflare.com --- core/autocomplete/templates.ts | 5 - core/indexing/walkDir.ts | 9 +- core/llm/llms/Cloudflare.ts | 1 - core/llm/llms/FreeTrial.ts | 3 +- core/llm/llms/Groq.ts | 3 + core/llm/llms/Ollama.ts | 3 + core/llm/llms/Replicate.ts | 3 + core/llm/llms/Together.ts | 3 + core/test/walkDir.test.ts | 7 + docs/static/schemas/config.json | 25 +- .../src/main/resources/config_schema.json | 24 +- extensions/vscode/config_schema.json | 24 +- extensions/vscode/continue_rc_schema.json | 24 +- extensions/vscode/package-lock.json | 4 +- gui/src/components/mainInput/resolveInput.ts | 3 +- gui/src/pages/AddNewModel/AddNewModel.tsx | 264 +++++++++--------- gui/src/pages/AddNewModel/configs/models.ts | 231 ++++++++++----- .../pages/AddNewModel/configs/providers.ts | 10 +- 18 files changed, 421 insertions(+), 225 deletions(-) diff --git a/core/autocomplete/templates.ts b/core/autocomplete/templates.ts index 4de43739a..c0177bb12 100644 --- a/core/autocomplete/templates.ts +++ b/core/autocomplete/templates.ts @@ -155,11 +155,6 @@ const deepseekFimTemplate: AutocompleteTemplate = { }, }; -const deepseekFimTemplateWrongPipeChar: AutocompleteTemplate = { - template: "<|fim▁begin|>{{{prefix}}}<|fim▁hole|>{{{suffix}}}<|fim▁end|>", - completionOptions: { stop: ["<|fim▁begin|>", "<|fim▁hole|>", "<|fim▁end|>"] }, -}; - const gptAutocompleteTemplate: AutocompleteTemplate = { template: `\`\`\` {{{prefix}}}[BLANK]{{{suffix}}} diff --git a/core/indexing/walkDir.ts b/core/indexing/walkDir.ts index 45dc5d1c0..1c320f181 100644 --- a/core/indexing/walkDir.ts +++ b/core/indexing/walkDir.ts @@ -220,12 +220,11 @@ export async function walkDir( for await (const e of dfsWalker.walk()) { relativePaths.push(e); } - if (options?.returnRelativePaths) { - return relativePaths; - } const pathSep = await ide.pathSep(); + const prefix = options.returnRelativePaths ? "" : path + pathSep; + if (pathSep === "/") { - return relativePaths.map((p) => path + pathSep + p); + return relativePaths.map((p) => prefix + p); } - return relativePaths.map((p) => path + pathSep + p.split("/").join(pathSep)); + return relativePaths.map((p) => prefix + p.split("/").join(pathSep)); } diff --git a/core/llm/llms/Cloudflare.ts b/core/llm/llms/Cloudflare.ts index dcaf333c4..7f299c7ed 100644 --- a/core/llm/llms/Cloudflare.ts +++ b/core/llm/llms/Cloudflare.ts @@ -38,7 +38,6 @@ export default class Cloudflare extends BaseLLM { }); for await (const value of streamSse(resp)) { - console.log(value); if (value.choices?.[0]?.delta?.content) { yield value.choices[0].delta; } diff --git a/core/llm/llms/FreeTrial.ts b/core/llm/llms/FreeTrial.ts index b2db6a5a1..e4c1674e6 100644 --- a/core/llm/llms/FreeTrial.ts +++ b/core/llm/llms/FreeTrial.ts @@ -165,7 +165,8 @@ class FreeTrial extends BaseLLM { return [ "codestral-latest", "claude-3-5-sonnet-20240620", - "llama3-70b", + "llama3.1-405b", + "llama3.1-70b", "gpt-4o", "gpt-3.5-turbo", "claude-3-haiku-20240307", diff --git a/core/llm/llms/Groq.ts b/core/llm/llms/Groq.ts index 0aa5b5636..27c51e1e3 100644 --- a/core/llm/llms/Groq.ts +++ b/core/llm/llms/Groq.ts @@ -14,6 +14,9 @@ class Groq extends OpenAI { gemma: "gemma-7b-it", "llama3-8b": "llama3-8b-8192", "llama3-70b": "llama3-70b-8192", + "llama3.1-8b": "llama-3.1-8b-instant", + "llama3.1-70b": "llama-3.1-70b-versatile", + "llama3.1-405b": "llama-3.1-405b-reasoning", }; protected _convertModelName(model: string): string { return Groq.modelConversion[model] ?? model; diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index e24a489f0..8da67a14e 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -88,6 +88,9 @@ class Ollama extends BaseLLM { "codellama-70b": "codellama:70b", "llama3-8b": "llama3:8b", "llama3-70b": "llama3:70b", + "llama3.1-8b": "llama3.1:8b", + "llama3.1-70b": "llama3.1:70b", + "llama3.1-405b": "llama3.1:405b", "phi-2": "phi:2.7b", "phind-codellama-34b": "phind-codellama:34b-v2", "wizardcoder-7b": "wizardcoder:7b-python", diff --git a/core/llm/llms/Replicate.ts b/core/llm/llms/Replicate.ts index 7cfa6e890..5dde24014 100644 --- a/core/llm/llms/Replicate.ts +++ b/core/llm/llms/Replicate.ts @@ -18,6 +18,9 @@ class Replicate extends BaseLLM { "llama2-13b": "meta/llama-2-13b-chat" as any, "llama3-8b": "meta/meta-llama-3-8b-instruct" as any, "llama3-70b": "meta/meta-llama-3-70b-instruct" as any, + "llama3.1-8b": "meta/meta-llama-3.1-8b-instruct" as any, + "llama3.1-70b": "meta/meta-llama-3.1-70b-instruct" as any, + "llama3.1-405b": "meta/meta-llama-3.1-405b-instruct" as any, "zephyr-7b": "nateraw/zephyr-7b-beta:b79f33de5c6c4e34087d44eaea4a9d98ce5d3f3a09522f7328eea0685003a931", "mistral-7b": diff --git a/core/llm/llms/Together.ts b/core/llm/llms/Together.ts index 277389c77..eaa144277 100644 --- a/core/llm/llms/Together.ts +++ b/core/llm/llms/Together.ts @@ -19,6 +19,9 @@ class Together extends OpenAI { "codellama-70b": "codellama/CodeLlama-70b-Instruct-hf", "llama3-8b": "meta-llama/Llama-3-8b-chat-hf", "llama3-70b": "meta-llama/Llama-3-70b-chat-hf", + "llama3.1-8b": "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo", + "llama3.1-70b": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", + "llama3.1-405b": "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo", "llama2-7b": "togethercomputer/llama-2-7b-chat", "llama2-13b": "togethercomputer/llama-2-13b-chat", "llama2-70b": "togethercomputer/llama-2-70b-chat", diff --git a/core/test/walkDir.test.ts b/core/test/walkDir.test.ts index c3f40128a..87f643f4e 100644 --- a/core/test/walkDir.test.ts +++ b/core/test/walkDir.test.ts @@ -24,6 +24,13 @@ async function expectPaths( toNotExist: string[], options?: WalkerOptions, ) { + // Convert to Windows paths + const pathSep = await ide.pathSep(); + if (pathSep === "\\") { + toExist = toExist.map((p) => p.replace(/\//g, "\\")); + toNotExist = toNotExist.map((p) => p.replace(/\//g, "\\")); + } + const result = await walkTestDir(options); for (const p of toExist) { diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index ac7461d8f..3cc82db36 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -423,6 +423,7 @@ "anyOf": [ { "enum": [ + "@cf/meta/llama-3.1-8b-instruct", "@cf/meta/llama-3-8b-instruct", "@hf/thebloke/deepseek-coder-6.7b-instruct-awq", "@cf/deepseek-ai/deepseek-math-7b-instruct", @@ -513,6 +514,9 @@ "anyOf": [ { "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "llama3-8b", "llama3-70b", "codellama-7b", @@ -546,7 +550,8 @@ "enum": [ "gpt-4o", "codestral-latest", - "llama3-70b", + "llama3.1-70b", + "llama3.1-405b", "gpt-3.5-turbo", "phind-codellama-34b", "gemini-pro", @@ -598,6 +603,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -748,6 +756,9 @@ "llama2-13b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "codellama-7b", "codellama-13b", "codellama-34b", @@ -812,6 +823,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -860,6 +874,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phi-2", "phind-codellama-34b", "wizardcoder-7b", @@ -947,6 +964,9 @@ "gemma", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "AUTODETECT" ] } @@ -1113,6 +1133,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index ac7461d8f..0512f8ac0 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -513,6 +513,9 @@ "anyOf": [ { "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "llama3-8b", "llama3-70b", "codellama-7b", @@ -546,7 +549,8 @@ "enum": [ "gpt-4o", "codestral-latest", - "llama3-70b", + "llama3.1-70b", + "llama3.1-405b", "gpt-3.5-turbo", "phind-codellama-34b", "gemini-pro", @@ -598,6 +602,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -748,6 +755,9 @@ "llama2-13b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "codellama-7b", "codellama-13b", "codellama-34b", @@ -812,6 +822,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -860,6 +873,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phi-2", "phind-codellama-34b", "wizardcoder-7b", @@ -947,6 +963,9 @@ "gemma", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "AUTODETECT" ] } @@ -1113,6 +1132,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index ac7461d8f..0512f8ac0 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -513,6 +513,9 @@ "anyOf": [ { "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "llama3-8b", "llama3-70b", "codellama-7b", @@ -546,7 +549,8 @@ "enum": [ "gpt-4o", "codestral-latest", - "llama3-70b", + "llama3.1-70b", + "llama3.1-405b", "gpt-3.5-turbo", "phind-codellama-34b", "gemini-pro", @@ -598,6 +602,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -748,6 +755,9 @@ "llama2-13b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "codellama-7b", "codellama-13b", "codellama-34b", @@ -812,6 +822,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -860,6 +873,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phi-2", "phind-codellama-34b", "wizardcoder-7b", @@ -947,6 +963,9 @@ "gemma", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "AUTODETECT" ] } @@ -1113,6 +1132,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 2c67ce0c1..8e0e49919 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -552,6 +552,9 @@ "anyOf": [ { "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "llama3-8b", "llama3-70b", "codellama-7b", @@ -589,7 +592,8 @@ "enum": [ "gpt-4o", "codestral-latest", - "llama3-70b", + "llama3.1-70b", + "llama3.1-405b", "gpt-3.5-turbo", "phind-codellama-34b", "gemini-pro", @@ -645,6 +649,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -818,6 +825,9 @@ "llama2-13b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "codellama-7b", "codellama-13b", "codellama-34b", @@ -888,6 +898,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", @@ -940,6 +953,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phi-2", "phind-codellama-34b", "wizardcoder-7b", @@ -1042,6 +1058,9 @@ "gemma", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "AUTODETECT" ] } @@ -1240,6 +1259,9 @@ "codellama-70b", "llama3-8b", "llama3-70b", + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b", "phind-codellama-34b", "wizardcoder-7b", "wizardcoder-13b", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 118fd459d..e4cf812f7 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.189", + "version": "0.9.187", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.189", + "version": "0.9.187", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/gui/src/components/mainInput/resolveInput.ts b/gui/src/components/mainInput/resolveInput.ts index 508627b7f..a067243da 100644 --- a/gui/src/components/mainInput/resolveInput.ts +++ b/gui/src/components/mainInput/resolveInput.ts @@ -7,7 +7,6 @@ import { RangeInFile, } from "core"; import { stripImages } from "core/llm/countTokens"; -import { getBasename, getRelativePath } from "core/util"; import { IIdeMessenger } from "../../context/IdeMessenger"; interface MentionAttrs { @@ -99,7 +98,7 @@ async function resolveEditorContent( let contextItemsText = ""; let contextItems: ContextItemWithId[] = []; for (const item of contextItemAttrs) { - const data = { + const data = { name: item.itemType === "contextProvider" ? item.id : item.itemType, query: item.query, fullInput: stripImages(parts), diff --git a/gui/src/pages/AddNewModel/AddNewModel.tsx b/gui/src/pages/AddNewModel/AddNewModel.tsx index e08cec157..ddf947fc2 100644 --- a/gui/src/pages/AddNewModel/AddNewModel.tsx +++ b/gui/src/pages/AddNewModel/AddNewModel.tsx @@ -62,7 +62,7 @@ function AddNewModel() { const [providersSelected, setProvidersSelected] = React.useState(true); return ( -
+
Add a new model

- - To add a new model you can either: -
    -
  • - Start by selecting and configuring a provider, then choosing your - model -
  • -
  • Select a specific model directly
  • -
- - Visit our setup overview docs - {" "} - to learn more. -
+
+ + To add a new model you can either: +
    +
  • + Start by selecting and configuring a provider, then choosing your + model +
  • +
  • Select a specific model directly
  • +
+ + Visit our setup overview docs + {" "} + to learn more. +
-
- { - setProvidersSelected((prev) => !prev); - }} - > -
+
+ { + setProvidersSelected((prev) => !prev); + }} + > +
- {providersSelected ? ( - <> -
-

Providers

-

- Select a provider below, or configure your own in{" "} - config.json -

-
+ {providersSelected ? ( + <> +
+

Providers

+

+ Select a provider below, or configure your own in{" "} + config.json +

+
- - {Object.entries(providers).map(([providerName, modelInfo], i) => ( - { - console.log(`/addModel/provider/${providerName}`); - navigate(`/addModel/provider/${providerName}`); - }} - /> - ))} - - - ) : ( - <> -
-

Models

-

- Select a model from the most popular options below, or configure - your own in config.json -

-
+ + {Object.entries(providers).map(([providerName, modelInfo], i) => ( + { + console.log(`/addModel/provider/${providerName}`); + navigate(`/addModel/provider/${providerName}`); + }} + /> + ))} + + + ) : ( + <> +
+

Models

+

+ Select a model from the most popular options below, or configure + your own in config.json +

+
- {Object.entries(modelsByProvider).map( - ([providerTitle, modelConfigsByProviderTitle]) => ( -
-
-

{providerTitle}

-
-
- - - {modelConfigsByProviderTitle.map((config) => ( - { - const model = { - ...config.params, - ..._.merge( - {}, - ...(config.dimensions?.map((dimension, i) => { - if (!dimensionChoices?.[i]) return {}; - return { - ...dimension.options[dimensionChoices[i]], - }; - }) || []), - ), - provider: providers[selectedProvider].provider, - }; - ideMessenger.post("config/addModel", { model }); - dispatch( - setDefaultModel({ - title: model.title, - force: true, - }), - ); - navigate("/"); + {Object.entries(modelsByProvider).map( + ([providerTitle, modelConfigsByProviderTitle]) => ( +
+
+

{providerTitle}

+
- ))} - -
- ), - )} - - )} +
- { - ideMessenger.post("openConfigJson", undefined); - }} - > -

- - Open config.json -

-
+ + {modelConfigsByProviderTitle.map((config) => ( + { + const model = { + ...config.params, + ..._.merge( + {}, + ...(config.dimensions?.map((dimension, i) => { + if (!dimensionChoices?.[i]) return {}; + return { + ...dimension.options[dimensionChoices[i]], + }; + }) || []), + ), + provider: providers[selectedProvider].provider, + }; + ideMessenger.post("config/addModel", { model }); + dispatch( + setDefaultModel({ + title: model.title, + force: true, + }), + ); + navigate("/"); + }} + /> + ))} + +
+ ), + )} + + )} + + { + ideMessenger.post("openConfigJson", undefined); + }} + > +

+ + Open config.json +

+
+
); } diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 62fa6bb9e..e3ed6f286 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -32,6 +32,113 @@ export interface ModelPackage { } export const models: { [key: string]: ModelPackage } = { + llama31Chat: { + title: "Llama3.1 Chat", + description: "The latest model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama3.1-8b", + model: "llama3.1-8b", + contextLength: 8192, + }, + icon: "meta.png", + dimensions: [ + { + name: "Parameter Count", + description: "The number of parameters in the model", + options: { + "8b": { + model: "llama3.1-8b", + title: "Llama3.1-8b", + }, + "70b": { + model: "llama3.1-70b", + title: "Llama3.1-70b", + }, + "405b": { + model: "llama3.1-405b", + title: "Llama3.1-405b", + }, + }, + }, + ], + providerOptions: [ + "ollama", + "lmstudio", + "together", + "llama.cpp", + "replicate", + ], + isOpenSource: true, + }, + deepseek: { + title: "DeepSeek-Coder", + description: + "A model pre-trained on 2 trillion tokens including 80+ programming languages and a repo-level corpus.", + params: { + title: "DeepSeek-7b", + model: "deepseek-7b", + contextLength: 4096, + }, + icon: "deepseek.png", + dimensions: [ + { + name: "Parameter Count", + description: "The number of parameters in the model", + options: { + "1b": { + model: "deepseek-1b", + title: "DeepSeek-1b", + }, + "7b": { + model: "deepseek-7b", + title: "DeepSeek-7b", + }, + "33b": { + model: "deepseek-33b", + title: "DeepSeek-33b", + }, + }, + }, + ], + providerOptions: ["ollama", "lmstudio", "llama.cpp"], + isOpenSource: true, + }, + mistralOs: { + title: "Mistral", + description: + "A series of open-weight models created by Mistral AI, highly competent for code generation and other tasks", + params: { + title: "Mistral", + model: "mistral-7b", + contextLength: 4096, + }, + dimensions: [ + { + name: "Parameter Count", + description: "The number of parameters in the model", + options: { + "7b": { + model: "mistral-7b", + title: "Mistral-7b", + }, + "8x7b (MoE)": { + model: "mistral-8x7b", + title: "Mixtral", + }, + }, + }, + ], + icon: "mistral.png", + providerOptions: [ + "ollama", + "lmstudio", + "together", + "llama.cpp", + "replicate", + ], + isOpenSource: true, + }, codeLlamaInstruct: { title: "CodeLlama Instruct", description: @@ -76,7 +183,7 @@ export const models: { [key: string]: ModelPackage } = { ], isOpenSource: true, }, - codellama70bTrial: { + llama3170bTrial: { title: "Codellama 70b (Free Trial)", description: "The best code model from Meta, fine-tuned for code generation and conversation", @@ -90,6 +197,19 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["free-trial"], isOpenSource: false, }, + llama31405bTrial: { + title: "Llama3.1 405b (Free Trial)", + description: "The latest Llama model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama3.1-405b", + model: "llama3.1-405b", + contextLength: 8192, + }, + icon: "meta.png", + providerOptions: ["free-trial"], + isOpenSource: false, + }, mixtralTrial: { title: "Mixtral (Free Trial)", description: @@ -130,6 +250,45 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["groq"], isOpenSource: false, }, + llama318bChat: { + title: "Llama3.1 8b Chat", + description: "The latest Llama model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama3.1-8b", + model: "llama3.1-8b", + contextLength: 8192, + }, + icon: "meta.png", + providerOptions: ["groq"], + isOpenSource: false, + }, + llama3170bChat: { + title: "Llama3.1 70b Chat", + description: "The latest Llama model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama3.1-70b", + model: "llama3.1-70b", + contextLength: 8192, + }, + icon: "meta.png", + providerOptions: ["groq"], + isOpenSource: false, + }, + llama31405bChat: { + title: "Llama3.1 405b Chat", + description: "The latest Llama model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama3.1-405b", + model: "llama3.1-405b", + contextLength: 8192, + }, + icon: "meta.png", + providerOptions: ["groq"], + isOpenSource: false, + }, llama270bChat: { title: "Llama2 70b Chat", description: "The latest Llama model from Meta, fine-tuned for chat", @@ -230,41 +389,6 @@ export const models: { [key: string]: ModelPackage } = { ], isOpenSource: true, }, - mistralOs: { - title: "Mistral", - description: - "A series of open-weight models created by Mistral AI, highly competent for code generation and other tasks", - params: { - title: "Mistral", - model: "mistral-7b", - contextLength: 4096, - }, - dimensions: [ - { - name: "Parameter Count", - description: "The number of parameters in the model", - options: { - "7b": { - model: "mistral-7b", - title: "Mistral-7b", - }, - "8x7b (MoE)": { - model: "mistral-8x7b", - title: "Mixtral", - }, - }, - }, - ], - icon: "mistral.png", - providerOptions: [ - "ollama", - "lmstudio", - "together", - "llama.cpp", - "replicate", - ], - isOpenSource: true, - }, codestral: { title: "Codestral", description: @@ -374,7 +498,7 @@ export const models: { [key: string]: ModelPackage } = { params: { title: "Gemini 1.5 Pro", model: "gemini-1.5-pro-latest", - contextLength: 1_000_000, + contextLength: 2_000_000, apiKey: "", }, icon: "gemini.png", @@ -395,39 +519,6 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["gemini"], isOpenSource: false, }, - deepseek: { - title: "DeepSeek-Coder", - description: - "A model pre-trained on 2 trillion tokens including 80+ programming languages and a repo-level corpus.", - params: { - title: "DeepSeek-7b", - model: "deepseek-7b", - contextLength: 4096, - }, - icon: "deepseek.png", - dimensions: [ - { - name: "Parameter Count", - description: "The number of parameters in the model", - options: { - "1b": { - model: "deepseek-1b", - title: "DeepSeek-1b", - }, - "7b": { - model: "deepseek-7b", - title: "DeepSeek-7b", - }, - "33b": { - model: "deepseek-33b", - title: "DeepSeek-33b", - }, - }, - }, - ], - providerOptions: ["ollama", "lmstudio", "llama.cpp"], - isOpenSource: true, - }, commandR: { title: "Command R", description: diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 975170f98..630b5de78 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -262,8 +262,9 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n }, ], packages: [ - models.llama370bChat, - models.llama38bChat, + models.llama31405bChat, + models.llama3170bChat, + models.llama318bChat, { ...models.mixtralTrial, title: "Mixtral" }, models.llama270bChat, { @@ -300,7 +301,7 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n ...completionParamsInputsConfigs, ], packages: [ - models.llama3Chat, + models.llama31Chat, models.codeLlamaInstruct, models.mistralOs, ].map((p) => { @@ -464,7 +465,8 @@ After it's up and running, you can start using Continue.`, icon: "openai.png", tags: [ModelProviderTags.Free], packages: [ - models.codellama70bTrial, + models.llama31405bTrial, + models.llama3170bTrial, { ...models.claude35Sonnet, title: "Claude 3.5 Sonnet (trial)" }, { ...models.gpt4o, title: "GPT-4o (trial)" }, { ...models.gpt35turbo, title: "GPT-3.5-Turbo (trial)" }, From 9fd9ebfb9ad827476f2e7268c008f2e370928461 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Wed, 24 Jul 2024 00:35:00 -0700 Subject: [PATCH 2/2] config loading (#1820) 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 * skip test failing only due to type error * fix: convert `walkDir` to an async generator (#1783) * walkdir to async generator * add yields * handle ignore files * Update CodebaseIndexer.ts * Update walkDir.ts * chore: bump VS Code ext version * fix completions support in ContinueProxy * add test for walkDir * IAnalyticsProvider * feat: crawl `.mdx` docs * update workspaces on session info change * rename from profile to workspace (user-facing) * update config schema files * feat: improve chat thread ui for better readability (#1786) * add "language" template variable for autocomplete * Enable debug logs (#1800) * Add an enableDebugLogs flag * Send logs to VSCode * Refresh index fixes (#1795) * Use the resultType given to markComplete This fixes an issue where if there were multiple result types in itemToAction such as an update with UpdateNewVersion and UpdateOldVersion, only the UpdateOldVersion would be hit (which is a noop) and the UpdateNewVersion would never be fired, causing us to never update the timestamp of the tag_catalog. * Add a Compute and UpdateLastUpdated to refreshIndex Removes the ability to insert duplicate rows if we're just computing the result. Instead we replace the existing row instead. * Don't insert compute tags They are REPLACEd in markComplete now. * docs: change page heading to model providers (#1684) * feat: allow JetBrains users to index docs (#1797) * feat: allow JetBrains users to index docs * update docs service * update global context * throw error popup on jetbrains + transformers * update toast notifications * update typings * fix tsc errors * Index on file change (#1785) * Reload the submenu items when the context provider data is refreshed * update version * Just call refreshSubmenuItems * remove log statements * cleanup * Remove the Promise declaration * Copy currentFiles to a new dict since we're going to mutate it Don't mutate the caller's currentFiles unexpectedly * Remove reIndexFile and just call index/forceReIndex * We MUST await the refreshCodebaseIndex call * Expose send on core * remove unused import * Reindex the workspaces on save * Call core.send Ideally, we can implement externalRequest on the webview later so we don't have to expose messenger to the VSCode extension * Always refreshSubmenuItems in refreshCodebaseIndex * whitespace * Change messenger back to private * Add Pause Codebase On Start setting (#1788) * Add a skipInitialSync function * Add pauseInitialCodebaseIndex * docs * version bump * Rename to pauseCodebaseIndexOnStart * Un-shadow file context provider (#1801) * allow FileContextProvider to handle files * remove commented-out lines * chore: add telemetry to alt-enter (#1805) * Set the indexProgress indicator to paused on startup if pauseCodebaseIndexOnStart is set (#1804) * Fix Input Toolbar layout (#1792) * set to flex flex-column * Remove fixed height and always show the StyledDivs content to hold its size * Add a Delete Message button to the StepContainer (#1790) * Add a delete button * add a delete message action to the GUI * Fix off by one error * format * This index should be less than length * Update to trash icon * Simplify walkDir(...) and improve performance by roughly 10x in larger repos (#1806) The performance of WalkDir is improved by replacing the recursive DFS with a stack based implementation (less memory in-use during peak exploration). In addition, some unnecessary flags and options were removed which allowed the code to be overall simplified. Much less rule matching is occuring with the same files returned. Some performance results on my linux host: small repo: - 649 files returned by walkDir() - 9 .gitignore files - walkDir() old vs new duration: 918 ms to 143 ms medium sized repo: - 9271 returned by walkDir() - 35 .gitignore files - walkDir() old vs new duration: 10,886 ms to 970ms large sized repo: - 197,900 files returned by walkDir() - 929 .gitignore files - walkDir() old vs new duration: 498,151 ms to 37,353 ms Co-authored-by: Rob Leidle * modified assistant indicator in UI * update package.json version * feat: add Llama 3.1 8B to cloudflare provider options (#1811) Co-authored-by: jdelorey@cloudflare.com * increase gemini pro contextLength (#1809) * fix indentation (#1808) * Llama 3.1 405b model selection (#1813) * add support for llama3 405b * 3.1 * name mapping * updates to model setup * fix walkDir tests on windows * chore: add docs as top level config (#1816) * chore: add docs as top level config * Update core.ts * feat: make @codebase a hardcoded ctx provider (#1818) * chore: add docs as top level config * Update core.ts * feat: make @codebase a hardcoded ctx provider * docs schema * Nate/dev (#1819) * llm-info package * small profile switching improvements * instruct cmd+I not to leave placeholders * @ files in context-providers docs * onboarding fix * jetbrains login * fix jetbrains login * change beta wording * proxy context provider * fix proxy context provider * revert to prod id, url * update package.json version --------- 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> Co-authored-by: Josh Vera Co-authored-by: Peter Zaback Co-authored-by: James Delorey Co-authored-by: jdelorey@cloudflare.com --- core/config/ConfigHandler.ts | 1 + core/config/load.ts | 46 +++- .../profile/ControlPlaneProfileLoader.ts | 60 +---- core/config/profile/LocalProfileLoader.ts | 40 +--- core/config/profile/doLoadConfig.ts | 69 ++++++ .../providers/ContinueProxyContextProvider.ts | 76 +++++++ core/context/providers/DocsContextProvider.ts | 9 +- core/context/providers/index.ts | 3 +- core/context/retrieval/retrieval.ts | 9 +- core/control-plane/auth/index.ts | 20 ++ core/control-plane/client.ts | 12 +- core/core.ts | 43 ++-- core/index.d.ts | 17 +- core/llm/llms/stubs/ContinueProxy.ts | 4 +- core/protocol/core.ts | 2 + core/util/paths.ts | 2 +- docs/static/schemas/config.json | 27 +++ eval/.gitignore | 1 + extensions/intellij/gradle.properties | 2 +- .../ContinuePluginStartupActivity.kt | 30 +++ .../auth/AuthListener.kt | 12 + .../auth/ContinueAuthDialog.kt | 34 +++ .../auth/ContinueAuthService.kt | 207 ++++++++++++++++++ .../continue/CoreMessenger.kt | 4 +- .../continue/IdeProtocolClient.kt | 23 +- .../ContinueExtensionSettingsService.kt | 21 +- .../toolWindow/ContinueBrowser.kt | 5 +- .../src/main/resources/config_schema.json | 27 +++ extensions/vscode/config_schema.json | 27 +++ extensions/vscode/continue_rc_schema.json | 30 +++ extensions/vscode/package.json | 2 +- .../vscode/src/stubs/WorkOsAuthProvider.ts | 3 +- gui/src/components/ProfileSwitcher.tsx | 6 +- .../components/modelSelection/ModelSelect.tsx | 5 +- gui/src/hooks/useSubmenuContextProviders.tsx | 5 +- packages/config-types/package.json | 2 +- packages/config-types/src/index.ts | 9 + 37 files changed, 742 insertions(+), 153 deletions(-) create mode 100644 core/config/profile/doLoadConfig.ts create mode 100644 core/context/providers/ContinueProxyContextProvider.ts create mode 100644 core/control-plane/auth/index.ts create mode 100644 eval/.gitignore create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/AuthListener.kt create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 64669f68d..1ac5dffde 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -177,6 +177,7 @@ export class ConfigHandler { const localProfileLoader = new LocalProfileLoader( ide, ideSettingsPromise, + controlPlaneClient, writeLog, ); this.profiles = [new ProfileLifecycleManager(localProfileLoader)]; diff --git a/core/config/load.ts b/core/config/load.ts index 3609fd241..992cd644b 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -36,6 +36,7 @@ import CustomLLMClass from "../llm/llms/CustomLLM.js"; import FreeTrial from "../llm/llms/FreeTrial.js"; import { llmFromDescription } from "../llm/llms/index.js"; +import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider.js"; import { fetchwithRequestOptions } from "../util/fetchWithOptions.js"; import { copyOf } from "../util/index.js"; import mergeJson from "../util/merge.js"; @@ -59,6 +60,8 @@ import { getPromptFiles, slashCommandFromPromptFile, } from "./promptFile.js"; +import CodebaseContextProvider from "../context/providers/CodebaseContextProvider.js"; + const { execSync } = require("child_process"); function resolveSerializedConfig(filepath: string): SerializedContinueConfig { @@ -94,13 +97,16 @@ function loadSerializedConfig( workspaceConfigs: ContinueRcJson[], ideSettings: IdeSettings, ideType: IdeType, + overrideConfigJson: SerializedContinueConfig | undefined, ): SerializedContinueConfig { const configPath = getConfigJsonPath(ideType); - let config: SerializedContinueConfig; - try { - config = resolveSerializedConfig(configPath); - } catch (e) { - throw new Error(`Failed to parse config.json: ${e}`); + let config: SerializedContinueConfig = overrideConfigJson!; + if (!config) { + try { + config = resolveSerializedConfig(configPath); + } catch (e) { + throw new Error(`Failed to parse config.json: ${e}`); + } } if (config.allowAnonymousTelemetry === undefined) { @@ -210,6 +216,7 @@ async function intermediateToFinalConfig( ideSettings: IdeSettings, uniqueId: string, writeLog: (log: string) => Promise, + workOsAccessToken: string | undefined, allowFreeTrial: boolean = true, ): Promise { // Auto-detect models @@ -347,8 +354,15 @@ async function intermediateToFinalConfig( ).filter((x) => x !== undefined) as BaseLLM[]; } + // These context providers are always included, regardless of what, if anything, + // the user has configured in config.json + const DEFAULT_CONTEXT_PROVIDERS = [ + new FileContextProvider({}), + new CodebaseContextProvider({}), + ]; + // Context providers - const contextProviders: IContextProvider[] = [new FileContextProvider({})]; + const contextProviders: IContextProvider[] = DEFAULT_CONTEXT_PROVIDERS; for (const provider of config.contextProviders || []) { if (isContextProviderWithParams(provider)) { const cls = contextProviderClassFromName(provider.name) as any; @@ -356,7 +370,15 @@ async function intermediateToFinalConfig( console.warn(`Unknown context provider ${provider.name}`); continue; } - contextProviders.push(new cls(provider.params)); + const instance: IContextProvider = new cls(provider.params); + + // Handle continue-proxy + if (instance.description.title === "continue-proxy") { + (instance as ContinueProxyContextProvider).workOsAccessToken = + workOsAccessToken; + } + + contextProviders.push(instance); } else { contextProviders.push(new CustomContextProviderClass(provider)); } @@ -536,9 +558,16 @@ async function loadFullConfigNode( ideType: IdeType, uniqueId: string, writeLog: (log: string) => Promise, + workOsAccessToken: string | undefined, + overrideConfigJson: SerializedContinueConfig | undefined, ): Promise { // Serialized config - let serialized = loadSerializedConfig(workspaceConfigs, ideSettings, ideType); + let serialized = loadSerializedConfig( + workspaceConfigs, + ideSettings, + ideType, + overrideConfigJson, + ); // Convert serialized to intermediate config let intermediate = await serializedToIntermediateConfig(serialized, ide); @@ -584,6 +613,7 @@ async function loadFullConfigNode( ideSettings, uniqueId, writeLog, + workOsAccessToken, ); return finalConfig; } diff --git a/core/config/profile/ControlPlaneProfileLoader.ts b/core/config/profile/ControlPlaneProfileLoader.ts index e8a2762a5..0602088bd 100644 --- a/core/config/profile/ControlPlaneProfileLoader.ts +++ b/core/config/profile/ControlPlaneProfileLoader.ts @@ -6,20 +6,8 @@ import { SerializedContinueConfig, } from "../.."; import { ControlPlaneClient } from "../../control-plane/client"; -import { TeamAnalytics } from "../../control-plane/TeamAnalytics"; -import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; -import { Telemetry } from "../../util/posthog"; -import { - defaultContextProvidersJetBrains, - defaultContextProvidersVsCode, - defaultSlashCommandsJetBrains, - defaultSlashCommandsVscode, -} from "../default"; -import { - intermediateToFinalConfig, - serializedToIntermediateConfig, -} from "../load"; import { IProfileLoader } from "./IProfileLoader"; +import doLoadConfig from "./doLoadConfig"; export default class ControlPlaneProfileLoader implements IProfileLoader { private static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes @@ -49,58 +37,20 @@ export default class ControlPlaneProfileLoader implements IProfileLoader { } async doLoadConfig(): Promise { - const ideInfo = await this.ide.getIdeInfo(); const settings = this.workspaceSettings ?? ((await this.controlPlaneClient.getSettingsForWorkspace( this.profileId, )) as any); - - // First construct a SerializedContinueConfig from the ControlPlaneSettings (TODO) const serializedConfig: SerializedContinueConfig = settings; - serializedConfig.contextProviders ??= - ideInfo.ideType === "vscode" - ? defaultContextProvidersVsCode - : defaultContextProvidersJetBrains; - serializedConfig.slashCommands ??= - ideInfo.ideType === "vscode" - ? defaultSlashCommandsVscode - : defaultSlashCommandsJetBrains; - - const intermediateConfig = await serializedToIntermediateConfig( - serializedConfig, + return doLoadConfig( this.ide, - ); - - const uniqueId = await this.ide.getUniqueId(); - const finalConfig = await intermediateToFinalConfig( - intermediateConfig, - this.ide, - await this.ideSettingsPromise, - uniqueId, + this.ideSettingsPromise, + this.controlPlaneClient, this.writeLog, + serializedConfig, ); - - // Set up team analytics/telemetry - await Telemetry.setup(true, uniqueId, ideInfo.extensionVersion); - await TeamAnalytics.setup( - settings.analytics, - uniqueId, - ideInfo.extensionVersion, - ); - - [ - ...finalConfig.models, - ...(finalConfig.tabAutocompleteModels ?? []), - ].forEach(async (model) => { - if (model.providerName === "continue-proxy") { - const accessToken = await this.controlPlaneClient.getAccessToken(); - (model as ContinueProxy).workOsAccessToken = accessToken; - } - }); - - return finalConfig; } setIsActive(isActive: boolean): void {} diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index ec6fba189..a79406d49 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -1,6 +1,6 @@ -import { ContinueConfig, ContinueRcJson, IDE, IdeSettings } from "../.."; -import { Telemetry } from "../../util/posthog"; -import { loadFullConfigNode } from "../load"; +import { ContinueConfig, IDE, IdeSettings } from "../.."; +import { ControlPlaneClient } from "../../control-plane/client"; +import doLoadConfig from "./doLoadConfig"; import { IProfileLoader } from "./IProfileLoader"; export default class LocalProfileLoader implements IProfileLoader { @@ -11,42 +11,18 @@ export default class LocalProfileLoader implements IProfileLoader { constructor( private ide: IDE, private ideSettingsPromise: Promise, - // private controlPlaneClient: ControlPlaneClient, + private controlPlaneClient: ControlPlaneClient, private writeLog: (message: string) => Promise, ) {} async doLoadConfig(): Promise { - let workspaceConfigs: ContinueRcJson[] = []; - try { - workspaceConfigs = await this.ide.getWorkspaceConfigs(); - } catch (e) { - console.warn("Failed to load workspace configs"); - } - - const ideInfo = await this.ide.getIdeInfo(); - const uniqueId = await this.ide.getUniqueId(); - const ideSettings = await this.ideSettingsPromise; - - const newConfig = await loadFullConfigNode( + return doLoadConfig( this.ide, - workspaceConfigs, - ideSettings, - ideInfo.ideType, - uniqueId, + this.ideSettingsPromise, + this.controlPlaneClient, this.writeLog, + undefined, ); - newConfig.allowAnonymousTelemetry = - newConfig.allowAnonymousTelemetry && - (await this.ide.isTelemetryEnabled()); - - // Setup telemetry only after (and if) we know it is enabled - await Telemetry.setup( - newConfig.allowAnonymousTelemetry ?? true, - await this.ide.getUniqueId(), - ideInfo.extensionVersion, - ); - - return newConfig; } setIsActive(isActive: boolean): void {} diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts new file mode 100644 index 000000000..35f7bdf25 --- /dev/null +++ b/core/config/profile/doLoadConfig.ts @@ -0,0 +1,69 @@ +import { + ContinueRcJson, + IDE, + IdeSettings, + SerializedContinueConfig, +} from "../.."; +import { ControlPlaneClient } from "../../control-plane/client"; +import { TeamAnalytics } from "../../control-plane/TeamAnalytics"; +import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; +import { Telemetry } from "../../util/posthog"; +import { loadFullConfigNode } from "../load"; + +export default async function doLoadConfig( + ide: IDE, + ideSettingsPromise: Promise, + controlPlaneClient: ControlPlaneClient, + writeLog: (message: string) => Promise, + overrideConfigJson: SerializedContinueConfig | undefined, +) { + let workspaceConfigs: ContinueRcJson[] = []; + try { + workspaceConfigs = await ide.getWorkspaceConfigs(); + } catch (e) { + console.warn("Failed to load workspace configs"); + } + + const ideInfo = await ide.getIdeInfo(); + const uniqueId = await ide.getUniqueId(); + const ideSettings = await ideSettingsPromise; + const workOsAccessToken = await controlPlaneClient.getAccessToken(); + + const newConfig = await loadFullConfigNode( + ide, + workspaceConfigs, + ideSettings, + ideInfo.ideType, + uniqueId, + writeLog, + workOsAccessToken, + overrideConfigJson, + ); + newConfig.allowAnonymousTelemetry = + newConfig.allowAnonymousTelemetry && (await ide.isTelemetryEnabled()); + + // Setup telemetry only after (and if) we know it is enabled + await Telemetry.setup( + newConfig.allowAnonymousTelemetry ?? true, + await ide.getUniqueId(), + ideInfo.extensionVersion, + ); + + if (newConfig.analytics) { + await TeamAnalytics.setup( + newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all + uniqueId, + ideInfo.extensionVersion, + ); + } + + [...newConfig.models, ...(newConfig.tabAutocompleteModels ?? [])].forEach( + async (model) => { + if (model.providerName === "continue-proxy") { + (model as ContinueProxy).workOsAccessToken = workOsAccessToken; + } + }, + ); + + return newConfig; +} diff --git a/core/context/providers/ContinueProxyContextProvider.ts b/core/context/providers/ContinueProxyContextProvider.ts new file mode 100644 index 000000000..dc1c9ef22 --- /dev/null +++ b/core/context/providers/ContinueProxyContextProvider.ts @@ -0,0 +1,76 @@ +import { CONTROL_PLANE_URL } from "../../control-plane/client.js"; +import { + ContextItem, + ContextProviderDescription, + ContextProviderExtras, + ContextSubmenuItem, + LoadSubmenuItemsArgs, +} from "../../index.js"; +import { BaseContextProvider } from "../index.js"; + +class ContinueProxyContextProvider extends BaseContextProvider { + static description: ContextProviderDescription = { + title: "continue-proxy", + displayTitle: "Continue Proxy", + description: "Retrieve a context item from a Continue for Teams add-on", + type: "submenu", + }; + + workOsAccessToken: string | undefined = undefined; + + override get description(): ContextProviderDescription { + return { + title: + this.options.title || ContinueProxyContextProvider.description.title, + displayTitle: + this.options.displayTitle || + ContinueProxyContextProvider.description.displayTitle, + description: + this.options.description || + ContinueProxyContextProvider.description.description, + type: this.options.type || ContinueProxyContextProvider.description.type, + }; + } + + async loadSubmenuItems( + args: LoadSubmenuItemsArgs, + ): Promise { + const response = await args.fetch( + new URL(`/proxy/context/${this.options.id}/list`, CONTROL_PLANE_URL), + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.workOsAccessToken}`, + }, + }, + ); + const data = await response.json(); + return data.items; + } + + async getContextItems( + query: string, + extras: ContextProviderExtras, + ): Promise { + const response = await extras.fetch( + new URL(`/proxy/context/${this.options.id}/retrieve`, CONTROL_PLANE_URL), + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.workOsAccessToken}`, + }, + body: JSON.stringify({ + query: query || "", + fullInput: extras.fullInput, + }), + }, + ); + + const items: any = await response.json(); + return items; + } +} + +export default ContinueProxyContextProvider; diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index c79ee4885..c2c6af7f0 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -157,7 +157,10 @@ class DocsContextProvider extends BaseContextProvider { name: "Instructions", description: "Instructions", content: - "Use the above documentation to answer the following question. You should not reference anything outside of what is shown, unless it is a commonly known concept. Reference URLs whenever possible using markdown formatting. If there isn't enough information to answer the question, suggest where the user might look to learn more.", + "Use the above documentation to answer the following question. You should not reference " + + "anything outside of what is shown, unless it is a commonly known concept. Reference URLs " + + "whenever possible using markdown formatting. If there isn't enough information to answer " + + "the question, suggest where the user might look to learn more.", }, ]; } @@ -167,7 +170,9 @@ class DocsContextProvider extends BaseContextProvider { ): Promise { const ideInfo = await args.ide.getIdeInfo(); const isJetBrains = ideInfo.ideType === "jetbrains"; - const configSites = this.options?.sites || []; + const configSites = [ + ...new Set([...(this.options?.sites || []), ...(args.config.docs || [])]), + ]; const submenuItemsMap = new Map(); if (!isJetBrains) { diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index ac1d0431a..462fe0db4 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -2,6 +2,7 @@ import { ContextProviderName } from "../../index.js"; import { BaseContextProvider } from "../index.js"; import CodeContextProvider from "./CodeContextProvider.js"; import CodebaseContextProvider from "./CodebaseContextProvider.js"; +import ContinueProxyContextProvider from "./ContinueProxyContextProvider.js"; import CurrentFileContextProvider from "./CurrentFileContextProvider.js"; import DatabaseContextProvider from "./DatabaseContextProvider.js"; import DiffContextProvider from "./DiffContextProvider.js"; @@ -40,7 +41,6 @@ const Providers: (typeof BaseContextProvider)[] = [ HttpContextProvider, SearchContextProvider, OSContextProvider, - CodebaseContextProvider, ProblemsContextProvider, FolderContextProvider, DocsContextProvider, @@ -51,6 +51,7 @@ const Providers: (typeof BaseContextProvider)[] = [ CodeContextProvider, CurrentFileContextProvider, URLContextProvider, + ContinueProxyContextProvider, ]; export function contextProviderClassFromName( diff --git a/core/context/retrieval/retrieval.ts b/core/context/retrieval/retrieval.ts index 3d7f08383..e6ff30e17 100644 --- a/core/context/retrieval/retrieval.ts +++ b/core/context/retrieval/retrieval.ts @@ -24,7 +24,10 @@ export async function retrieveContextItemsFromEmbeddings( (await extras.ide.getIdeInfo()).ideType === "jetbrains" ) { throw new Error( - "The transformers.js context provider is not currently supported in JetBrains. For now, you can use Ollama to set up local embeddings, or use our 'free-trial' embeddings provider. See here to learn more: https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers", + "The transformers.js context provider is not currently supported in JetBrains. " + + "For now, you can use Ollama to set up local embeddings, or use our 'free-trial' " + + "embeddings provider. See here to learn more: " + + "https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers", ); } @@ -81,7 +84,9 @@ export async function retrieveContextItemsFromEmbeddings( return [ ...results.map((r) => { - const name = `${getRelativePath(r.filepath, workspaceDirs)} (${r.startLine}-${r.endLine})`; + const name = `${getRelativePath(r.filepath, workspaceDirs)} (${ + r.startLine + }-${r.endLine})`; const description = `${r.filepath} (${r.startLine}-${r.endLine})`; return { name, diff --git a/core/control-plane/auth/index.ts b/core/control-plane/auth/index.ts new file mode 100644 index 000000000..ecb6221c7 --- /dev/null +++ b/core/control-plane/auth/index.ts @@ -0,0 +1,20 @@ +import { v4 as uuidv4 } from "uuid"; + +const CLIENT_ID = "client_01J0FW6XN8N2XJAECF7NE0Y65J"; +// const CLIENT_ID = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ"; // Staging + +export async function getAuthUrlForTokenPage(): Promise { + const url = new URL("https://api.workos.com/user_management/authorize"); + const params = { + response_type: "code", + client_id: CLIENT_ID, + redirect_uri: "https://app.continue.dev/tokens/callback", + // redirect_uri: "http://localhost:3000/tokens/callback", + state: uuidv4(), + provider: "authkit", + }; + Object.keys(params).forEach((key) => + url.searchParams.append(key, params[key as keyof typeof params]), + ); + return url.toString(); +} diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index f254d13d0..616f9edbf 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -72,10 +72,14 @@ export class ControlPlaneClient { return []; } - const resp = await this.request(`/workspaces`, { - method: "GET", - }); - return (await resp.json()) as any; + try { + const resp = await this.request(`/workspaces`, { + method: "GET", + }); + return (await resp.json()) as any; + } catch (e) { + return []; + } } async getSettingsForWorkspace(workspaceId: string): Promise { diff --git a/core/core.ts b/core/core.ts index 5cf32478e..f247914fe 100644 --- a/core/core.ts +++ b/core/core.ts @@ -17,10 +17,10 @@ import { import { createNewPromptFile } from "./config/promptFile.js"; import { addModel, addOpenAIKey, deleteModel } from "./config/util.js"; import { ContinueServerClient } from "./continueServer/stubs/client.js"; -import { ControlPlaneClient } from "./control-plane/client.js"; +import { getAuthUrlForTokenPage } from "./control-plane/auth"; +import { ControlPlaneClient } from "./control-plane/client"; import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer.js"; import { DocsService } from "./indexing/docs/DocsService.js"; -import TransformersJsEmbeddingsProvider from "./indexing/embeddings/TransformersJsEmbeddingsProvider.js"; import Ollama from "./llm/llms/Ollama.js"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import { GlobalContext } from "./util/GlobalContext.js"; @@ -143,21 +143,19 @@ export class Core { ); // Index on initialization - this.ide - .getWorkspaceDirs() - .then(async (dirs) => { - // Respect pauseCodebaseIndexOnStart user settings - if (ideSettings.pauseCodebaseIndexOnStart) { - await this.messenger.request("indexProgress", { - progress: 100, - desc: "Initial Indexing Skipped", - status: "paused", - }); - return; - } + this.ide.getWorkspaceDirs().then(async (dirs) => { + // Respect pauseCodebaseIndexOnStart user settings + if (ideSettings.pauseCodebaseIndexOnStart) { + await this.messenger.request("indexProgress", { + progress: 100, + desc: "Initial Indexing Skipped", + status: "paused", + }); + return; + } - this.refreshCodebaseIndex(dirs); - }); + this.refreshCodebaseIndex(dirs); + }); }); const getLlm = async () => { @@ -280,8 +278,12 @@ export class Core { return; } - const siteIndexingOptions: SiteIndexingConfig[] = ((mProvider) => - mProvider?.options?.sites || [])({ ...provider }); + const siteIndexingOptions: SiteIndexingConfig[] = ((mProvider) => [ + ...new Set([ + ...(mProvider?.options?.sites || []), + ...(config.docs || []), + ]), + ])({ ...provider }); for (const site of siteIndexingOptions) { await this.getEmbeddingsProviderAndIndexDoc(site, msg.data.reIndex); @@ -294,6 +296,7 @@ export class Core { const items = config.contextProviders ?.find((provider) => provider.description.title === msg.data.title) ?.loadSubmenuItems({ + config, ide: this.ide, fetch: (url, init) => fetchwithRequestOptions(url, init, config.requestOptions), @@ -656,6 +659,10 @@ export class Core { on("didChangeControlPlaneSessionInfo", async (msg) => { this.configHandler.updateControlPlaneSessionInfo(msg.data.sessionInfo); }); + on("auth/getAuthUrl", async (msg) => { + const url = await getAuthUrlForTokenPage(); + return { url }; + }); } private indexingCancellationController: AbortController | undefined; diff --git a/core/index.d.ts b/core/index.d.ts index bd8f99401..d8cfe8dba 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -137,6 +137,7 @@ export interface ContextProviderExtras { } export interface LoadSubmenuItemsArgs { + config: ContinueConfig; ide: IDE; fetch: FetchFunction; } @@ -422,8 +423,8 @@ export interface IdeSettings { remoteConfigSyncPeriod: number; userToken: string; enableControlServerBeta: boolean; - pauseCodebaseIndexOnStart: boolean - enableDebugLogs: boolean + pauseCodebaseIndexOnStart: boolean; + enableDebugLogs: boolean; } export interface IDE { @@ -858,6 +859,12 @@ interface ExperimentalConfig { quickActions?: QuickActionConfig[]; } +interface AnalyticsConfig { + type: string; + url?: string; + clientKey?: string; +} + // config.json export interface SerializedContinueConfig { env?: string[]; @@ -878,6 +885,7 @@ export interface SerializedContinueConfig { ui?: ContinueUIConfig; reranker?: RerankerDescription; experimental?: ExperimentalConfig; + analytics?: AnalyticsConfig; } export type ConfigMergeType = "merge" | "overwrite"; @@ -928,6 +936,8 @@ export interface Config { reranker?: RerankerDescription | Reranker; /** Experimental configuration */ experimental?: ExperimentalConfig; + /** Analytics configuration */ + analytics?: AnalyticsConfig; } // in the actual Continue source code @@ -948,6 +958,8 @@ export interface ContinueConfig { ui?: ContinueUIConfig; reranker?: Reranker; experimental?: ExperimentalConfig; + analytics?: AnalyticsConfig; + docs?: SiteIndexingConfig[]; } export interface BrowserSerializedContinueConfig { @@ -965,4 +977,5 @@ export interface BrowserSerializedContinueConfig { ui?: ContinueUIConfig; reranker?: RerankerDescription; experimental?: ExperimentalConfig; + analytics?: AnalyticsConfig; } diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 99eba5f73..3049abc3b 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -1,4 +1,5 @@ import type { LLMOptions, ModelProvider } from "../../.."; +import { CONTROL_PLANE_URL } from "../../../control-plane/client"; import OpenAI from "../OpenAI.js"; class ContinueProxy extends OpenAI { @@ -16,8 +17,7 @@ class ContinueProxy extends OpenAI { } static providerName: ModelProvider = "continue-proxy"; static defaultOptions: Partial = { - apiBase: - "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/model-proxy/v1", + apiBase: new URL("/model-proxy/v1", CONTROL_PLANE_URL).toString(), useLegacyCompletionsEndpoint: false, }; diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 3ccc7ed16..aa43bdd09 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -147,4 +147,6 @@ export type ToCoreFromIdeOrWebviewProtocol = { addAutocompleteModel: [{ model: ModelDescription }, void]; "profiles/switch": [{ id: string }, undefined]; + + "auth/getAuthUrl": [undefined, { url: string }]; }; diff --git a/core/util/paths.ts b/core/util/paths.ts index 1e8a5d772..cec9b0a95 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -205,7 +205,7 @@ export async function migrate( if (!fs.existsSync(migrationPath)) { try { - await callback(); + await Promise.resolve(callback()); fs.writeFileSync(migrationPath, ""); } catch (e) { console.warn(`Migration ${id} failed`, e); diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 3cc82db36..868018a01 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1828,6 +1828,33 @@ "title": "config.json", "type": "object", "properties": { + "docs": { + "title": "Docs", + "description": "A list of documentation sites to be indexed", + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "The title of the documentation site" + }, + "startUrl": { + "type": "string", + "description": "The starting URL for indexing the documentation" + }, + "rootUrl": { + "type": "string", + "description": "The root URL of the documentation site" + }, + "maxDepth": { + "type": "integer", + "description": "The maximum depth to crawl the documentation site" + } + }, + "required": ["title", "startUrl"] + } + }, "allowAnonymousTelemetry": { "title": "Allow Anonymous Telemetry", "markdownDescription": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to `false`, we will not collect any data. Learn more in [the docs](https://docs.continue.dev/telemetry).", diff --git a/eval/.gitignore b/eval/.gitignore new file mode 100644 index 000000000..2a31c3eee --- /dev/null +++ b/eval/.gitignore @@ -0,0 +1 @@ +repos \ No newline at end of file diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index caf2e7e8c..d131d7c37 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension pluginName = continue-intellij-extension pluginRepositoryUrl = https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion = 0.0.55 +pluginVersion = 0.0.56 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index 4a785a4d8..444a4d397 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -1,5 +1,8 @@ package com.github.continuedev.continueintellijextension.activities +import com.github.continuedev.continueintellijextension.auth.AuthListener +import com.github.continuedev.continueintellijextension.auth.ContinueAuthService +import com.github.continuedev.continueintellijextension.auth.ControlPlaneSessionInfo import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath import com.github.continuedev.continueintellijextension.`continue`.* import com.github.continuedev.continueintellijextension.listeners.ContinuePluginSelectionListener @@ -25,6 +28,7 @@ import java.nio.file.Files import java.nio.file.Paths import javax.swing.* import com.intellij.ide.plugins.PluginManager +import com.intellij.openapi.components.service import com.intellij.openapi.extensions.PluginId fun showTutorial(project: Project) { @@ -126,6 +130,32 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware { } }) + // Listen for clicking settings button to start the auth flow + val authService = service() + val initialSessionInfo = authService.loadControlPlaneSessionInfo() + + if (initialSessionInfo != null) { + val data = mapOf( + "sessionInfo" to initialSessionInfo + ) + continuePluginService.coreMessenger?.request("didChangeControlPlaneSessionInfo", data, null) { _ -> } + continuePluginService.sendToWebview("didChangeControlPlaneSessionInfo", data) + } + + connection.subscribe(AuthListener.TOPIC, object : AuthListener { + override fun startAuthFlow() { + authService.startAuthFlow(project) + } + + override fun handleUpdatedSessionInfo(sessionInfo: ControlPlaneSessionInfo?) { + val data = mapOf( + "sessionInfo" to sessionInfo + ) + continuePluginService.coreMessenger?.request("didChangeControlPlaneSessionInfo", data, null) { _ -> } + continuePluginService.sendToWebview("didChangeControlPlaneSessionInfo", data) + } + }) + GlobalScope.async(Dispatchers.IO) { val listener = ContinuePluginSelectionListener( diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/AuthListener.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/AuthListener.kt new file mode 100644 index 000000000..b6449936c --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/AuthListener.kt @@ -0,0 +1,12 @@ +package com.github.continuedev.continueintellijextension.auth +import com.intellij.util.messages.Topic + +interface AuthListener { + fun startAuthFlow() + + fun handleUpdatedSessionInfo(sessionInfo: ControlPlaneSessionInfo?) + + companion object { + val TOPIC = Topic.create("StartAuthFlow", AuthListener::class.java) + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt new file mode 100644 index 000000000..7197bf348 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt @@ -0,0 +1,34 @@ +package com.github.continuedev.continueintellijextension.auth + +import com.intellij.openapi.ui.DialogWrapper +import com.intellij.ui.components.JBLabel +import com.intellij.ui.components.JBTextField +import javax.swing.JComponent +import javax.swing.JPanel +import java.awt.BorderLayout + +class ContinueAuthDialog(private val onTokenEntered: (String) -> Unit) : DialogWrapper(true) { + private val tokenField = JBTextField() + + init { + init() + title = "Enter Continue Authentication Token" + } + + override fun createCenterPanel(): JComponent { + val panel = JPanel(BorderLayout()) + panel.add(JBLabel("Please enter your Continue authentication token:"), BorderLayout.NORTH) + panel.add(tokenField, BorderLayout.CENTER) + return panel + } + + override fun doOKAction() { + val token = tokenField.text + if (token.isNotBlank()) { + onTokenEntered(token) + super.doOKAction() + } else { + setErrorText("Please enter a valid token") + } + } +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt new file mode 100644 index 000000000..29a294c8b --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt @@ -0,0 +1,207 @@ +package com.github.continuedev.continueintellijextension.auth + +import com.github.continuedev.continueintellijextension.services.ContinuePluginService +import com.intellij.credentialStore.Credentials +import com.intellij.ide.passwordSafe.PasswordSafe +import com.intellij.ide.util.PropertiesComponent +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.Service +import com.intellij.openapi.components.service +import com.intellij.openapi.project.Project +import com.intellij.remoteServer.util.CloudConfigurationUtil.createCredentialAttributes +import java.awt.Desktop +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import net.minidev.json.JSONObject +import okhttp3.MediaType.Companion.toMediaType +import okhttp3.OkHttpClient +import okhttp3.Request +import okhttp3.RequestBody.Companion.toRequestBody +import java.net.URL + +@Service +class ContinueAuthService { + companion object { + fun getInstance(): ContinueAuthService = service() + private const val CREDENTIALS_USER = "ContinueAuthUser" + private const val ACCESS_TOKEN_KEY = "ContinueAccessToken" + private const val REFRESH_TOKEN_KEY = "ContinueRefreshToken" + private const val ACCOUNT_ID_KEY = "ContinueAccountId" + private const val ACCOUNT_LABEL_KEY = "ContinueAccountLabel" + private const val CONTROL_PLANE_URL = "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app" +// private const val CONTROL_PLANE_URL = "http://localhost:3001" + } + + fun startAuthFlow(project: Project) { + // Open login page + openSignInPage(project) + + // Open a dialog where the user should paste their sign-in token + com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater { + val dialog = ContinueAuthDialog() { token -> + // Store the token + handleNewRefreshToken(token) + } + dialog.show() + } + } + + fun signOut() { + // Clear the stored tokens + setAccessToken("") + setRefreshToken("") + setAccountId("") + setAccountLabel("") + } + + private fun handleNewRefreshToken(token: String) { + // Launch a coroutine to call the suspend function + kotlinx.coroutines.GlobalScope.launch { + try { + val response = refreshToken(token) + val accessToken = response["accessToken"] as? String + val refreshToken = response["refreshToken"] as? String + val user = response["user"] as? Map<*, *> + val firstName = user?.get("firstName") as? String + val lastName = user?.get("lastName") as? String + val label = "$firstName $lastName" + val id = user?.get("id") as? String + + // Persist the session info + setRefreshToken(refreshToken!!) + val sessionInfo = ControlPlaneSessionInfo(accessToken!!, ControlPlaneSessionInfo.Account(id!!, label)) + setControlPlaneSessionInfo(sessionInfo) + + // Notify listeners + ApplicationManager.getApplication().messageBus.syncPublisher(AuthListener.TOPIC).handleUpdatedSessionInfo(sessionInfo) + + } catch (e: Exception) { + // Handle any exceptions + println("Exception while refreshing token: ${e.message}") + } + } + } + + private suspend fun refreshToken(refreshToken: String) = withContext(Dispatchers.IO) { + val client = OkHttpClient() + val url = URL(CONTROL_PLANE_URL).toURI().resolve("/auth/refresh").toURL() + val jsonBody = JSONObject().apply { + put("refreshToken", refreshToken) + } + + val requestBody = jsonBody.toString().toRequestBody("application/json".toMediaType()) + + val request = Request.Builder() + .url(url) + .post(requestBody) + .header("Content-Type", "application/json") + .build() + + val response = client.newCall(request).execute() + + val responseBody = response.body?.string() + val gson = com.google.gson.Gson() + val responseMap = gson.fromJson(responseBody, Map::class.java) + + responseMap + } + + + private fun openSignInPage(project: Project) { + val coreMessenger = project.service().coreMessenger + coreMessenger?.request("auth/getAuthUrl", null, null) { response -> + val authUrl = (response as? Map<*, *>)?.get("url") as? String + if (authUrl != null) { + // Open the auth URL in the browser + Desktop.getDesktop().browse(java.net.URI(authUrl)) + } + } + } + + private fun retrieveSecret(key: String): String? { + val attributes = createCredentialAttributes(key, CREDENTIALS_USER) + val passwordSafe: PasswordSafe = PasswordSafe.instance + + val credentials: Credentials? = passwordSafe[attributes!!] + return credentials?.getPasswordAsString() + } + + private fun storeSecret(key: String, secret: String) { + val attributes = createCredentialAttributes(key, CREDENTIALS_USER) + val passwordSafe: PasswordSafe = PasswordSafe.instance + + val credentials = Credentials(CREDENTIALS_USER, secret) + passwordSafe.set(attributes!!, credentials) + } + + private fun getAccessToken(): String? { + return retrieveSecret(ACCESS_TOKEN_KEY) + } + + private fun setAccessToken(token: String) { + storeSecret(ACCESS_TOKEN_KEY, token) + } + + private fun getRefreshToken(): String? { + return retrieveSecret(REFRESH_TOKEN_KEY) + } + + private fun setRefreshToken(token: String) { + storeSecret(REFRESH_TOKEN_KEY, token) + } + + fun getAccountId(): String? { + return PropertiesComponent.getInstance().getValue(ACCOUNT_ID_KEY) + } + + fun setAccountId(id: String) { + PropertiesComponent.getInstance().setValue(ACCOUNT_ID_KEY, id) + } + + fun getAccountLabel(): String? { + return PropertiesComponent.getInstance().getValue(ACCOUNT_LABEL_KEY) + } + + fun setAccountLabel(label: String) { + PropertiesComponent.getInstance().setValue(ACCOUNT_LABEL_KEY, label) + } + + // New method to load all info as an object + fun loadControlPlaneSessionInfo(): ControlPlaneSessionInfo? { + val accessToken = getAccessToken() + val accountId = getAccountId() + val accountLabel = getAccountLabel() + + return if (accessToken != null && accountId != null && accountLabel != null) { + ControlPlaneSessionInfo( + accessToken = accessToken, + account = ControlPlaneSessionInfo.Account( + id = accountId, + label = accountLabel + ) + ) + } else { + null + } + } + + // New method to set all info from a ControlPlaneSessionInfo object + fun setControlPlaneSessionInfo(info: ControlPlaneSessionInfo) { + setAccessToken(info.accessToken) + setAccountId(info.account.id) + setAccountLabel(info.account.label) + } + +} + +// Data class to represent the ControlPlaneSessionInfo +data class ControlPlaneSessionInfo( + val accessToken: String, + val account: Account +) { + data class Account( + val id: String, + val label: String + ) +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt index 505a53bbd..ded887c76 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt @@ -147,7 +147,9 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC "applyToFile", "getGitHubAuthToken", "setGitHubAuthToken", - "pathSep" + "pathSep", + "getControlPlaneSessionInfo", + "logoutOfControlPlane" ) private val PASS_THROUGH_TO_WEBVIEW = listOf( diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt index c999cfcab..e8aa27b6c 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt @@ -1,6 +1,8 @@ package com.github.continuedev.continueintellijextension.`continue` import com.github.continuedev.continueintellijextension.* +import com.github.continuedev.continueintellijextension.auth.AuthListener +import com.github.continuedev.continueintellijextension.auth.ContinueAuthService import com.github.continuedev.continueintellijextension.constants.* import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService @@ -232,9 +234,28 @@ class IdeProtocolClient ( respond(mapOf( "remoteConfigServerUrl" to settings.continueState.remoteConfigServerUrl, "remoteConfigSyncPeriod" to settings.continueState.remoteConfigSyncPeriod, - "userToken" to settings.continueState.userToken + "userToken" to settings.continueState.userToken, + "enableControlServerBeta" to settings.continueState.enableContinueTeamsBeta )) } + "getControlPlaneSessionInfo" -> { + val silent = (data as? Map)?.get("silent") as? Boolean ?: false + + val authService = service() + if (silent) { + val sessionInfo = authService.loadControlPlaneSessionInfo() + respond(sessionInfo) + } else { + authService.startAuthFlow(project) + respond(null) + } + } + "logoutOfControlPlane" -> { + val authService = service() + authService.signOut() + ApplicationManager.getApplication().messageBus.syncPublisher(AuthListener.TOPIC).handleUpdatedSessionInfo(null) + respond(null) + } "getIdeInfo" -> { val applicationInfo = ApplicationInfo.getInstance() val ideName: String = applicationInfo.fullApplicationName diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt index 748796d4c..6ff8277a5 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt @@ -1,20 +1,13 @@ package com.github.continuedev.continueintellijextension.services import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.PersistentStateComponent -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.components.State -import com.intellij.openapi.components.Storage +import com.intellij.openapi.components.* import com.intellij.openapi.options.Configurable import com.intellij.openapi.project.DumbAware import com.intellij.util.messages.Topic import java.awt.GridBagConstraints import java.awt.GridBagLayout -import javax.swing.JCheckBox -import javax.swing.JComponent -import javax.swing.JLabel -import javax.swing.JPanel -import javax.swing.JTextField +import javax.swing.* class ContinueSettingsComponent: DumbAware { val panel: JPanel = JPanel(GridBagLayout()) @@ -22,6 +15,7 @@ class ContinueSettingsComponent: DumbAware { val remoteConfigSyncPeriod: JTextField = JTextField() val userToken: JTextField = JTextField() val enableTabAutocomplete: JCheckBox = JCheckBox("Enable Tab Autocomplete") + val enableContinueTeamsBeta: JCheckBox = JCheckBox("Enable Continue for Teams Beta (requires restart)") init { val constraints = GridBagConstraints() @@ -34,7 +28,6 @@ class ContinueSettingsComponent: DumbAware { panel.add(JLabel("Remote Config Server URL:"), constraints) constraints.gridy++ - constraints.gridy++ panel.add(remoteConfigServerUrl, constraints) constraints.gridy++ panel.add(JLabel("Remote Config Sync Period (in minutes):"), constraints) @@ -47,6 +40,8 @@ class ContinueSettingsComponent: DumbAware { constraints.gridy++ panel.add(enableTabAutocomplete, constraints) constraints.gridy++ + panel.add(enableContinueTeamsBeta, constraints) + constraints.gridy++ // Add a "filler" component that takes up all remaining vertical space constraints.weighty = 1.0 @@ -69,6 +64,7 @@ open class ContinueExtensionSettings : PersistentStateComponent implements UriHandler { diff --git a/gui/src/components/ProfileSwitcher.tsx b/gui/src/components/ProfileSwitcher.tsx index 4733fc195..140178883 100644 --- a/gui/src/components/ProfileSwitcher.tsx +++ b/gui/src/components/ProfileSwitcher.tsx @@ -22,7 +22,7 @@ import { IdeMessengerContext } from "../context/IdeMessenger"; import { useAuth } from "../hooks/useAuth"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { RootState } from "../redux/store"; -import { getFontSize, isJetBrains } from "../util"; +import { getFontSize } from "../util"; import HeaderButtonWithText from "./HeaderButtonWithText"; const StyledListbox = styled(Listbox)` @@ -235,7 +235,7 @@ function ProfileSwitcher(props: {}) { {/* Only show login if beta explicitly enabled */} - {!isJetBrains() && controlServerBetaEnabled && ( + {controlServerBetaEnabled && ( { - if (session.account) { + if (session?.account) { logout(); } else { login(); diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index fae117615..9e68813ac 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -218,10 +218,7 @@ function ModelSelect() { >
{modelSelectTitle(defaultModel) || "Select model"}
-
diff --git a/gui/src/hooks/useSubmenuContextProviders.tsx b/gui/src/hooks/useSubmenuContextProviders.tsx index 8c1bd86eb..45ee6f2c6 100644 --- a/gui/src/hooks/useSubmenuContextProviders.tsx +++ b/gui/src/hooks/useSubmenuContextProviders.tsx @@ -124,7 +124,10 @@ function useSubmenuContextProviders() { query, MINISEARCH_OPTIONS, ); - console.debug(`Search results for ${providerTitle}:`, results.length); + console.debug( + `Search results for ${providerTitle}:`, + results.length, + ); return results.map((result) => { return { ...result, providerTitle }; }); diff --git a/packages/config-types/package.json b/packages/config-types/package.json index 4a4d269e0..b323c6449 100644 --- a/packages/config-types/package.json +++ b/packages/config-types/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-types", - "version": "1.0.8", + "version": "1.0.9", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 8d0a1b588..fa676bec0 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -195,6 +195,14 @@ export const devDataSchema = z.object({ }); export type DevData = z.infer; +export const siteIndexingConfigSchema = z.object({ + startUrl: z.string(), + rootUrl: z.string(), + title: z.string(), + maxDepth: z.string().optional(), + faviconUrl: z.string().optional(), +}); + export const configJsonSchema = z.object({ models: z.array(modelDescriptionSchema), tabAutocompleteModel: modelDescriptionSchema.optional(), @@ -212,5 +220,6 @@ export const configJsonSchema = z.object({ disableIndexing: z.boolean().optional(), tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(), ui: uiOptionsSchema.optional(), + docs: z.array(siteIndexingConfigSchema).optional(), }); export type ConfigJson = z.infer;