fixes paste bug (#1899)
* 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 <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> * 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 <rleidle@tesla.com> * 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 <rleidle@tesla.com> * 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 <sestinj@gmail.com> Co-authored-by: inimaz <imaz@ai-verse.com> * 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 <sestinj@gmail.com> Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> * 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 <rleidle@gmail.com> Co-authored-by: Rob Leidle <rleidle@tesla.com> Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com> Co-authored-by: inimaz <imaz@ai-verse.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> 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 <sestinj@gmail.com> Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> * 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 <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> * temporary patch for type errs --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> * 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 <ih.fan.1027@gmail.com> * 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 <rleidle@tesla.com> * 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 <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 * Add CodeGeeX4 code completion support (#1815) Includes support for context through code snippets and relative filename resolution. * manually stop at stop tokens for all providers * chore: bump tree-sitter (#1828) * Add Missing Tokens for CodeGeeX4 AutoComplete (#1827) Previous attempts at using the normal pipe char with CodeGeeX FIM tokens resulted in empty completion output. However, this was due to <|user|> and <|assistant|> tokens being necessary for completion. The earlier working change ommitted these tokens, and its functionality using deepseek pipes was merely coincidental. This change now properly follows the CodeGeeX infill guides and should match what the model expects. In addition to <|user|> and <|assistant|>, the <|endoftext|> token was added as a stop token. * additional analytics providers * fix import error in jetbrains plugin * explicitly include default context providers * Remove a copy / pasta section that duplicated the work done in ChunkCodebaseIndexer (#1834) This cuts the amount of time spent in this section of indexing in half Co-authored-by: Rob Leidle <rleidle@tesla.com> * respect VS Code isTelemetryEnabled * Update OllamaEmbeddingsProvider.ts (#1839) * feat: include recently + open files in codebase search (#1833) * feat: include recently + open files in codebase search * cleanup * Update BaseRetrievalPipeline.ts * add params object to chunkDocument * Update package-lock.json * Offload all token counting to worker processes as well as some optimizations to do more token counting in parallel Adding the workerpool logic broke gui as vite does not support __dirname or path.join(...). To work around this, moved the gui dependency of stripImages out of countTokens.ts * Create CODE_OF_CONDUCT.md (#1843) * tweaks to new tokenizing * temporarily skip code chunking tests due to worker files not being present * update changelog * update version * jetbrains refresh token updates * refresh submenu items on workspace switch * OpenAI Adapters (#1859) * embeddings support in openai-adapters * rerank support in openai-adapters * cohere embed/rerank * continue-proxy reranker and embeddings providers * test for openai-adapters * embeddings provider and reranker for continue proxy * fix: missing Content-Type header in OllamaEmbeddingsProvider (#1855) * Add Language Name Param to AutocompleteTemplate (#1853) Language name was previously added as a parameter only for string autocomplete templates. This change provides this same information to template functions that implement the AutocompleteTemplate interface. Language name is explicitly supported for the CodeGeeX4 autocomplete template, and is added here in this change. Explicit language awareness could also be added for other templates in a future change, like the holeFillerTemplate used for models without explicit completion support. * update package.json version * deepseek FIM endpoint (#1862) * update package.json version * continue teams beta setting * update jetbrains version * add prompt files * Update prompts * Update refreshIndex.ts (#1866) * Update prompt files (#1867) * Update prompt files * Update .gitignore * Moving Bedrock integration to Converse API to support all models (#1871) Co-authored-by: Ruben Kostandyan <ruben.kostard@gmail.com> * Feature support model capability (#1810) * support capability field * remove usless code * support capability field * add some doc * support paste image * support capability field * remove usless code * support capability field * add some doc * support paste image * Update docs/docs/setup/configuration.md add quote Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> * rename to capabilities --------- Co-authored-by: jueinin <b1014397160@gmail.com> Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> * Added details to correlate parts of the Azure OpenAI endpoint URI to config parameters used by continue (#1846) * Change the onDidSaveTextDocument handler to only reindex the single saved file (#1873) This will improve scale as before the indexing process was restarted on every file save. Co-authored-by: Rob Leidle <rleidle@tesla.com> * Copy-paste fix for `code-server` environments (#1844) * first commit * review fix --------- Co-authored-by: Samir Abis <samir.abis@outlook.it> * More OpenAI Adapters (#1875) * anthropic adapter * cohere oai adapter * gemini oai adapter * gemini embeddings adapter * jina reranker * more openai-compatible providers * update package.json version * Convert core/ to NodeNext (#1877) * convert to nodenext in core * experimental vm modules * use imports * a few ts-ignores --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> * change vscode setting name * skip WIP test * remove and ignore .prompts/ folder * fix tests * feat: configure docs through config.json (#1864) * feat: configure docs through config.json * use correct baseUrl column * add/remove docs through config.json * add favicon * add advanced section in form * update package authors * index all using sqlite * use pre indexed doc * refresh submenu on save * setup tests * stash apply * update tests * create singleton * remove unused code * fix migration err * remove unused code * bugfix: isPreindexedDoc * update package.json * Implemented WatsonX LLM provider * Made minor liniting fixes * Fixed formatting changes * Added different ways of authentication and error handling in WatsonX * Added WatsonX.md and made some minor changes * Minor fixes * Migrate walkDir from using Minimatch to ignore.Ignore for matching .gitignore patterns (#1880) The ignore library attempts to pattern match exactly as .gitignore does and is better for this purpose than Minimatch. Co-authored-by: Rob Leidle <rleidle@tesla.com> * updated watsonx support * docs: remove stale config (#1897) * support for granite models * remove disableSummaries (legacy) from config * fix input box paste * ouputDir -> outputDir (#1898) * Disable autocomplete in config.json (#1857) * Remove API keys from autocomplete prompt * Check if we're in the continue directory * Completely ignore config.json for autocomplete * Check values directly as we do in other files * fix: improve textarea ux (#1901) * fix: improve textarea ux * Edit TipTapEditor.tsx * update binary tsconfig * fix ignore issues --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: Priyash <38959321+priyashpatil@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> Co-authored-by: YohannZe <99359799+YohannZe@users.noreply.github.com> Co-authored-by: Dan Dascalescu <ddascalescu+github@gmail.com> Co-authored-by: Rob Leidle <rleidle@gmail.com> Co-authored-by: Rob Leidle <rleidle@tesla.com> Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com> Co-authored-by: inimaz <imaz@ai-verse.com> 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 <ggordbegli@gmail.com> Co-authored-by: Raven-1027 <83693755+Raven-1027@users.noreply.github.com> Co-authored-by: Ihe Fan <ih.fan.1027@gmail.com> Co-authored-by: Lukas Kreussel <65088241+LLukas22@users.noreply.github.com> Co-authored-by: Josh Vera <josh@joshvera.com> Co-authored-by: Peter Zaback <pzaback@gmail.com> Co-authored-by: James Delorey <deloreyjmi@gmail.com> Co-authored-by: jdelorey@cloudflare.com <jdelorey@cloudflare.com> Co-authored-by: ekatiyar <eashaank@gmail.com> Co-authored-by: Simo <simo.paasisalo@syke.fi> Co-authored-by: Ruben Kostandyan <30292877+KoStard@users.noreply.github.com> Co-authored-by: Ruben Kostandyan <ruben.kostard@gmail.com> Co-authored-by: Willetta Hegmann <1014397160@qq.com> Co-authored-by: jueinin <b1014397160@gmail.com> Co-authored-by: Jack Wong <jack.wong@uright.ca> Co-authored-by: Samir Abis <158471628+samir-abis-everest@users.noreply.github.com> Co-authored-by: Samir Abis <samir.abis@outlook.it> Co-authored-by: RAJPAL BOOPATHI <rajpal.b@ibm.com> Co-authored-by: Rishabh Chakrabarti <Rishabh.Chakrabarti@ibm.com> Co-authored-by: George <george@fozzie.dev>
This commit is contained in:
parent
eef928f7b4
commit
12205ac8ab
65 changed files with 3115 additions and 1152 deletions
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
|
|
@ -22,7 +22,6 @@
|
|||
"CONTINUE_GLOBAL_DIR": "${workspaceFolder}/binary/.continue"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "Debug Jest Tests",
|
||||
"type": "node",
|
||||
|
|
@ -35,6 +34,7 @@
|
|||
"--config",
|
||||
"${workspaceRoot}/core/jest.config.js"
|
||||
],
|
||||
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
},
|
||||
|
|
@ -113,7 +113,12 @@
|
|||
],
|
||||
"cwd": "${workspaceRoot}/core",
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"env": {
|
||||
"NODE_OPTIONS": "--experimental-vm-modules",
|
||||
"CI": "true",
|
||||
"DEBUG": "jest"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[openai-adapters] Jest Test Debugger, Current Open File",
|
||||
|
|
|
|||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
|
@ -14,7 +14,8 @@
|
|||
}
|
||||
},
|
||||
"search.exclude": {
|
||||
"./binary": true,
|
||||
"**/core/vendor/**": true
|
||||
"**/binary": true,
|
||||
"**/core/vendor/**": true,
|
||||
"**/gui/dist": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
binary/package-lock.json
generated
1
binary/package-lock.json
generated
|
|
@ -106,6 +106,7 @@
|
|||
"@types/jest": "^29.5.12",
|
||||
"@types/jquery": "^3.5.29",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"esbuild": "0.17.19",
|
||||
"eslint": "^8",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "binary",
|
||||
"version": "1.0.0",
|
||||
"author": "Continue Dev, Inc",
|
||||
"description": "",
|
||||
"main": "out/index.js",
|
||||
"bin": "out/index.js",
|
||||
|
|
@ -26,7 +27,6 @@
|
|||
"build:dev": "tsc",
|
||||
"esbuild": "node build.js --esbuild-only"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.6.4",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"module": "commonjs",
|
||||
"target": "ES2020",
|
||||
"outDir": "out",
|
||||
"lib": ["ES2020", "dom", "es6", "es5", "dom.iterable", "scripthost"],
|
||||
"lib": ["ES2021", "dom", "es6", "es5", "dom.iterable", "scripthost"],
|
||||
"sourceMap": true,
|
||||
"rootDirs": ["src", "../core"],
|
||||
"allowJs": true,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
"plugins": ["@typescript-eslint", "import"],
|
||||
"rules": {
|
||||
"quotes": ["warn", "double", {}],
|
||||
"import/extensions": ["error", "ignorePackages"],
|
||||
"@typescript-eslint/naming-convention": "warn",
|
||||
"@typescript-eslint/semi": "warn",
|
||||
"curly": "warn",
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ import { getTemplateForModel } from "./templates.js";
|
|||
import { GeneratorReuseManager } from "./util.js";
|
||||
// @prettier-ignore
|
||||
import Handlebars from "handlebars";
|
||||
import { getConfigJsonPath } from "../util/paths.js";
|
||||
|
||||
export interface AutocompleteInput {
|
||||
completionId: string;
|
||||
|
|
@ -249,6 +250,11 @@ export class CompletionProvider {
|
|||
...config.tabAutocompleteOptions,
|
||||
};
|
||||
|
||||
// Check whether we're in the continue config.json file
|
||||
if (input.filepath === getConfigJsonPath()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Check whether autocomplete is disabled for this file
|
||||
if (options.disableInFiles) {
|
||||
// Relative path needed for `ignore`
|
||||
|
|
|
|||
|
|
@ -105,6 +105,37 @@ export class ConfigHandler {
|
|||
private profiles: ProfileLifecycleManager[];
|
||||
private selectedProfileId: string;
|
||||
|
||||
constructor(
|
||||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private readonly writeLog: (text: string) => Promise<void>,
|
||||
private controlPlaneClient: ControlPlaneClient,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.writeLog = writeLog;
|
||||
|
||||
// Set local profile as default
|
||||
const localProfileLoader = new LocalProfileLoader(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
controlPlaneClient,
|
||||
writeLog,
|
||||
);
|
||||
this.profiles = [new ProfileLifecycleManager(localProfileLoader)];
|
||||
this.selectedProfileId = localProfileLoader.profileId;
|
||||
|
||||
// Always load local profile immediately in case control plane doesn't load
|
||||
try {
|
||||
this.loadConfig();
|
||||
} catch (e) {
|
||||
console.error("Failed to load config: ", e);
|
||||
}
|
||||
|
||||
// Load control plane profiles
|
||||
this.fetchControlPlaneProfiles();
|
||||
}
|
||||
|
||||
// This will be the local profile
|
||||
private get fallbackProfile() {
|
||||
return this.profiles[0];
|
||||
|
|
@ -163,37 +194,6 @@ export class ConfigHandler {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(
|
||||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private readonly writeLog: (text: string) => Promise<void>,
|
||||
private controlPlaneClient: ControlPlaneClient,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.writeLog = writeLog;
|
||||
|
||||
// Set local profile as default
|
||||
const localProfileLoader = new LocalProfileLoader(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
controlPlaneClient,
|
||||
writeLog,
|
||||
);
|
||||
this.profiles = [new ProfileLifecycleManager(localProfileLoader)];
|
||||
this.selectedProfileId = localProfileLoader.profileId;
|
||||
|
||||
// Always load local profile immediately in case control plane doesn't load
|
||||
try {
|
||||
this.loadConfig();
|
||||
} catch (e) {
|
||||
console.error("Failed to load config: ", e);
|
||||
}
|
||||
|
||||
// Load control plane profiles
|
||||
this.fetchControlPlaneProfiles();
|
||||
}
|
||||
|
||||
async setSelectedProfile(profileId: string) {
|
||||
this.selectedProfileId = profileId;
|
||||
const newConfig = await this.loadConfig();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import Handlebars from "handlebars";
|
||||
import path from "path";
|
||||
import * as YAML from "yaml";
|
||||
import type { IDE, SlashCommand } from "../index.js";
|
||||
import { walkDir } from "../indexing/walkDir.js";
|
||||
import { stripImages } from "../llm/images.js";
|
||||
import { renderTemplatedString } from "../llm/llms/index.js";
|
||||
import { getBasename } from "../util/index.js";
|
||||
import type { IDE, SlashCommand } from "..";
|
||||
import { walkDir } from "../indexing/walkDir";
|
||||
import { stripImages } from "../llm/images";
|
||||
import { renderTemplatedString } from "../llm/llms/index";
|
||||
import { getBasename } from "../util/index";
|
||||
|
||||
export const DEFAULT_PROMPTS_FOLDER = ".prompts";
|
||||
|
||||
|
|
@ -133,6 +133,7 @@ export function slashCommandFromPromptFile(
|
|||
provider.description.title,
|
||||
async (context: any) => {
|
||||
const items = await provider.getContextItems(context, {
|
||||
config,
|
||||
embeddingsProvider: config.embeddingsProvider,
|
||||
fetch,
|
||||
fullInput: userInput,
|
||||
|
|
|
|||
|
|
@ -4,18 +4,16 @@ import {
|
|||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
ContextSubmenuItem,
|
||||
EmbeddingsProvider,
|
||||
LoadSubmenuItemsArgs,
|
||||
Reranker,
|
||||
} from "../../index.js";
|
||||
import { DocsService } from "../../indexing/docs/DocsService.js";
|
||||
import preIndexedDocs from "../../indexing/docs/preIndexedDocs.js";
|
||||
import { Telemetry } from "../../util/posthog.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
} from "../..";
|
||||
import DocsService from "../../indexing/docs/DocsService";
|
||||
import preIndexedDocs from "../../indexing/docs/preIndexedDocs";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import { BaseContextProvider } from "../";
|
||||
|
||||
class DocsContextProvider extends BaseContextProvider {
|
||||
static DEFAULT_N_RETRIEVE = 30;
|
||||
static DEFAULT_N_FINAL = 15;
|
||||
static nRetrieve = 30;
|
||||
static nFinal = 15;
|
||||
static description: ContextProviderDescription = {
|
||||
title: "docs",
|
||||
displayTitle: "Docs",
|
||||
|
|
@ -23,11 +21,8 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
type: "submenu",
|
||||
};
|
||||
|
||||
private docsService: DocsService;
|
||||
|
||||
constructor(options: any) {
|
||||
super(options);
|
||||
this.docsService = DocsService.getInstance();
|
||||
}
|
||||
|
||||
private async _rerankChunks(
|
||||
|
|
@ -46,14 +41,14 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
|
||||
chunksCopy = chunksCopy.splice(
|
||||
0,
|
||||
this.options?.nFinal ?? DocsContextProvider.DEFAULT_N_FINAL,
|
||||
this.options?.nFinal ?? DocsContextProvider.nFinal,
|
||||
);
|
||||
} catch (e) {
|
||||
console.warn(`Failed to rerank docs results: ${e}`);
|
||||
|
||||
chunksCopy = chunksCopy.splice(
|
||||
0,
|
||||
this.options?.nFinal ?? DocsContextProvider.DEFAULT_N_FINAL,
|
||||
this.options?.nFinal ?? DocsContextProvider.nFinal,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -84,14 +79,15 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const ideInfo = await extras.ide.getIdeInfo();
|
||||
const isJetBrains = ideInfo.ideType === "jetbrains";
|
||||
const docsService = DocsService.getSingleton();
|
||||
|
||||
if (!docsService) {
|
||||
console.error(`${DocsService.name} has not been initialized`);
|
||||
return [];
|
||||
}
|
||||
|
||||
const isJetBrainsAndPreIndexedDocsProvider =
|
||||
this.docsService.isJetBrainsAndPreIndexedDocsProvider(
|
||||
ideInfo,
|
||||
extras.embeddingsProvider.id,
|
||||
);
|
||||
await docsService.isJetBrainsAndPreIndexedDocsProvider();
|
||||
|
||||
if (isJetBrainsAndPreIndexedDocsProvider) {
|
||||
extras.ide.errorPopup(
|
||||
|
|
@ -106,29 +102,26 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
|
||||
const preIndexedDoc = preIndexedDocs[query];
|
||||
|
||||
let embeddingsProvider: EmbeddingsProvider;
|
||||
|
||||
if (!!preIndexedDoc && !isJetBrains) {
|
||||
// Pre-indexed docs should be filtered out in `loadSubmenuItems`,
|
||||
// for JetBrains users, but we sanity check that here
|
||||
if (!!preIndexedDoc) {
|
||||
Telemetry.capture("docs_pre_indexed_doc_used", {
|
||||
doc: preIndexedDoc["title"],
|
||||
});
|
||||
|
||||
embeddingsProvider = DocsService.preIndexedDocsEmbeddingsProvider;
|
||||
} else {
|
||||
embeddingsProvider = extras.embeddingsProvider;
|
||||
}
|
||||
|
||||
const embeddingsProvider = await docsService.getEmbeddingsProvider(
|
||||
!!preIndexedDoc,
|
||||
);
|
||||
|
||||
const [vector] = await embeddingsProvider.embed([extras.fullInput]);
|
||||
|
||||
let chunks = await this.docsService.retrieve(
|
||||
let chunks = await docsService.retrieveChunks(
|
||||
query,
|
||||
vector,
|
||||
this.options?.nRetrieve ?? DocsContextProvider.DEFAULT_N_RETRIEVE,
|
||||
embeddingsProvider.id,
|
||||
this.options?.nRetrieve ?? DocsContextProvider.nRetrieve,
|
||||
);
|
||||
|
||||
const favicon = await docsService.getFavicon(query);
|
||||
|
||||
if (extras.reranker) {
|
||||
chunks = await this._rerankChunks(
|
||||
chunks,
|
||||
|
|
@ -140,6 +133,7 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
return [
|
||||
...chunks
|
||||
.map((chunk) => ({
|
||||
icon: favicon,
|
||||
name: chunk.filepath.includes("/tree/main") // For display of GitHub files
|
||||
? chunk.filepath
|
||||
.split("/")
|
||||
|
|
@ -168,17 +162,19 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
async loadSubmenuItems(
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
const ideInfo = await args.ide.getIdeInfo();
|
||||
const isJetBrains = ideInfo.ideType === "jetbrains";
|
||||
const configSites = [
|
||||
...new Set([...(this.options?.sites || []), ...(args.config.docs || [])]),
|
||||
];
|
||||
const docsService = DocsService.getSingleton();
|
||||
|
||||
if (!docsService) {
|
||||
console.error(`${DocsService.name} has not been initialized`);
|
||||
return [];
|
||||
}
|
||||
|
||||
const docs = (await docsService.list()) ?? [];
|
||||
const canUsePreindexedDocs = await docsService.canUsePreindexedDocs();
|
||||
|
||||
const submenuItemsMap = new Map<string, ContextSubmenuItem>();
|
||||
|
||||
if (!isJetBrains) {
|
||||
// Currently, we generate and host embeddings for pre-indexed docs using transformers.js.
|
||||
// However, we don't ship transformers.js with the JetBrains extension.
|
||||
// So, we only include pre-indexed docs in the submenu for non-JetBrains IDEs.
|
||||
if (canUsePreindexedDocs) {
|
||||
for (const { startUrl, title } of Object.values(preIndexedDocs)) {
|
||||
submenuItemsMap.set(startUrl, {
|
||||
title,
|
||||
|
|
@ -191,25 +187,18 @@ class DocsContextProvider extends BaseContextProvider {
|
|||
}
|
||||
}
|
||||
|
||||
for (const { title, baseUrl } of await this.docsService.list()) {
|
||||
submenuItemsMap.set(baseUrl, {
|
||||
title,
|
||||
id: baseUrl,
|
||||
description: new URL(baseUrl).hostname,
|
||||
});
|
||||
}
|
||||
|
||||
for (const { startUrl, title } of configSites) {
|
||||
for (const { startUrl, title, favicon } of docs) {
|
||||
submenuItemsMap.set(startUrl, {
|
||||
title,
|
||||
id: startUrl,
|
||||
description: new URL(startUrl).hostname,
|
||||
icon: favicon,
|
||||
});
|
||||
}
|
||||
|
||||
const submenuItems = Array.from(submenuItemsMap.values());
|
||||
|
||||
if (!isJetBrains) {
|
||||
if (canUsePreindexedDocs) {
|
||||
return this._sortByPreIndexedDocs(submenuItems);
|
||||
}
|
||||
|
||||
|
|
|
|||
225
core/core.ts
225
core/core.ts
|
|
@ -1,38 +1,32 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import { CompletionProvider } from "./autocomplete/completionProvider.js";
|
||||
import { ConfigHandler } from "./config/ConfigHandler.js";
|
||||
import type { ContextItemId, IDE, IndexingProgressUpdate } from ".";
|
||||
import { CompletionProvider } from "./autocomplete/completionProvider";
|
||||
import { ConfigHandler } from "./config/ConfigHandler";
|
||||
import {
|
||||
setupApiKeysMode,
|
||||
setupFreeTrialMode,
|
||||
setupLocalAfterFreeTrial,
|
||||
setupLocalMode,
|
||||
} from "./config/onboarding.js";
|
||||
import { createNewPromptFile } from "./config/promptFile.js";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util.js";
|
||||
import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache.js";
|
||||
import { ContinueServerClient } from "./continueServer/stubs/client.js";
|
||||
import { getAuthUrlForTokenPage } from "./control-plane/auth/index.js";
|
||||
import { ControlPlaneClient } from "./control-plane/client.js";
|
||||
import type {
|
||||
ContextItemId,
|
||||
EmbeddingsProvider,
|
||||
IDE,
|
||||
IndexingProgressUpdate,
|
||||
SiteIndexingConfig,
|
||||
} from "./index.js";
|
||||
import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer.js";
|
||||
import { DocsService } from "./indexing/docs/DocsService.js";
|
||||
import Ollama from "./llm/llms/Ollama.js";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol/index.js";
|
||||
import { GlobalContext } from "./util/GlobalContext.js";
|
||||
import { logDevData } from "./util/devdata.js";
|
||||
import { DevDataSqliteDb } from "./util/devdataSqlite.js";
|
||||
import { fetchwithRequestOptions } from "./util/fetchWithOptions.js";
|
||||
import historyManager from "./util/history.js";
|
||||
import type { IMessenger, Message } from "./util/messenger.js";
|
||||
import { editConfigJson } from "./util/paths.js";
|
||||
import { Telemetry } from "./util/posthog.js";
|
||||
import { streamDiffLines } from "./util/verticalEdit.js";
|
||||
} from "./config/onboarding";
|
||||
import { createNewPromptFile } from "./config/promptFile";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util";
|
||||
import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache";
|
||||
import { ContinueServerClient } from "./continueServer/stubs/client";
|
||||
import { getAuthUrlForTokenPage } from "./control-plane/auth/index";
|
||||
import { ControlPlaneClient } from "./control-plane/client";
|
||||
import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer";
|
||||
import DocsService, { docsServiceSingleton } from "./indexing/docs/DocsService";
|
||||
import Ollama from "./llm/llms/Ollama";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { GlobalContext } from "./util/GlobalContext";
|
||||
import { logDevData } from "./util/devdata";
|
||||
import { DevDataSqliteDb } from "./util/devdataSqlite";
|
||||
import { fetchwithRequestOptions } from "./util/fetchWithOptions";
|
||||
import historyManager from "./util/history";
|
||||
import type { IMessenger, Message } from "./util/messenger";
|
||||
import { editConfigJson } from "./util/paths";
|
||||
import { Telemetry } from "./util/posthog";
|
||||
import { streamDiffLines } from "./util/verticalEdit";
|
||||
|
||||
export class Core {
|
||||
// implements IMessenger<ToCoreProtocol, FromCoreProtocol>
|
||||
|
|
@ -42,8 +36,9 @@ export class Core {
|
|||
continueServerClientPromise: Promise<ContinueServerClient>;
|
||||
indexingState: IndexingProgressUpdate;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
private docsService: DocsService;
|
||||
private globalContext = new GlobalContext();
|
||||
private docsService = DocsService.getInstance();
|
||||
|
||||
private readonly indexingPauseToken = new PauseToken(
|
||||
this.globalContext.get("indexingPaused") === true,
|
||||
);
|
||||
|
|
@ -98,20 +93,16 @@ export class Core {
|
|||
this.controlPlaneClient,
|
||||
);
|
||||
|
||||
this.docsService = DocsService.createSingleton(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
);
|
||||
|
||||
this.configHandler.onConfigUpdate(
|
||||
(() => this.messenger.send("configUpdate", undefined)).bind(this),
|
||||
);
|
||||
|
||||
this.configHandler.onConfigUpdate(async ({ embeddingsProvider }) => {
|
||||
if (
|
||||
await this.shouldReindexDocsOnNewEmbeddingsProvider(
|
||||
embeddingsProvider.id,
|
||||
)
|
||||
) {
|
||||
await this.reindexDocsOnNewEmbeddingsProvider(embeddingsProvider);
|
||||
}
|
||||
});
|
||||
|
||||
this.configHandler.onDidChangeAvailableProfiles((profiles) =>
|
||||
this.messenger.send("didChangeAvailableProfiles", { profiles }),
|
||||
);
|
||||
|
|
@ -209,12 +200,15 @@ export class Core {
|
|||
on("history/list", (msg) => {
|
||||
return historyManager.list(msg.data);
|
||||
});
|
||||
|
||||
on("history/delete", (msg) => {
|
||||
historyManager.delete(msg.data.id);
|
||||
});
|
||||
|
||||
on("history/load", (msg) => {
|
||||
return historyManager.load(msg.data.id);
|
||||
});
|
||||
|
||||
on("history/save", (msg) => {
|
||||
historyManager.save(msg.data);
|
||||
});
|
||||
|
|
@ -230,14 +224,17 @@ export class Core {
|
|||
addModel(model);
|
||||
this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
on("config/addOpenAiKey", (msg) => {
|
||||
addOpenAIKey(msg.data);
|
||||
this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
on("config/deleteModel", (msg) => {
|
||||
deleteModel(msg.data.title);
|
||||
this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
on("config/newPromptFile", async (msg) => {
|
||||
createNewPromptFile(
|
||||
this.ide,
|
||||
|
|
@ -245,10 +242,12 @@ export class Core {
|
|||
);
|
||||
this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
on("config/reload", (msg) => {
|
||||
this.configHandler.reloadConfig();
|
||||
return this.configHandler.getSerializedConfig();
|
||||
});
|
||||
|
||||
on("config/ideSettingsUpdate", (msg) => {
|
||||
this.configHandler.updateIdeSettings(msg.data);
|
||||
});
|
||||
|
|
@ -258,40 +257,33 @@ export class Core {
|
|||
|
||||
// Context providers
|
||||
on("context/addDocs", async (msg) => {
|
||||
await this.getEmbeddingsProviderAndIndexDoc(msg.data);
|
||||
let hasFailed = false;
|
||||
|
||||
this.ide.infoPopup(`Successfully indexed ${msg.data.title}`);
|
||||
this.messenger.send("refreshSubmenuItems", undefined);
|
||||
for await (const result of this.docsService.indexAndAdd(msg.data)) {
|
||||
if (result.status === "failed") {
|
||||
hasFailed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFailed) {
|
||||
this.ide.infoPopup(`Failed to index ${msg.data.startUrl}`);
|
||||
} else {
|
||||
this.ide.infoPopup(`Successfully indexed ${msg.data.startUrl}`);
|
||||
this.messenger.send("refreshSubmenuItems", undefined);
|
||||
}
|
||||
});
|
||||
|
||||
on("context/removeDocs", async (msg) => {
|
||||
const baseUrl = msg.data.baseUrl;
|
||||
await this.docsService.delete(baseUrl);
|
||||
await this.docsService.delete(msg.data.startUrl);
|
||||
this.messenger.send("refreshSubmenuItems", undefined);
|
||||
});
|
||||
|
||||
on("context/indexDocs", async (msg) => {
|
||||
const config = await this.config();
|
||||
const provider: any = config.contextProviders?.find(
|
||||
(provider) => provider.description.title === "docs",
|
||||
);
|
||||
|
||||
if (!provider) {
|
||||
this.ide.infoPopup("No docs in configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
const siteIndexingOptions: SiteIndexingConfig[] = ((mProvider) => [
|
||||
...new Set([
|
||||
...(mProvider?.options?.sites || []),
|
||||
...(config.docs || []),
|
||||
]),
|
||||
])({ ...provider });
|
||||
|
||||
for (const site of siteIndexingOptions) {
|
||||
await this.getEmbeddingsProviderAndIndexDoc(site, msg.data.reIndex);
|
||||
}
|
||||
|
||||
this.ide.infoPopup("Docs indexing completed");
|
||||
await this.docsService.indexAllDocs(msg.data.reIndex);
|
||||
this.messenger.send("refreshSubmenuItems", undefined);
|
||||
});
|
||||
|
||||
on("context/loadSubmenuItems", async (msg) => {
|
||||
const config = await this.config();
|
||||
const items = await config.contextProviders
|
||||
|
|
@ -304,6 +296,7 @@ export class Core {
|
|||
});
|
||||
return items || [];
|
||||
});
|
||||
|
||||
on("context/getContextItems", async (msg) => {
|
||||
const { name, query, fullInput, selectedCode } = msg.data;
|
||||
const config = await this.config();
|
||||
|
|
@ -320,7 +313,9 @@ export class Core {
|
|||
providerTitle: provider.description.title,
|
||||
itemId: uuidv4(),
|
||||
};
|
||||
|
||||
const items = await provider.getContextItems(query, {
|
||||
config,
|
||||
llm,
|
||||
embeddingsProvider: config.embeddingsProvider,
|
||||
fullInput,
|
||||
|
|
@ -688,100 +683,4 @@ export class Core {
|
|||
|
||||
this.messenger.send("refreshSubmenuItems", undefined);
|
||||
}
|
||||
|
||||
private async shouldReindexDocsOnNewEmbeddingsProvider(
|
||||
curEmbeddingsProviderId: EmbeddingsProvider["id"],
|
||||
): Promise<boolean> {
|
||||
const ideInfo = await this.ide.getIdeInfo();
|
||||
const isJetBrainsAndPreIndexedDocsProvider =
|
||||
this.docsService.isJetBrainsAndPreIndexedDocsProvider(
|
||||
ideInfo,
|
||||
curEmbeddingsProviderId,
|
||||
);
|
||||
|
||||
if (isJetBrainsAndPreIndexedDocsProvider) {
|
||||
try {
|
||||
this.ide.errorPopup(
|
||||
"The 'transformers.js' embeddings provider currently cannot be used to index " +
|
||||
"documentation in JetBrains. To enable documentation indexing, you can use " +
|
||||
"any of the other providers described in the docs: " +
|
||||
"https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers",
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Failed to show error popup:", error);
|
||||
}
|
||||
this.globalContext.update(
|
||||
"curEmbeddingsProviderId",
|
||||
curEmbeddingsProviderId,
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const lastEmbeddingsProviderId = this.globalContext.get(
|
||||
"curEmbeddingsProviderId",
|
||||
);
|
||||
|
||||
if (!lastEmbeddingsProviderId) {
|
||||
// If it's the first time we're setting the `curEmbeddingsProviderId`
|
||||
// global state, we don't need to reindex docs
|
||||
this.globalContext.update(
|
||||
"curEmbeddingsProviderId",
|
||||
curEmbeddingsProviderId,
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return lastEmbeddingsProviderId !== curEmbeddingsProviderId;
|
||||
}
|
||||
|
||||
private async getEmbeddingsProviderAndIndexDoc(
|
||||
site: SiteIndexingConfig,
|
||||
reIndex: boolean = false,
|
||||
): Promise<void> {
|
||||
const config = await this.config();
|
||||
const { embeddingsProvider } = config;
|
||||
|
||||
for await (const update of this.docsService.indexAndAdd(
|
||||
site,
|
||||
embeddingsProvider,
|
||||
reIndex,
|
||||
)) {
|
||||
// Temporary disabled posting progress updates to the UI due to
|
||||
// possible collision with code indexing progress updates.
|
||||
// this.messenger.request("indexProgress", update);
|
||||
// this.indexingState = update;
|
||||
}
|
||||
}
|
||||
|
||||
private async reindexDocsOnNewEmbeddingsProvider(
|
||||
embeddingsProvider: EmbeddingsProvider,
|
||||
) {
|
||||
const docs = await this.docsService.list();
|
||||
|
||||
if (docs.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.ide.infoPopup("Reindexing docs with new embeddings provider");
|
||||
|
||||
for (const { title, baseUrl } of docs) {
|
||||
await this.docsService.delete(baseUrl);
|
||||
|
||||
const generator = this.docsService.indexAndAdd(
|
||||
{ title, startUrl: baseUrl, rootUrl: baseUrl },
|
||||
embeddingsProvider,
|
||||
);
|
||||
|
||||
while (!(await generator.next()).done) {}
|
||||
}
|
||||
|
||||
// Important that this only is invoked after we have successfully
|
||||
// cleared and reindex the docs so that the table cannot end up in an
|
||||
// invalid state.
|
||||
this.globalContext.update("curEmbeddingsProviderId", embeddingsProvider.id);
|
||||
|
||||
this.ide.infoPopup("Completed reindexing of all docs");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
27
core/index.d.ts
vendored
27
core/index.d.ts
vendored
|
|
@ -127,6 +127,7 @@ export interface ContextProviderDescription {
|
|||
export type FetchFunction = (url: string | URL, init?: any) => Promise<any>;
|
||||
|
||||
export interface ContextProviderExtras {
|
||||
config: ContinueConfig;
|
||||
fullInput: string;
|
||||
embeddingsProvider: EmbeddingsProvider;
|
||||
reranker: Reranker | undefined;
|
||||
|
|
@ -161,21 +162,21 @@ export interface ContextSubmenuItem {
|
|||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
iconUrl?: string;
|
||||
icon?: string;
|
||||
metadata?: any;
|
||||
}
|
||||
|
||||
export interface SiteIndexingConfig {
|
||||
startUrl: string;
|
||||
rootUrl: string;
|
||||
title: string;
|
||||
startUrl: string;
|
||||
rootUrl?: string;
|
||||
maxDepth?: number;
|
||||
faviconUrl?: string;
|
||||
}
|
||||
|
||||
export interface SiteIndexingConfig {
|
||||
startUrl: string;
|
||||
rootUrl: string;
|
||||
rootUrl?: string;
|
||||
title: string;
|
||||
maxDepth?: number;
|
||||
}
|
||||
|
|
@ -269,6 +270,7 @@ export interface ContextItem {
|
|||
description: string;
|
||||
editing?: boolean;
|
||||
editable?: boolean;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export interface ContextItemWithId {
|
||||
|
|
@ -278,6 +280,7 @@ export interface ContextItemWithId {
|
|||
id: ContextItemId;
|
||||
editing?: boolean;
|
||||
editable?: boolean;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export interface InputModifiers {
|
||||
|
|
@ -339,7 +342,15 @@ export interface LLMOptions {
|
|||
// GCP Options
|
||||
region?: string;
|
||||
projectId?: string;
|
||||
capabilities?: ModelCapability
|
||||
capabilities?: ModelCapability;
|
||||
|
||||
// WatsonX options
|
||||
watsonxUrl?: string;
|
||||
watsonxApiKey?: string;
|
||||
watsonxZenApiKeyBase64?:string// Required if using watsonx software with ZenApiKey auth
|
||||
watsonxUsername?:string;
|
||||
watsonxPassword?:string;
|
||||
watsonxProjectId?: string;
|
||||
}
|
||||
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
|
||||
T,
|
||||
|
|
@ -591,7 +602,8 @@ type ModelProvider =
|
|||
| "deepseek"
|
||||
| "azure"
|
||||
| "openai-aiohttp"
|
||||
| "msty";
|
||||
| "msty"
|
||||
| "watsonx";
|
||||
|
||||
export type ModelName =
|
||||
| "AUTODETECT"
|
||||
|
|
@ -735,7 +747,7 @@ export interface ModelDescription {
|
|||
systemMessage?: string;
|
||||
requestOptions?: RequestOptions;
|
||||
promptTemplates?: { [key: string]: string };
|
||||
capabilities?: ModelCapability
|
||||
capabilities?: ModelCapability;
|
||||
}
|
||||
|
||||
export type EmbeddingsProviderName =
|
||||
|
|
@ -896,6 +908,7 @@ export interface SerializedContinueConfig {
|
|||
reranker?: RerankerDescription;
|
||||
experimental?: ExperimentalConfig;
|
||||
analytics?: AnalyticsConfig;
|
||||
docs?: SiteIndexingConfig[];
|
||||
}
|
||||
|
||||
export type ConfigMergeType = "merge" | "overwrite";
|
||||
|
|
|
|||
|
|
@ -62,9 +62,17 @@ export class LanceDbIndex implements CodebaseIndex {
|
|||
"lancedb_sqlite_artifact_id_column",
|
||||
async () => {
|
||||
try {
|
||||
await db.exec(
|
||||
"ALTER TABLE lance_db_cache ADD COLUMN artifact_id TEXT NOT NULL DEFAULT 'UNDEFINED'",
|
||||
const pragma = await db.all("PRAGMA table_info(lance_db_cache)");
|
||||
|
||||
const hasArtifactIdCol = pragma.some(
|
||||
(pragma) => pragma.name === "artifact_id",
|
||||
);
|
||||
|
||||
if (!hasArtifactIdCol) {
|
||||
await db.exec(
|
||||
"ALTER TABLE lance_db_cache ADD COLUMN artifact_id TEXT NOT NULL DEFAULT 'UNDEFINED'",
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
resolve(undefined);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,41 @@
|
|||
import { open, type Database } from "sqlite";
|
||||
import sqlite3 from "sqlite3";
|
||||
import {
|
||||
Chunk,
|
||||
ContinueConfig,
|
||||
EmbeddingsProvider,
|
||||
IdeInfo,
|
||||
IDE,
|
||||
IndexingProgressUpdate,
|
||||
SiteIndexingConfig,
|
||||
} from "../../index.js";
|
||||
import { getDocsSqlitePath, getLanceDbPath } from "../../util/paths.js";
|
||||
import {
|
||||
editConfigJson,
|
||||
getDocsSqlitePath,
|
||||
getLanceDbPath,
|
||||
} from "../../util/paths.js";
|
||||
import { Article, chunkArticle, pageToArticle } from "./article.js";
|
||||
import { crawlPage } from "./crawl.js";
|
||||
import { downloadFromS3, SiteIndexingResults } from "./preIndexed.js";
|
||||
import {
|
||||
downloadFromS3,
|
||||
getS3Filename,
|
||||
S3Buckets,
|
||||
SiteIndexingResults,
|
||||
} from "./preIndexed.js";
|
||||
import preIndexedDocs from "./preIndexedDocs.js";
|
||||
import TransformersJsEmbeddingsProvider from "../embeddings/TransformersJsEmbeddingsProvider.js";
|
||||
import { ConfigHandler } from "../../config/ConfigHandler.js";
|
||||
import lancedb, { Connection } from "vectordb";
|
||||
import { GlobalContext } from "../../util/GlobalContext.js";
|
||||
import DocsContextProvider from "../../context/providers/DocsContextProvider.js";
|
||||
import { open, type Database } from "sqlite";
|
||||
import sqlite3 from "sqlite3";
|
||||
import { Telemetry } from "../../util/posthog.js";
|
||||
import { runSqliteMigrations, runLanceMigrations } from "./migrations.js";
|
||||
import { IMessenger } from "../../util/messenger.js";
|
||||
import { ToCoreProtocol, FromCoreProtocol } from "../../protocol/index.js";
|
||||
|
||||
// Purposefully lowercase because lancedb converts
|
||||
interface LanceDbDocsRow {
|
||||
export interface LanceDbDocsRow {
|
||||
title: string;
|
||||
baseurl: string;
|
||||
starturl: string;
|
||||
// Chunk
|
||||
content: string;
|
||||
path: string;
|
||||
|
|
@ -27,200 +45,142 @@ interface LanceDbDocsRow {
|
|||
[key: string]: any;
|
||||
}
|
||||
|
||||
export class DocsService {
|
||||
private static instance: DocsService;
|
||||
private static DOCS_TABLE_NAME = "docs";
|
||||
public static preIndexedDocsEmbeddingsProvider =
|
||||
new TransformersJsEmbeddingsProvider();
|
||||
private _sqliteTable: Database | undefined;
|
||||
private docsIndexingQueue: Set<string> = new Set();
|
||||
export interface SqliteDocsRow {
|
||||
title: string;
|
||||
startUrl: string;
|
||||
favicon: string;
|
||||
}
|
||||
|
||||
public static getInstance(): DocsService {
|
||||
if (!DocsService.instance) {
|
||||
DocsService.instance = new DocsService();
|
||||
}
|
||||
export type AddParams = {
|
||||
siteIndexingConfig: SiteIndexingConfig;
|
||||
chunks: Chunk[];
|
||||
embeddings: number[][];
|
||||
favicon?: string;
|
||||
};
|
||||
|
||||
export default class DocsService {
|
||||
static lanceTableName = "docs";
|
||||
static sqlitebTableName = "docs";
|
||||
static preIndexedDocsEmbeddingsProvider =
|
||||
new TransformersJsEmbeddingsProvider();
|
||||
|
||||
private static instance?: DocsService;
|
||||
public isInitialized: Promise<void>;
|
||||
public isSyncing: boolean = false;
|
||||
|
||||
private docsIndexingQueue = new Set<string>();
|
||||
private globalContext = new GlobalContext();
|
||||
private lanceTableNamesSet = new Set<string>();
|
||||
|
||||
private config!: ContinueConfig;
|
||||
private sqliteDb?: Database;
|
||||
|
||||
// If we are instantiating a new DocsService from `getContextItems()`,
|
||||
// we have access to the direct config object.
|
||||
// When instantiating the DocsService from core, we have access
|
||||
// to a ConfigHandler instance.
|
||||
constructor(
|
||||
configOrHandler: ConfigHandler,
|
||||
private readonly ide: IDE,
|
||||
private readonly messenger?: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
) {
|
||||
this.isInitialized = this.init(configOrHandler);
|
||||
}
|
||||
|
||||
static getSingleton() {
|
||||
return DocsService.instance;
|
||||
}
|
||||
|
||||
private async getSqliteTable() {
|
||||
if (!this._sqliteTable) {
|
||||
this._sqliteTable = await open({
|
||||
filename: getDocsSqlitePath(),
|
||||
driver: sqlite3.Database,
|
||||
});
|
||||
|
||||
this._sqliteTable.exec(`CREATE TABLE IF NOT EXISTS docs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title STRING NOT NULL,
|
||||
baseUrl STRING NOT NULL UNIQUE
|
||||
)`);
|
||||
}
|
||||
|
||||
return this._sqliteTable;
|
||||
}
|
||||
|
||||
private async getLanceDb() {
|
||||
const lancedb = await import("vectordb");
|
||||
const lance = await lancedb.connect(getLanceDbPath());
|
||||
return lance;
|
||||
}
|
||||
|
||||
async retrieve(
|
||||
baseUrl: string,
|
||||
vector: number[],
|
||||
nRetrieve: number,
|
||||
embeddingsProviderId: string,
|
||||
nested = false,
|
||||
): Promise<Chunk[]> {
|
||||
const lance = await this.getLanceDb();
|
||||
const tableNames = await lance.tableNames();
|
||||
const preIndexedDoc = preIndexedDocs[baseUrl];
|
||||
const isPreIndexedDoc = !!preIndexedDoc;
|
||||
let shouldDownloadPreIndexedDoc =
|
||||
!tableNames.includes(DocsService.DOCS_TABLE_NAME) && isPreIndexedDoc;
|
||||
|
||||
const downloadAndRetrievePreIndexedDoc = async (
|
||||
preIndexedDoc: SiteIndexingConfig,
|
||||
) => {
|
||||
await this.downloadAndAddPreIndexedDocs(
|
||||
embeddingsProviderId,
|
||||
preIndexedDoc.title,
|
||||
);
|
||||
|
||||
return await this.retrieve(
|
||||
baseUrl,
|
||||
vector,
|
||||
nRetrieve,
|
||||
embeddingsProviderId,
|
||||
true,
|
||||
);
|
||||
};
|
||||
|
||||
if (shouldDownloadPreIndexedDoc) {
|
||||
return await downloadAndRetrievePreIndexedDoc(preIndexedDoc!);
|
||||
}
|
||||
|
||||
const table = await lance.openTable(DocsService.DOCS_TABLE_NAME);
|
||||
|
||||
let docs: LanceDbDocsRow[] = await table
|
||||
.search(vector)
|
||||
.limit(nRetrieve)
|
||||
.where(`baseurl = '${baseUrl}'`)
|
||||
.execute();
|
||||
|
||||
docs = docs.filter((doc) => doc.baseurl === baseUrl);
|
||||
|
||||
shouldDownloadPreIndexedDoc =
|
||||
(!docs || docs.length === 0) && !nested && isPreIndexedDoc;
|
||||
|
||||
if (shouldDownloadPreIndexedDoc) {
|
||||
return await downloadAndRetrievePreIndexedDoc(preIndexedDoc!);
|
||||
}
|
||||
|
||||
return docs.map((doc) => ({
|
||||
digest: doc.path,
|
||||
filepath: doc.path,
|
||||
startLine: doc.startline,
|
||||
endLine: doc.endline,
|
||||
index: 0,
|
||||
content: doc.content,
|
||||
otherMetadata: {
|
||||
title: doc.title,
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
private async add(
|
||||
title: string,
|
||||
baseUrl: URL,
|
||||
chunks: Chunk[],
|
||||
embeddings: number[][],
|
||||
static createSingleton(
|
||||
configOrHandler: ConfigHandler,
|
||||
ide: IDE,
|
||||
messenger?: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
) {
|
||||
const data: LanceDbDocsRow[] = chunks.map((chunk, i) => ({
|
||||
title: chunk.otherMetadata?.title || title,
|
||||
baseurl: baseUrl.toString(),
|
||||
content: chunk.content,
|
||||
path: chunk.filepath,
|
||||
startline: chunk.startLine,
|
||||
endline: chunk.endLine,
|
||||
vector: embeddings[i],
|
||||
}));
|
||||
|
||||
const lance = await this.getLanceDb();
|
||||
const tableNames = await lance.tableNames();
|
||||
if (!tableNames.includes(DocsService.DOCS_TABLE_NAME)) {
|
||||
await lance.createTable(DocsService.DOCS_TABLE_NAME, data);
|
||||
} else {
|
||||
const table = await lance.openTable(DocsService.DOCS_TABLE_NAME);
|
||||
await table.add(data);
|
||||
}
|
||||
|
||||
// Only after add it to SQLite
|
||||
const db = await this.getSqliteTable();
|
||||
await db.run(
|
||||
"INSERT INTO docs (title, baseUrl) VALUES (?, ?)",
|
||||
title,
|
||||
baseUrl.toString(),
|
||||
);
|
||||
const docsService = new DocsService(configOrHandler, ide, messenger);
|
||||
DocsService.instance = docsService;
|
||||
return docsService;
|
||||
}
|
||||
|
||||
async list(): Promise<{ title: string; baseUrl: string }[]> {
|
||||
const db = await this.getSqliteTable();
|
||||
const docs = db.all("SELECT title, baseUrl FROM docs");
|
||||
async isJetBrainsAndPreIndexedDocsProvider(): Promise<boolean> {
|
||||
const isJetBrains = await this.isJetBrains();
|
||||
|
||||
const isPreIndexedDocsProvider =
|
||||
this.config.embeddingsProvider.id ===
|
||||
DocsService.preIndexedDocsEmbeddingsProvider.id;
|
||||
|
||||
return isJetBrains && isPreIndexedDocsProvider;
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently, we generate and host embeddings for pre-indexed docs using transformers.js.
|
||||
* However, we don't ship transformers.js with the JetBrains extension.
|
||||
* So, we only include pre-indexed docs in the submenu for non-JetBrains IDEs.
|
||||
*/
|
||||
async canUsePreindexedDocs() {
|
||||
const isJetBrains = await this.isJetBrains();
|
||||
return !isJetBrains;
|
||||
}
|
||||
|
||||
async delete(startUrl: string) {
|
||||
await this.deleteFromLance(startUrl);
|
||||
await this.deleteFromSqlite(startUrl);
|
||||
this.deleteFromConfig(startUrl);
|
||||
|
||||
if (this.messenger) {
|
||||
this.messenger.send("refreshSubmenuItems", undefined);
|
||||
}
|
||||
}
|
||||
|
||||
async has(startUrl: string): Promise<Promise<boolean>> {
|
||||
const db = await this.getOrCreateSqliteDb();
|
||||
const title = await db.get(
|
||||
`SELECT title FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`,
|
||||
startUrl,
|
||||
);
|
||||
|
||||
return !!title;
|
||||
}
|
||||
|
||||
async indexAllDocs(reIndex: boolean = false) {
|
||||
if (!this.hasDocsContextProvider()) {
|
||||
this.ide.infoPopup(
|
||||
"No 'docs' provider configured under 'contextProviders' in config.json",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const docs = await this.list();
|
||||
|
||||
for (const doc of docs) {
|
||||
const generator = this.indexAndAdd(doc, reIndex);
|
||||
while (!(await generator.next()).done) {}
|
||||
}
|
||||
|
||||
this.ide.infoPopup("Docs indexing completed");
|
||||
}
|
||||
|
||||
async list() {
|
||||
const db = await this.getOrCreateSqliteDb();
|
||||
const docs = await db.all<SqliteDocsRow[]>(
|
||||
`SELECT title, startUrl, favicon FROM ${DocsService.sqlitebTableName}`,
|
||||
);
|
||||
|
||||
return docs;
|
||||
}
|
||||
|
||||
async delete(baseUrl: string) {
|
||||
const db = await this.getSqliteTable();
|
||||
await db.run("DELETE FROM docs WHERE baseUrl = ?", baseUrl);
|
||||
const lance = await this.getLanceDb();
|
||||
const tableNames = await lance.tableNames();
|
||||
if (tableNames.includes(DocsService.DOCS_TABLE_NAME)) {
|
||||
const table = await lance.openTable(DocsService.DOCS_TABLE_NAME);
|
||||
await table.delete(`baseurl = '${baseUrl}'`);
|
||||
}
|
||||
}
|
||||
|
||||
async has(baseUrl: string) {
|
||||
const db = await this.getSqliteTable();
|
||||
const doc = await db.get(
|
||||
"SELECT title FROM docs WHERE baseUrl =?",
|
||||
baseUrl,
|
||||
);
|
||||
return !!doc;
|
||||
}
|
||||
|
||||
private async downloadAndAddPreIndexedDocs(
|
||||
embeddingsProviderId: string,
|
||||
title: string,
|
||||
) {
|
||||
const data = await downloadFromS3(
|
||||
"continue-indexed-docs",
|
||||
`${embeddingsProviderId}/${title}`,
|
||||
"us-west-1",
|
||||
);
|
||||
const results = JSON.parse(data) as SiteIndexingResults;
|
||||
await this.add(
|
||||
results.title,
|
||||
new URL(results.url),
|
||||
results.chunks,
|
||||
results.chunks.map((c) => c.embedding),
|
||||
);
|
||||
}
|
||||
|
||||
async *indexAndAdd(
|
||||
siteIndexingConfig: SiteIndexingConfig,
|
||||
embeddingsProvider: EmbeddingsProvider,
|
||||
reIndex: boolean = false,
|
||||
): AsyncGenerator<IndexingProgressUpdate> {
|
||||
const startUrl = new URL(siteIndexingConfig.startUrl.toString());
|
||||
const { startUrl } = siteIndexingConfig;
|
||||
const embeddingsProvider = await this.getEmbeddingsProvider();
|
||||
|
||||
if (this.docsIndexingQueue.has(startUrl.toString())) {
|
||||
if (this.docsIndexingQueue.has(startUrl)) {
|
||||
console.log("Already in queue");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!reIndex && (await this.has(startUrl.toString()))) {
|
||||
if (!reIndex && (await this.has(startUrl))) {
|
||||
yield {
|
||||
progress: 1,
|
||||
desc: "Already indexed",
|
||||
|
|
@ -230,7 +190,7 @@ export class DocsService {
|
|||
}
|
||||
|
||||
// Mark the site as currently being indexed
|
||||
this.docsIndexingQueue.add(startUrl.toString());
|
||||
this.docsIndexingQueue.add(startUrl);
|
||||
|
||||
yield {
|
||||
progress: 0,
|
||||
|
|
@ -243,12 +203,18 @@ export class DocsService {
|
|||
let maxKnownPages = 1;
|
||||
|
||||
// Crawl pages and retrieve info as articles
|
||||
for await (const page of crawlPage(startUrl, siteIndexingConfig.maxDepth)) {
|
||||
for await (const page of crawlPage(
|
||||
new URL(startUrl),
|
||||
siteIndexingConfig.maxDepth,
|
||||
)) {
|
||||
processedPages++;
|
||||
|
||||
const article = pageToArticle(page);
|
||||
|
||||
if (!article) {
|
||||
continue;
|
||||
}
|
||||
|
||||
articles.push(article);
|
||||
|
||||
// Use a heuristic approach for progress calculation
|
||||
|
|
@ -281,14 +247,19 @@ export class DocsService {
|
|||
};
|
||||
|
||||
try {
|
||||
const subpathEmbeddings = await embeddingsProvider.embed(
|
||||
chunkArticle(article, embeddingsProvider.maxChunkSize).map(
|
||||
(chunk) => {
|
||||
chunks.push(chunk);
|
||||
const chunkedArticle = chunkArticle(
|
||||
article,
|
||||
embeddingsProvider.maxChunkSize,
|
||||
);
|
||||
|
||||
return chunk.content;
|
||||
},
|
||||
),
|
||||
const chunkedArticleContents = chunkedArticle.map(
|
||||
(chunk) => chunk.content,
|
||||
);
|
||||
|
||||
chunks.push(...chunkedArticle);
|
||||
|
||||
const subpathEmbeddings = await embeddingsProvider.embed(
|
||||
chunkedArticleContents,
|
||||
);
|
||||
|
||||
embeddings.push(...subpathEmbeddings);
|
||||
|
|
@ -297,8 +268,23 @@ export class DocsService {
|
|||
}
|
||||
}
|
||||
|
||||
if (embeddings.length === 0) {
|
||||
console.error(
|
||||
`No embeddings were created for site: ${siteIndexingConfig.startUrl}\n Num chunks: ${chunks.length}`,
|
||||
);
|
||||
|
||||
yield {
|
||||
progress: 1,
|
||||
desc: `No embeddings were created for site: ${siteIndexingConfig.startUrl}`,
|
||||
status: "failed",
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Add docs to databases
|
||||
console.log("Adding ", embeddings.length, " embeddings to db");
|
||||
console.log(`Adding ${embeddings.length} embeddings to db`);
|
||||
|
||||
yield {
|
||||
progress: 0.5,
|
||||
desc: `Adding ${embeddings.length} embeddings to db`,
|
||||
|
|
@ -308,27 +294,503 @@ export class DocsService {
|
|||
// Clear old index if re-indexing.
|
||||
if (reIndex) {
|
||||
console.log("Deleting old embeddings");
|
||||
await this.delete(startUrl.toString());
|
||||
await this.delete(startUrl);
|
||||
}
|
||||
|
||||
await this.add(siteIndexingConfig.title, startUrl, chunks, embeddings);
|
||||
this.docsIndexingQueue.delete(startUrl.toString());
|
||||
const favicon = await this.fetchFavicon(siteIndexingConfig);
|
||||
|
||||
await this.add({
|
||||
siteIndexingConfig,
|
||||
chunks,
|
||||
embeddings,
|
||||
favicon,
|
||||
});
|
||||
|
||||
this.docsIndexingQueue.delete(startUrl);
|
||||
|
||||
yield {
|
||||
progress: 1,
|
||||
desc: "Done",
|
||||
status: "done",
|
||||
};
|
||||
|
||||
console.log(`Successfully indexed: ${siteIndexingConfig.startUrl}`);
|
||||
|
||||
if (this.messenger) {
|
||||
this.messenger.send("refreshSubmenuItems", undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public isJetBrainsAndPreIndexedDocsProvider(
|
||||
ideInfo: IdeInfo,
|
||||
embeddingsProviderId: EmbeddingsProvider["id"],
|
||||
): boolean {
|
||||
const isJetBrains = ideInfo.ideType === "jetbrains";
|
||||
const isPreIndexedDocsProvider =
|
||||
embeddingsProviderId === DocsService.preIndexedDocsEmbeddingsProvider.id;
|
||||
async retrieveChunks(
|
||||
startUrl: string,
|
||||
vector: number[],
|
||||
nRetrieve: number,
|
||||
isRetry: boolean = false,
|
||||
): Promise<Chunk[]> {
|
||||
const table = await this.getOrCreateLanceTable({
|
||||
initializationVector: vector,
|
||||
isPreIndexedDoc: !!preIndexedDocs[startUrl],
|
||||
});
|
||||
|
||||
return isJetBrains && isPreIndexedDocsProvider;
|
||||
const docs: LanceDbDocsRow[] = await table
|
||||
.search(vector)
|
||||
.limit(nRetrieve)
|
||||
.where(`starturl = '${startUrl}'`)
|
||||
.execute();
|
||||
|
||||
const hasIndexedDoc = await this.hasIndexedDoc(startUrl);
|
||||
|
||||
if (!hasIndexedDoc && docs.length === 0) {
|
||||
const preIndexedDoc = preIndexedDocs[startUrl];
|
||||
|
||||
if (isRetry || !preIndexedDoc) {
|
||||
return [];
|
||||
}
|
||||
|
||||
await this.fetchAndAddPreIndexedDocEmbeddings(preIndexedDoc.title);
|
||||
return await this.retrieveChunks(startUrl, vector, nRetrieve, true);
|
||||
}
|
||||
|
||||
return docs.map((doc) => ({
|
||||
digest: doc.path,
|
||||
filepath: doc.path,
|
||||
startLine: doc.startline,
|
||||
endLine: doc.endline,
|
||||
index: 0,
|
||||
content: doc.content,
|
||||
otherMetadata: {
|
||||
title: doc.title,
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
async getEmbeddingsProvider(isPreIndexedDoc: boolean = false) {
|
||||
const canUsePreindexedDocs = await this.canUsePreindexedDocs();
|
||||
|
||||
if (isPreIndexedDoc && canUsePreindexedDocs) {
|
||||
return DocsService.preIndexedDocsEmbeddingsProvider;
|
||||
}
|
||||
|
||||
return this.config.embeddingsProvider;
|
||||
}
|
||||
|
||||
async getFavicon(startUrl: string) {
|
||||
const db = await this.getOrCreateSqliteDb();
|
||||
const { favicon } = await db.get(
|
||||
`SELECT favicon FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`,
|
||||
startUrl,
|
||||
);
|
||||
|
||||
return favicon;
|
||||
}
|
||||
|
||||
/**
|
||||
* A ConfigHandler is passed to the DocsService in `core` when
|
||||
* we don't yet have access to the config object. This handler
|
||||
* is used to set up a single instance of the DocsService that
|
||||
* subscribes to config updates, e.g. to trigger re-indexing
|
||||
* on a new embeddings provider.
|
||||
*/
|
||||
private async init(configHandler: ConfigHandler) {
|
||||
if (configHandler instanceof ConfigHandler) {
|
||||
this.config = await configHandler.loadConfig();
|
||||
} else {
|
||||
this.config = configHandler;
|
||||
}
|
||||
|
||||
const embeddingsProvider = await this.getEmbeddingsProvider();
|
||||
|
||||
this.globalContext.update("curEmbeddingsProviderId", embeddingsProvider.id);
|
||||
|
||||
configHandler.onConfigUpdate(async (newConfig) => {
|
||||
const oldConfig = this.config;
|
||||
|
||||
// Need to update class property for config at the beginning of this callback
|
||||
// to ensure downstream methods have access to the latest config.
|
||||
this.config = newConfig;
|
||||
|
||||
if (oldConfig.docs !== newConfig.docs) {
|
||||
await this.syncConfigAndSqlite();
|
||||
}
|
||||
|
||||
const shouldReindex = await this.shouldReindexDocsOnNewEmbeddingsProvider(
|
||||
newConfig.embeddingsProvider.id,
|
||||
);
|
||||
|
||||
if (shouldReindex) {
|
||||
await this.reindexDocsOnNewEmbeddingsProvider(
|
||||
newConfig.embeddingsProvider,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async syncConfigAndSqlite() {
|
||||
this.isSyncing = true;
|
||||
|
||||
const sqliteDocs = await this.list();
|
||||
const sqliteDocStartUrls = sqliteDocs.map((doc) => doc.startUrl) || [];
|
||||
|
||||
const configDocs = this.config.docs || [];
|
||||
const configDocStartUrls =
|
||||
this.config.docs?.map((doc) => doc.startUrl) || [];
|
||||
|
||||
const newDocs = configDocs.filter(
|
||||
(doc) => !sqliteDocStartUrls.includes(doc.startUrl),
|
||||
);
|
||||
const deletedDocs = sqliteDocs.filter(
|
||||
(doc) =>
|
||||
!configDocStartUrls.includes(doc.startUrl) &&
|
||||
!preIndexedDocs[doc.startUrl],
|
||||
);
|
||||
|
||||
for (const doc of newDocs) {
|
||||
console.log(`Indexing new doc: ${doc.startUrl}`);
|
||||
Telemetry.capture("add_docs_config", { url: doc.startUrl });
|
||||
|
||||
const generator = this.indexAndAdd(doc);
|
||||
while (!(await generator.next()).done) {}
|
||||
}
|
||||
|
||||
for (const doc of deletedDocs) {
|
||||
console.log(`Deleting doc: ${doc.startUrl}`);
|
||||
await this.delete(doc.startUrl);
|
||||
}
|
||||
|
||||
this.isSyncing = false;
|
||||
}
|
||||
|
||||
private hasDocsContextProvider() {
|
||||
return !!this.config.contextProviders?.some(
|
||||
(provider) =>
|
||||
provider.description.title === DocsContextProvider.description.title,
|
||||
);
|
||||
}
|
||||
|
||||
private async getOrCreateSqliteDb() {
|
||||
if (!this.sqliteDb) {
|
||||
const db = await open({
|
||||
filename: getDocsSqlitePath(),
|
||||
driver: sqlite3.Database,
|
||||
});
|
||||
|
||||
await runSqliteMigrations(db);
|
||||
|
||||
db.exec(`CREATE TABLE IF NOT EXISTS ${DocsService.sqlitebTableName} (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title STRING NOT NULL,
|
||||
startUrl STRING NOT NULL UNIQUE,
|
||||
favicon STRING
|
||||
)`);
|
||||
|
||||
this.sqliteDb = db;
|
||||
}
|
||||
|
||||
return this.sqliteDb;
|
||||
}
|
||||
|
||||
private async createLanceDocsTable(
|
||||
connection: Connection,
|
||||
initializationVector: number[],
|
||||
tableName: string,
|
||||
) {
|
||||
const mockRowTitle = "mockRowTitle";
|
||||
const mockRow: LanceDbDocsRow[] = [
|
||||
{
|
||||
title: mockRowTitle,
|
||||
vector: initializationVector,
|
||||
starturl: "",
|
||||
content: "",
|
||||
path: "",
|
||||
startline: 0,
|
||||
endline: 0,
|
||||
},
|
||||
];
|
||||
|
||||
const table = await connection.createTable(tableName, mockRow);
|
||||
|
||||
await runLanceMigrations(table);
|
||||
|
||||
await table.delete(`title = '${mockRowTitle}'`);
|
||||
}
|
||||
|
||||
private removeInvalidLanceTableNameChars(tableName: string) {
|
||||
return tableName.replace(/:/g, "");
|
||||
}
|
||||
|
||||
private async getLanceTableNameFromEmbeddingsProvider(
|
||||
isPreIndexedDoc: boolean,
|
||||
) {
|
||||
const embeddingsProvider = await this.getEmbeddingsProvider(
|
||||
isPreIndexedDoc,
|
||||
);
|
||||
const embeddingsProviderId = this.removeInvalidLanceTableNameChars(
|
||||
embeddingsProvider.id,
|
||||
);
|
||||
const tableName = `${DocsService.lanceTableName}${embeddingsProviderId}`;
|
||||
|
||||
return tableName;
|
||||
}
|
||||
|
||||
private async getOrCreateLanceTable({
|
||||
initializationVector,
|
||||
isPreIndexedDoc,
|
||||
}: {
|
||||
initializationVector: number[];
|
||||
isPreIndexedDoc?: boolean;
|
||||
}) {
|
||||
const conn = await lancedb.connect(getLanceDbPath());
|
||||
const tableNames = await conn.tableNames();
|
||||
const tableNameFromEmbeddingsProvider =
|
||||
await this.getLanceTableNameFromEmbeddingsProvider(!!isPreIndexedDoc);
|
||||
|
||||
if (!tableNames.includes(tableNameFromEmbeddingsProvider)) {
|
||||
if (initializationVector) {
|
||||
await this.createLanceDocsTable(
|
||||
conn,
|
||||
initializationVector,
|
||||
tableNameFromEmbeddingsProvider,
|
||||
);
|
||||
} else {
|
||||
console.trace(
|
||||
"No existing Lance DB docs table was found and no initialization " +
|
||||
"vector was passed to create one",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const table = await conn.openTable(tableNameFromEmbeddingsProvider);
|
||||
|
||||
this.lanceTableNamesSet.add(tableNameFromEmbeddingsProvider);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
private async isJetBrains() {
|
||||
const ideInfo = await this.ide.getIdeInfo();
|
||||
return ideInfo.ideType === "jetbrains";
|
||||
}
|
||||
|
||||
private async hasIndexedDoc(startUrl: string) {
|
||||
const db = await this.getOrCreateSqliteDb();
|
||||
const docs = await db.all(
|
||||
`SELECT startUrl FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`,
|
||||
startUrl,
|
||||
);
|
||||
|
||||
return docs.length > 0;
|
||||
}
|
||||
|
||||
private async addToLance({
|
||||
chunks,
|
||||
siteIndexingConfig,
|
||||
embeddings,
|
||||
}: AddParams) {
|
||||
const sampleVector = embeddings[0];
|
||||
const isPreIndexedDoc = !!preIndexedDocs[siteIndexingConfig.startUrl];
|
||||
const table = await this.getOrCreateLanceTable({
|
||||
isPreIndexedDoc,
|
||||
initializationVector: sampleVector,
|
||||
});
|
||||
|
||||
const rows: LanceDbDocsRow[] = chunks.map((chunk, i) => ({
|
||||
vector: embeddings[i],
|
||||
starturl: siteIndexingConfig.startUrl,
|
||||
title: chunk.otherMetadata?.title || siteIndexingConfig.title,
|
||||
content: chunk.content,
|
||||
path: chunk.filepath,
|
||||
startline: chunk.startLine,
|
||||
endline: chunk.endLine,
|
||||
}));
|
||||
|
||||
await table.add(rows);
|
||||
}
|
||||
|
||||
private async addToSqlite({
|
||||
siteIndexingConfig: { title, startUrl },
|
||||
favicon,
|
||||
}: AddParams) {
|
||||
const db = await this.getOrCreateSqliteDb();
|
||||
await db.run(
|
||||
`INSERT INTO ${DocsService.sqlitebTableName} (title, startUrl, favicon) VALUES (?, ?, ?)`,
|
||||
title,
|
||||
startUrl,
|
||||
favicon,
|
||||
);
|
||||
}
|
||||
|
||||
private addToConfig({ siteIndexingConfig }: AddParams) {
|
||||
// Handles the case where a user has manually added the doc to config.json
|
||||
// so it already exists in the file
|
||||
const doesDocExist = this.config.docs?.some(
|
||||
(doc) => doc.startUrl === siteIndexingConfig.startUrl,
|
||||
);
|
||||
|
||||
if (!doesDocExist) {
|
||||
editConfigJson((config) => ({
|
||||
...config,
|
||||
docs: [...(config.docs ?? []), siteIndexingConfig],
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private async add(params: AddParams) {
|
||||
await this.addToLance(params);
|
||||
await this.addToSqlite(params);
|
||||
|
||||
const isPreIndexedDoc =
|
||||
!!preIndexedDocs[params.siteIndexingConfig.startUrl];
|
||||
|
||||
if (!isPreIndexedDoc) {
|
||||
this.addToConfig(params);
|
||||
}
|
||||
}
|
||||
|
||||
private async deleteFromLance(startUrl: string) {
|
||||
for (const tableName of this.lanceTableNamesSet) {
|
||||
const conn = await lancedb.connect(getLanceDbPath());
|
||||
const table = await conn.openTable(tableName);
|
||||
await table.delete(`starturl = '${startUrl}'`);
|
||||
}
|
||||
}
|
||||
|
||||
private async deleteFromSqlite(startUrl: string) {
|
||||
const db = await this.getOrCreateSqliteDb();
|
||||
await db.run(
|
||||
`DELETE FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`,
|
||||
startUrl,
|
||||
);
|
||||
}
|
||||
|
||||
deleteFromConfig(startUrl: string) {
|
||||
editConfigJson((config) => ({
|
||||
...config,
|
||||
docs: config.docs?.filter((doc) => doc.startUrl !== startUrl) || [],
|
||||
}));
|
||||
}
|
||||
|
||||
private async fetchAndAddPreIndexedDocEmbeddings(title: string) {
|
||||
const embeddingsProvider = await this.getEmbeddingsProvider(true);
|
||||
|
||||
const data = await downloadFromS3(
|
||||
S3Buckets.continueIndexedDocs,
|
||||
getS3Filename(embeddingsProvider.id, title),
|
||||
);
|
||||
|
||||
const siteEmbeddings = JSON.parse(data) as SiteIndexingResults;
|
||||
const startUrl = new URL(siteEmbeddings.url).toString();
|
||||
const favicon = await this.fetchFavicon(preIndexedDocs[startUrl]);
|
||||
|
||||
await this.add({
|
||||
favicon,
|
||||
siteIndexingConfig: {
|
||||
startUrl,
|
||||
title: siteEmbeddings.title,
|
||||
},
|
||||
chunks: siteEmbeddings.chunks,
|
||||
embeddings: siteEmbeddings.chunks.map((c) => c.embedding),
|
||||
});
|
||||
}
|
||||
|
||||
private async fetchFavicon(siteIndexingConfig: SiteIndexingConfig) {
|
||||
const faviconUrl =
|
||||
siteIndexingConfig.faviconUrl ??
|
||||
new URL("/favicon.ico", siteIndexingConfig.startUrl);
|
||||
|
||||
try {
|
||||
const response = await fetch(faviconUrl);
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
const base64 = btoa(
|
||||
new Uint8Array(arrayBuffer).reduce(
|
||||
(data, byte) => data + String.fromCharCode(byte),
|
||||
"",
|
||||
),
|
||||
);
|
||||
const mimeType = response.headers.get("content-type") || "image/x-icon";
|
||||
|
||||
return `data:${mimeType};base64,${base64}`;
|
||||
} catch {
|
||||
console.error(`Failed to fetch favicon: ${faviconUrl}`);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private async shouldReindexDocsOnNewEmbeddingsProvider(
|
||||
curEmbeddingsProviderId: EmbeddingsProvider["id"],
|
||||
): Promise<boolean> {
|
||||
const isJetBrainsAndPreIndexedDocsProvider =
|
||||
await this.isJetBrainsAndPreIndexedDocsProvider();
|
||||
|
||||
if (isJetBrainsAndPreIndexedDocsProvider) {
|
||||
this.ide.errorPopup(
|
||||
"The 'transformers.js' embeddings provider currently cannot be used to index " +
|
||||
"documentation in JetBrains. To enable documentation indexing, you can use " +
|
||||
"any of the other providers described in the docs: " +
|
||||
"https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers",
|
||||
);
|
||||
|
||||
this.globalContext.update(
|
||||
"curEmbeddingsProviderId",
|
||||
curEmbeddingsProviderId,
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const lastEmbeddingsProviderId = this.globalContext.get(
|
||||
"curEmbeddingsProviderId",
|
||||
);
|
||||
|
||||
if (!lastEmbeddingsProviderId) {
|
||||
// If it's the first time we're setting the `curEmbeddingsProviderId`
|
||||
// global state, we don't need to reindex docs
|
||||
this.globalContext.update(
|
||||
"curEmbeddingsProviderId",
|
||||
curEmbeddingsProviderId,
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return lastEmbeddingsProviderId !== curEmbeddingsProviderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently this deletes re-crawls + re-indexes all docs.
|
||||
* A more optimal solution in the future will be to create
|
||||
* a per-embeddings-provider table for docs.
|
||||
*/
|
||||
private async reindexDocsOnNewEmbeddingsProvider(
|
||||
embeddingsProvider: EmbeddingsProvider,
|
||||
) {
|
||||
// We use config as our source of truth here since it contains additional information
|
||||
// needed for re-crawling such as `faviconUrl` and `maxDepth`.
|
||||
const { docs } = this.config;
|
||||
|
||||
if (!docs || docs.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Reindexing docs with new embeddings provider: ${embeddingsProvider.id}`,
|
||||
);
|
||||
|
||||
for (const doc of docs) {
|
||||
await this.delete(doc.startUrl);
|
||||
|
||||
const generator = this.indexAndAdd(doc);
|
||||
|
||||
while (!(await generator.next()).done) {}
|
||||
}
|
||||
|
||||
// Important that this only is invoked after we have successfully
|
||||
// cleared and reindex the docs so that the table cannot end up in an
|
||||
// invalid state.
|
||||
this.globalContext.update("curEmbeddingsProviderId", embeddingsProvider.id);
|
||||
|
||||
console.log("Completed reindexing of all docs");
|
||||
}
|
||||
}
|
||||
|
||||
export const docsServiceSingleton = DocsService.getSingleton();
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ function extractTitlesAndBodies(html: string): ArticleComponent[] {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function stringToArticle(
|
||||
url: string,
|
||||
html: string,
|
||||
|
|
|
|||
70
core/indexing/docs/migrations.ts
Normal file
70
core/indexing/docs/migrations.ts
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import { Table } from "vectordb";
|
||||
import { editConfigJson, migrate } from "../../util/paths.js";
|
||||
import { type Database } from "sqlite";
|
||||
import DocsService, { SqliteDocsRow } from "./DocsService.js";
|
||||
|
||||
export async function runLanceMigrations(table: Table) {
|
||||
await new Promise((resolve) =>
|
||||
migrate(
|
||||
"rename_baseurl_column_for_lance_docs",
|
||||
async () => {
|
||||
try {
|
||||
const schema = await table.schema;
|
||||
|
||||
if (schema.fields.some((field: any) => field.name === "baseurl")) {
|
||||
await table.alterColumns([{ path: "baseurl", rename: "starturl" }]);
|
||||
}
|
||||
} finally {
|
||||
resolve(undefined);
|
||||
}
|
||||
},
|
||||
() => resolve(undefined),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export async function runSqliteMigrations(db: Database) {
|
||||
await new Promise((resolve) => {
|
||||
migrate(
|
||||
"sqlite_modify_docs_columns_and_copy_to_config",
|
||||
async () => {
|
||||
try {
|
||||
const pragma = await db.all(
|
||||
`PRAGMA table_info(${DocsService.sqlitebTableName})`,
|
||||
);
|
||||
|
||||
const hasFaviconCol = pragma.some(
|
||||
(pragma) => pragma.name === "favicon",
|
||||
);
|
||||
const hasBaseUrlCol = pragma.some(
|
||||
(pragma) => pragma.name === "baseUrl",
|
||||
);
|
||||
|
||||
if (!hasFaviconCol) {
|
||||
await db.exec(
|
||||
`ALTER TABLE ${DocsService.sqlitebTableName} ADD COLUMN favicon BLOB`,
|
||||
);
|
||||
}
|
||||
|
||||
if (hasBaseUrlCol) {
|
||||
await db.exec(
|
||||
`ALTER TABLE ${DocsService.sqlitebTableName} RENAME COLUMN baseUrl TO startUrl`,
|
||||
);
|
||||
}
|
||||
|
||||
const sqliteDocs = await db.all<
|
||||
Array<Pick<SqliteDocsRow, "title" | "startUrl">>
|
||||
>(`SELECT title, startUrl FROM ${DocsService.sqlitebTableName}`);
|
||||
|
||||
editConfigJson((config) => ({
|
||||
...config,
|
||||
docs: [...(config.docs || []), ...sqliteDocs],
|
||||
}));
|
||||
} finally {
|
||||
resolve(undefined);
|
||||
}
|
||||
},
|
||||
() => resolve(undefined),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
@ -1,16 +1,28 @@
|
|||
import { Chunk } from "../../index.js";
|
||||
import { Chunk } from "../../";
|
||||
import request from "request";
|
||||
|
||||
export function getS3Filename(
|
||||
embeddingsProviderId: string,
|
||||
title: string,
|
||||
): string {
|
||||
return `${embeddingsProviderId}/${title}`;
|
||||
}
|
||||
|
||||
export enum S3Buckets {
|
||||
continueIndexedDocs = "continue-indexed-docs",
|
||||
}
|
||||
|
||||
const AWS_REGION = "us-west-1";
|
||||
|
||||
export async function downloadFromS3(
|
||||
bucket: string,
|
||||
fileName: string,
|
||||
region: string,
|
||||
): Promise<string> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
let data = "";
|
||||
|
||||
const download = request({
|
||||
url: `https://${bucket}.s3.${region}.amazonaws.com/${fileName}`,
|
||||
url: `https://${bucket}.s3.${AWS_REGION}.amazonaws.com/${fileName}`,
|
||||
});
|
||||
download.on("response", (response: any) => {
|
||||
if (response.statusCode !== 200) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export class TransformersJsEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
static providerName: EmbeddingsProviderName = "transformers.js";
|
||||
static maxGroupSize: number = 4;
|
||||
static model: string = "all-MiniLM-L6-v2";
|
||||
static mockVector: number[] = Array.from({ length: 384 }).fill(2) as number[];
|
||||
|
||||
constructor() {
|
||||
super({ model: TransformersJsEmbeddingsProvider.model }, () =>
|
||||
|
|
@ -49,6 +50,11 @@ export class TransformersJsEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
// Workaround to ignore testing issues in Jest
|
||||
if (process.env.NODE_ENV === "test") {
|
||||
return chunks.map(() => TransformersJsEmbeddingsProvider.mockVector);
|
||||
}
|
||||
|
||||
const extractor = await EmbeddingsPipeline.getInstance();
|
||||
|
||||
if (!extractor) {
|
||||
|
|
|
|||
|
|
@ -68,37 +68,35 @@ export const DEFAULT_IGNORE_FILETYPES = [
|
|||
// "*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt
|
||||
];
|
||||
|
||||
// @ts-ignore
|
||||
export const defaultIgnoreFile = ignore.default().add(DEFAULT_IGNORE_FILETYPES);
|
||||
export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES);
|
||||
export const DEFAULT_IGNORE_DIRS = [
|
||||
".git",
|
||||
".svn",
|
||||
".vscode",
|
||||
".idea",
|
||||
".vs",
|
||||
"venv",
|
||||
".venv",
|
||||
"env",
|
||||
".env",
|
||||
"node_modules",
|
||||
"dist",
|
||||
"build",
|
||||
"target",
|
||||
"out",
|
||||
"bin",
|
||||
".pytest_cache",
|
||||
".vscode-test",
|
||||
".continue",
|
||||
"__pycache__",
|
||||
"site-packages",
|
||||
".gradle",
|
||||
".cache",
|
||||
"gems",
|
||||
"vendor",
|
||||
".git/",
|
||||
".svn/",
|
||||
".vscode/",
|
||||
".idea/",
|
||||
".vs/",
|
||||
"venv/",
|
||||
".venv/",
|
||||
"env/",
|
||||
".env/",
|
||||
"node_modules/",
|
||||
"dist/",
|
||||
"build/",
|
||||
"target/",
|
||||
"out/",
|
||||
"bin/",
|
||||
".pytest_cache/",
|
||||
".vscode-test/",
|
||||
".continue/",
|
||||
"__pycache__/",
|
||||
"site-packages/",
|
||||
".gradle/",
|
||||
".cache/",
|
||||
"gems/",
|
||||
"vendor/",
|
||||
];
|
||||
|
||||
// @ts-ignore
|
||||
export const defaultIgnoreDir = ignore.default().add(DEFAULT_IGNORE_DIRS);
|
||||
export const defaultIgnoreDir = ignore().add(DEFAULT_IGNORE_DIRS);
|
||||
|
||||
export const DEFAULT_IGNORE =
|
||||
DEFAULT_IGNORE_FILETYPES.join("\n") + "\n" + DEFAULT_IGNORE_DIRS.join("\n");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Minimatch } from "minimatch";
|
||||
import path from "node:path";
|
||||
import { FileType, IDE } from "../index.d.js";
|
||||
import ignore, { Ignore } from "ignore";
|
||||
import {
|
||||
DEFAULT_IGNORE_DIRS,
|
||||
DEFAULT_IGNORE_FILETYPES,
|
||||
|
|
@ -28,40 +28,9 @@ type WalkableEntry = {
|
|||
// helper struct used for the DFS walk
|
||||
type WalkContext = {
|
||||
walkableEntry: WalkableEntry;
|
||||
ignoreFiles: IgnoreFile[];
|
||||
ignore: Ignore;
|
||||
};
|
||||
|
||||
class IgnoreFile {
|
||||
private _rules: Minimatch[];
|
||||
|
||||
constructor(
|
||||
public path: string,
|
||||
public content: string,
|
||||
) {
|
||||
this.path = path;
|
||||
this.content = content;
|
||||
this._rules = this.contentToRules(content);
|
||||
}
|
||||
|
||||
public get rules() {
|
||||
return this._rules;
|
||||
}
|
||||
|
||||
private contentToRules(content: string): Minimatch[] {
|
||||
const options = {
|
||||
matchBase: true,
|
||||
dot: true,
|
||||
flipNegate: true,
|
||||
nocase: true,
|
||||
};
|
||||
return content
|
||||
.split(/\r?\n/)
|
||||
.map((l) => l.trim())
|
||||
.filter((l) => !/^#|^$/.test(l))
|
||||
.map((l) => new Minimatch(l, options));
|
||||
}
|
||||
}
|
||||
|
||||
class DFSWalker {
|
||||
private readonly path: string;
|
||||
private readonly ide: IDE;
|
||||
|
|
@ -84,23 +53,23 @@ class DFSWalker {
|
|||
type: 2 as FileType.Directory,
|
||||
entry: ["", 2 as FileType.Directory],
|
||||
},
|
||||
ignoreFiles: [],
|
||||
ignore: ignore().add(defaultIgnoreDir).add(defaultIgnoreFile),
|
||||
};
|
||||
const stack = [root];
|
||||
for (let cur = stack.pop(); cur; cur = stack.pop()) {
|
||||
const walkableEntries = await this.listDirForWalking(cur.walkableEntry);
|
||||
const ignoreFiles = await this.getIgnoreFilesToApplyInDir(
|
||||
cur.ignoreFiles,
|
||||
const ignore = await this.getIgnoreToApplyInDir(
|
||||
cur.ignore,
|
||||
walkableEntries,
|
||||
);
|
||||
for (const w of walkableEntries) {
|
||||
if (!this.shouldInclude(w, ignoreFiles)) {
|
||||
if (!this.shouldInclude(w, ignore)) {
|
||||
continue;
|
||||
}
|
||||
if (this.entryIsDirectory(w.entry)) {
|
||||
stack.push({
|
||||
walkableEntry: w,
|
||||
ignoreFiles: ignoreFiles,
|
||||
ignore: ignore,
|
||||
});
|
||||
if (this.options.onlyDirs) {
|
||||
// when onlyDirs is enabled the walker will only return directory names
|
||||
|
|
@ -127,24 +96,28 @@ class DFSWalker {
|
|||
});
|
||||
}
|
||||
|
||||
private async getIgnoreFilesToApplyInDir(
|
||||
parentIgnoreFiles: IgnoreFile[],
|
||||
private async getIgnoreToApplyInDir(
|
||||
parentIgnore: Ignore,
|
||||
walkableEntries: WalkableEntry[],
|
||||
): Promise<IgnoreFile[]> {
|
||||
): Promise<Ignore> {
|
||||
const ignoreFilesInDir = await this.loadIgnoreFiles(walkableEntries);
|
||||
if (ignoreFilesInDir.length === 0) {
|
||||
return parentIgnoreFiles;
|
||||
return parentIgnore;
|
||||
}
|
||||
return Array.prototype.concat(parentIgnoreFiles, ignoreFilesInDir);
|
||||
const patterns = ignoreFilesInDir.map(c => {
|
||||
return c.split(/\r?\n/)
|
||||
.map((l) => l.trim())
|
||||
.filter((l) => !/^#|^$/.test(l));
|
||||
}).flat();
|
||||
return ignore().add(parentIgnore).add(patterns);
|
||||
}
|
||||
|
||||
private async loadIgnoreFiles(
|
||||
entries: WalkableEntry[],
|
||||
): Promise<IgnoreFile[]> {
|
||||
): Promise<string[]> {
|
||||
const ignoreEntries = entries.filter((w) => this.isIgnoreFile(w.entry));
|
||||
const promises = ignoreEntries.map(async (w) => {
|
||||
const content = await this.ide.readFile(w.absPath);
|
||||
return new IgnoreFile(w.relPath, content);
|
||||
return await this.ide.readFile(w.absPath);
|
||||
});
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
|
@ -156,7 +129,7 @@ class DFSWalker {
|
|||
|
||||
private shouldInclude(
|
||||
walkableEntry: WalkableEntry,
|
||||
ignoreFiles: IgnoreFile[],
|
||||
ignore: Ignore,
|
||||
) {
|
||||
if (this.entryIsSymlink(walkableEntry.entry)) {
|
||||
// If called from the root, a symlink either links to a real file in this repository,
|
||||
|
|
@ -166,32 +139,13 @@ class DFSWalker {
|
|||
}
|
||||
let relPath = walkableEntry.relPath;
|
||||
if (this.entryIsDirectory(walkableEntry.entry)) {
|
||||
if (defaultIgnoreDir.ignores(walkableEntry.relPath)) {
|
||||
return false;
|
||||
}
|
||||
relPath = `${relPath}/`;
|
||||
} else {
|
||||
if (this.options.onlyDirs) {
|
||||
return false;
|
||||
}
|
||||
if (defaultIgnoreFile.ignores(walkableEntry.relPath)) {
|
||||
return false;
|
||||
}
|
||||
relPath = `/${relPath}`;
|
||||
}
|
||||
let included = true;
|
||||
for (const ignoreFile of ignoreFiles) {
|
||||
for (const r of ignoreFile.rules) {
|
||||
if (r.negate === included) {
|
||||
// no need to test when the file is already NOT to be included unless this is a negate rule and vice versa
|
||||
continue;
|
||||
}
|
||||
if (r.match(relPath)) {
|
||||
included = r.negate;
|
||||
}
|
||||
}
|
||||
}
|
||||
return included;
|
||||
return !ignore.ignores(relPath);
|
||||
}
|
||||
|
||||
private entryIsDirectory(entry: Entry) {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ import { fileURLToPath } from "url";
|
|||
|
||||
export default {
|
||||
transform: {
|
||||
"\\.[jt]sx?$": ["ts-jest", { useESM: true }],
|
||||
"^.+\\.(ts|js)$": ["ts-jest", { useESM: true, useIsolatedModules: true }],
|
||||
},
|
||||
|
||||
moduleNameMapper: {
|
||||
"^(\\.{1,2}/.*)\\.js$": "$1",
|
||||
"^uuid$": "uuid", // https://stackoverflow.com/a/73626360
|
||||
},
|
||||
extensionsToTreatAsEsm: [".ts"],
|
||||
preset: "ts-jest/presets/default-esm",
|
||||
|
|
@ -18,4 +18,5 @@ export default {
|
|||
__filename: path.resolve(fileURLToPath(import.meta.url)),
|
||||
},
|
||||
globalSetup: "<rootDir>/jest.global-setup.ts",
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup-after-env.ts"],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
// jest.global-setup.js
|
||||
import path from "path";
|
||||
|
||||
export default async function () {
|
||||
|
|
|
|||
16
core/jest.setup-after-env.ts
Normal file
16
core/jest.setup-after-env.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// https://github.com/mswjs/msw/issues/1576#issuecomment-1482643055
|
||||
import { TextEncoder, TextDecoder } from "util";
|
||||
import fetch, { Request, Response } from "node-fetch";
|
||||
import { jest } from "@jest/globals";
|
||||
|
||||
if (process.env.DEBUG === "jest") {
|
||||
jest.setTimeout(5 * 60 * 1000);
|
||||
}
|
||||
|
||||
const globalThis = global as any;
|
||||
|
||||
globalThis.fetch = fetch;
|
||||
globalThis.Request = Request;
|
||||
globalThis.Response = Response;
|
||||
globalThis.TextEncoder = TextEncoder;
|
||||
globalThis.TextDecoder = TextDecoder;
|
||||
|
|
@ -105,6 +105,16 @@ export abstract class BaseLLM implements ILLM {
|
|||
accountId?: string;
|
||||
aiGatewaySlug?: string;
|
||||
|
||||
// For WatsonX only.
|
||||
|
||||
watsonxUrl?: string;
|
||||
watsonxApiKey?: string;
|
||||
watsonxZenApiKeyBase64?:string = "YOUR_WATSONX_ZENAPIKEY" // Required if using watsonx software with ZenApiKey auth
|
||||
watsonxUsername?:string;
|
||||
watsonxPassword?:string;
|
||||
watsonxProjectId?: string;
|
||||
|
||||
|
||||
private _llmOptions: LLMOptions;
|
||||
|
||||
constructor(_options: LLMOptions) {
|
||||
|
|
@ -156,6 +166,13 @@ export abstract class BaseLLM implements ILLM {
|
|||
this.apiKey = options.apiKey;
|
||||
this.aiGatewaySlug = options.aiGatewaySlug;
|
||||
this.apiBase = options.apiBase;
|
||||
// for watsonx only
|
||||
this.watsonxUrl = options.watsonxUrl;
|
||||
this.watsonxApiKey = options.watsonxApiKey;
|
||||
this.watsonxProjectId = options.watsonxProjectId;
|
||||
this.watsonxUsername = options.watsonxUsername;
|
||||
this.watsonxPassword = options.watsonxPassword;
|
||||
|
||||
if (this.apiBase && !this.apiBase.endsWith("/")) {
|
||||
this.apiBase = `${this.apiBase}/`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@ class Ollama extends BaseLLM {
|
|||
"starcoder-3b": "starcoder:3b",
|
||||
"starcoder2-3b": "starcoder2:3b",
|
||||
"stable-code-3b": "stable-code:3b",
|
||||
"granite-code-3b": "granite-code:3b",
|
||||
"granite-code-8b": "granite-code:8b",
|
||||
"granite-code-20b": "granite-code:20b",
|
||||
"granite-code-34b": "granite-code:34b",
|
||||
}[this.model] ?? this.model
|
||||
);
|
||||
}
|
||||
|
|
|
|||
249
core/llm/llms/WatsonX.ts
Normal file
249
core/llm/llms/WatsonX.ts
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
import {
|
||||
ChatMessage,
|
||||
CompletionOptions,
|
||||
LLMOptions,
|
||||
ModelProvider,
|
||||
} from "../../index.js";
|
||||
import { stripImages } from "../images.js";
|
||||
import { BaseLLM } from "../index.js";
|
||||
const watsonxConfig = {
|
||||
accessToken: {
|
||||
expiration: 0,
|
||||
token: "",
|
||||
},
|
||||
};
|
||||
class WatsonX extends BaseLLM {
|
||||
protected maxStopWords: number | undefined = undefined;
|
||||
|
||||
constructor(options: LLMOptions) {
|
||||
super(options);
|
||||
}
|
||||
async getBearerToken(): Promise<{ token: string; expiration: number }> {
|
||||
if (this.watsonxUrl != null && this.watsonxUrl.includes("cloud.ibm.com")) {
|
||||
// watsonx SaaS
|
||||
const wxToken = await (
|
||||
await fetch(
|
||||
`https://iam.cloud.ibm.com/identity/token?apikey=${this.watsonxApiKey}&grant_type=urn:ibm:params:oauth:grant-type:apikey`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
Accept: "application/json",
|
||||
},
|
||||
},
|
||||
)
|
||||
).json();
|
||||
return {
|
||||
token: wxToken["access_token"],
|
||||
expiration: wxToken["expiration"],
|
||||
};
|
||||
} else {
|
||||
// watsonx Software
|
||||
if (
|
||||
this.watsonxZenApiKeyBase64 &&
|
||||
this.watsonxZenApiKeyBase64 !== "YOUR_WATSONX_ZENAPIKEY"
|
||||
) {
|
||||
// Using ZenApiKey auth
|
||||
return {
|
||||
token: this.watsonxZenApiKeyBase64,
|
||||
expiration: -1,
|
||||
};
|
||||
} else {
|
||||
// Using username/password auth
|
||||
|
||||
const wxToken = await (
|
||||
await fetch(`${this.watsonxUrl}/icp4d-api/v1/authorize`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username: this.watsonxUsername,
|
||||
password: this.watsonxPassword,
|
||||
}),
|
||||
})
|
||||
).json();
|
||||
const wxTokenExpiry = await (
|
||||
await fetch(`${this.watsonxUrl}/usermgmt/v1/user/tokenExpiry`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
Authorization: `Bearer ${wxToken["token"]}`,
|
||||
},
|
||||
})
|
||||
).json();
|
||||
return {
|
||||
token: wxToken["token"],
|
||||
expiration: wxTokenExpiry["exp"],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static providerName: ModelProvider = "watsonx";
|
||||
|
||||
protected _convertMessage(message: ChatMessage) {
|
||||
if (typeof message.content === "string") {
|
||||
return message;
|
||||
}
|
||||
|
||||
const parts = message.content.map((part) => {
|
||||
const msg: any = {
|
||||
type: part.type,
|
||||
text: part.text,
|
||||
};
|
||||
if (part.type === "imageUrl") {
|
||||
msg.image_url = { ...part.imageUrl, detail: "low" };
|
||||
msg.type = "image_url";
|
||||
}
|
||||
return msg;
|
||||
});
|
||||
return {
|
||||
...message,
|
||||
content: parts,
|
||||
};
|
||||
}
|
||||
|
||||
protected _convertModelName(model: string): string {
|
||||
return model;
|
||||
}
|
||||
|
||||
protected _convertArgs(options: any, messages: ChatMessage[]) {
|
||||
const finalOptions = {
|
||||
messages: messages.map(this._convertMessage),
|
||||
model: this._convertModelName(options.model),
|
||||
max_tokens: options.maxTokens,
|
||||
temperature: options.temperature,
|
||||
top_p: options.topP,
|
||||
frequency_penalty: options.frequencyPenalty,
|
||||
presence_penalty: options.presencePenalty,
|
||||
};
|
||||
return finalOptions;
|
||||
}
|
||||
|
||||
protected _getHeaders() {
|
||||
return {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"} ${watsonxConfig.accessToken.token}`,
|
||||
};
|
||||
}
|
||||
|
||||
protected async _complete(
|
||||
prompt: string,
|
||||
options: CompletionOptions,
|
||||
): Promise<string> {
|
||||
let completion = "";
|
||||
for await (const chunk of this._streamChat(
|
||||
[{ role: "user", content: prompt }],
|
||||
options,
|
||||
)) {
|
||||
completion += chunk.content;
|
||||
}
|
||||
|
||||
return completion;
|
||||
}
|
||||
|
||||
protected async *_streamComplete(
|
||||
prompt: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
for await (const chunk of this._streamChat(
|
||||
[{ role: "user", content: prompt }],
|
||||
options,
|
||||
)) {
|
||||
yield stripImages(chunk.content);
|
||||
}
|
||||
}
|
||||
|
||||
protected async *_streamChat(
|
||||
messages: ChatMessage[],
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<ChatMessage> {
|
||||
var now = new Date().getTime() / 1000;
|
||||
if (
|
||||
watsonxConfig.accessToken === undefined ||
|
||||
now > watsonxConfig.accessToken.expiration ||
|
||||
watsonxConfig.accessToken.token === undefined
|
||||
) {
|
||||
watsonxConfig.accessToken = await this.getBearerToken();
|
||||
} else {
|
||||
console.log(
|
||||
`Reusing token (expires in ${(watsonxConfig.accessToken.expiration - now) / 60} mins)`,
|
||||
);
|
||||
}
|
||||
if (watsonxConfig.accessToken.token === undefined) {
|
||||
throw new Error(`Something went wrong. Check your credentials, please.`);
|
||||
}
|
||||
var streamResponse = await fetch(
|
||||
`${this.watsonxUrl}/ml/v1/text/generation_stream?version=2023-05-29`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"} ${watsonxConfig.accessToken.token}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
input: messages[messages.length - 1].content,
|
||||
parameters: {
|
||||
decoding_method: "greedy",
|
||||
max_new_tokens: options.maxTokens ?? 1024,
|
||||
min_new_tokens: 1,
|
||||
stop_sequences: [],
|
||||
repetition_penalty: 1,
|
||||
},
|
||||
model_id: options.model,
|
||||
project_id: this.watsonxProjectId,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
if (!streamResponse.ok || streamResponse.body === null) {
|
||||
throw new Error(
|
||||
"Something went wrong. No response received, check your connection",
|
||||
);
|
||||
} else {
|
||||
const reader = streamResponse.body.getReader();
|
||||
while (true) {
|
||||
const chunk = await reader.read();
|
||||
if (chunk.done) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Decode the stream
|
||||
const textResponseMsg = new TextDecoder().decode(chunk.value);
|
||||
const lines = textResponseMsg.split(/\r?\n/);
|
||||
|
||||
let generatedChunk = "";
|
||||
let generatedTextIndex = undefined;
|
||||
lines.forEach((el) => {
|
||||
// console.log(`${el}`);
|
||||
if (el.startsWith("id:")) {
|
||||
generatedTextIndex = parseInt(el.replace(/^id:\s+/, ""));
|
||||
if (isNaN(generatedTextIndex)) {
|
||||
console.error(`Unable to parse stream chunk ID: ${el}`);
|
||||
}
|
||||
} else if (el.startsWith("data:")) {
|
||||
const dataStr = el.replace(/^data:\s+/, "");
|
||||
try {
|
||||
const data = JSON.parse(dataStr);
|
||||
data.results.forEach((result: any) => {
|
||||
generatedChunk += result.generated_text || "";
|
||||
});
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
generatedChunk = generatedChunk.replaceAll("<|im_end|>", " ");
|
||||
generatedChunk = generatedChunk.replaceAll("<|im_start|> ", "\n");
|
||||
yield {
|
||||
role: "assistant",
|
||||
content: generatedChunk,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default WatsonX;
|
||||
|
|
@ -34,6 +34,7 @@ import Replicate from "./Replicate.js";
|
|||
import TextGenWebUI from "./TextGenWebUI.js";
|
||||
import Together from "./Together.js";
|
||||
import ContinueProxy from "./stubs/ContinueProxy.js";
|
||||
import WatsonX from "./WatsonX.js";
|
||||
|
||||
function convertToLetter(num: number): string {
|
||||
let result = "";
|
||||
|
|
@ -126,6 +127,7 @@ const LLMs = [
|
|||
Deepseek,
|
||||
Msty,
|
||||
Azure,
|
||||
WatsonX
|
||||
];
|
||||
|
||||
export async function llmFromDescription(
|
||||
|
|
|
|||
426
core/package-lock.json
generated
426
core/package-lock.json
generated
|
|
@ -15,9 +15,6 @@
|
|||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@xenova/transformers": "2.14.0",
|
||||
|
|
@ -68,9 +65,13 @@
|
|||
"@biomejs/biome": "1.6.4",
|
||||
"@google/generative-ai": "^0.11.4",
|
||||
"@types/follow-redirects": "^1.14.4",
|
||||
"@types/isomorphic-fetch": "^0.0.39",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/jquery": "^3.5.29",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@types/pg": "^8.11.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/uuid": "^9.0.7",
|
||||
|
|
@ -79,7 +80,9 @@
|
|||
"esbuild": "0.17.19",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
|
|
@ -4360,6 +4363,12 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/isomorphic-fetch": {
|
||||
"version": "0.0.39",
|
||||
"resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.39.tgz",
|
||||
"integrity": "sha512-I0gou/ZdA1vMG7t7gMzL7VYu2xAKU78rW9U1l10MI0nn77pEHq3tQqHQ8hMmXdMpBlkxZOorjI4sO594Z3kKJw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/istanbul-lib-coverage": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
|
||||
|
|
@ -4407,6 +4416,7 @@
|
|||
"version": "21.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.6.tgz",
|
||||
"integrity": "sha512-/7kkMsC+/kMs7gAYmmBR9P0vGTnOoLhQhyhQJSlXGI5bzTHp6xdo0TtKWQAsz6pmSAeVqKSbqeyP6hytqr9FDw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/tough-cookie": "*",
|
||||
|
|
@ -4426,7 +4436,8 @@
|
|||
"node_modules/@types/mozilla-readability": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/mozilla-readability/-/mozilla-readability-0.2.1.tgz",
|
||||
"integrity": "sha512-RjLpe3MIpj53L+q50DTNlhv6KjHjgajFQwAF4KuxVZTa2+6Cs2UNAxS5awxABfZEHRYjGKeRDB21Zrtnsi911w=="
|
||||
"integrity": "sha512-RjLpe3MIpj53L+q50DTNlhv6KjHjgajFQwAF4KuxVZTa2+6Cs2UNAxS5awxABfZEHRYjGKeRDB21Zrtnsi911w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/mustache": {
|
||||
"version": "4.2.5",
|
||||
|
|
@ -4572,7 +4583,8 @@
|
|||
"node_modules/@types/tough-cookie": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
|
||||
"integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA=="
|
||||
"integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "9.0.8",
|
||||
|
|
@ -4805,6 +4817,13 @@
|
|||
"resolved": "https://registry.npmjs.org/@yomguithereal/helpers/-/helpers-1.1.1.tgz",
|
||||
"integrity": "sha512-UYvAq/XCA7xoh1juWDYsq3W0WywOB+pz8cgVnE1b45ZfdMhBvHDrgmSFG3jXeZSr2tMTYLGHFHON+ekG05Jebg=="
|
||||
},
|
||||
"node_modules/abab": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
|
||||
"integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==",
|
||||
"deprecated": "Use your platform's native atob() and btoa() methods instead",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/abbrev": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
|
|
@ -4833,6 +4852,16 @@
|
|||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-globals": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz",
|
||||
"integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"acorn": "^8.1.0",
|
||||
"acorn-walk": "^8.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-jsx": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
|
||||
|
|
@ -4841,6 +4870,18 @@
|
|||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-walk": {
|
||||
"version": "8.3.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz",
|
||||
"integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"acorn": "^8.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/adf-to-md": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/adf-to-md/-/adf-to-md-1.1.0.tgz",
|
||||
|
|
@ -6131,6 +6172,12 @@
|
|||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
},
|
||||
"node_modules/cssom": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz",
|
||||
"integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/cssstyle": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.0.1.tgz",
|
||||
|
|
@ -6433,6 +6480,19 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"node_modules/domexception": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
|
||||
"integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==",
|
||||
"deprecated": "Use your platform's native DOMException instead",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"webidl-conversions": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/domhandler": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
|
||||
|
|
@ -6784,6 +6844,27 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/escodegen": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz",
|
||||
"integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esprima": "^4.0.1",
|
||||
"estraverse": "^5.2.0",
|
||||
"esutils": "^2.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"escodegen": "bin/escodegen.js",
|
||||
"esgenerate": "bin/esgenerate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"source-map": "~0.6.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.57.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz",
|
||||
|
|
@ -8044,9 +8125,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/https-proxy-agent": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz",
|
||||
"integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==",
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz",
|
||||
"integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.0.2",
|
||||
"debug": "4"
|
||||
|
|
@ -8517,6 +8598,58 @@
|
|||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||
},
|
||||
"node_modules/isomorphic-fetch": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz",
|
||||
"integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.1",
|
||||
"whatwg-fetch": "^3.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/isomorphic-fetch/node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/isomorphic-fetch/node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/isomorphic-fetch/node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/isomorphic-fetch/node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/isstream": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
|
|
@ -8780,6 +8913,248 @@
|
|||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz",
|
||||
"integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jest/environment": "^29.7.0",
|
||||
"@jest/fake-timers": "^29.7.0",
|
||||
"@jest/types": "^29.6.3",
|
||||
"@types/jsdom": "^20.0.0",
|
||||
"@types/node": "*",
|
||||
"jest-mock": "^29.7.0",
|
||||
"jest-util": "^29.7.0",
|
||||
"jsdom": "^20.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"canvas": "^2.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"canvas": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/@tootallnate/once": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
|
||||
"integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/@types/jsdom": {
|
||||
"version": "20.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz",
|
||||
"integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/tough-cookie": "*",
|
||||
"parse5": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/cssstyle": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz",
|
||||
"integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cssom": "~0.3.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/cssstyle/node_modules/cssom": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
|
||||
"integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/data-urls": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz",
|
||||
"integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"abab": "^2.0.6",
|
||||
"whatwg-mimetype": "^3.0.0",
|
||||
"whatwg-url": "^11.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/html-encoding-sniffer": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
|
||||
"integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"whatwg-encoding": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/http-proxy-agent": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz",
|
||||
"integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@tootallnate/once": "2",
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/https-proxy-agent": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
||||
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/jsdom": {
|
||||
"version": "20.0.3",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz",
|
||||
"integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"abab": "^2.0.6",
|
||||
"acorn": "^8.8.1",
|
||||
"acorn-globals": "^7.0.0",
|
||||
"cssom": "^0.5.0",
|
||||
"cssstyle": "^2.3.0",
|
||||
"data-urls": "^3.0.2",
|
||||
"decimal.js": "^10.4.2",
|
||||
"domexception": "^4.0.0",
|
||||
"escodegen": "^2.0.0",
|
||||
"form-data": "^4.0.0",
|
||||
"html-encoding-sniffer": "^3.0.0",
|
||||
"http-proxy-agent": "^5.0.0",
|
||||
"https-proxy-agent": "^5.0.1",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"nwsapi": "^2.2.2",
|
||||
"parse5": "^7.1.1",
|
||||
"saxes": "^6.0.0",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^4.1.2",
|
||||
"w3c-xmlserializer": "^4.0.0",
|
||||
"webidl-conversions": "^7.0.0",
|
||||
"whatwg-encoding": "^2.0.0",
|
||||
"whatwg-mimetype": "^3.0.0",
|
||||
"whatwg-url": "^11.0.0",
|
||||
"ws": "^8.11.0",
|
||||
"xml-name-validator": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"canvas": "^2.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"canvas": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/tr46": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
|
||||
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/w3c-xmlserializer": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz",
|
||||
"integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"xml-name-validator": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/whatwg-encoding": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",
|
||||
"integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"iconv-lite": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/whatwg-mimetype": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz",
|
||||
"integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/whatwg-url": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
|
||||
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"tr46": "^3.0.0",
|
||||
"webidl-conversions": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-jsdom/node_modules/xml-name-validator": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz",
|
||||
"integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-environment-node": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz",
|
||||
|
|
@ -9175,30 +9550,30 @@
|
|||
"optional": true
|
||||
},
|
||||
"node_modules/jsdom": {
|
||||
"version": "24.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.0.0.tgz",
|
||||
"integrity": "sha512-UDS2NayCvmXSXVP6mpTj+73JnNQadZlr9N68189xib2tx5Mls7swlTNao26IoHv46BZJFvXygyRtyXd1feAk1A==",
|
||||
"version": "24.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.1.1.tgz",
|
||||
"integrity": "sha512-5O1wWV99Jhq4DV7rCLIoZ/UIhyQeDR7wHVyZAHAshbrvZsLs+Xzz7gtwnlJTJDjleiTKh54F4dXrX70vJQTyJQ==",
|
||||
"dependencies": {
|
||||
"cssstyle": "^4.0.1",
|
||||
"data-urls": "^5.0.0",
|
||||
"decimal.js": "^10.4.3",
|
||||
"form-data": "^4.0.0",
|
||||
"html-encoding-sniffer": "^4.0.0",
|
||||
"http-proxy-agent": "^7.0.0",
|
||||
"https-proxy-agent": "^7.0.2",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.5",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"nwsapi": "^2.2.7",
|
||||
"nwsapi": "^2.2.12",
|
||||
"parse5": "^7.1.2",
|
||||
"rrweb-cssom": "^0.6.0",
|
||||
"rrweb-cssom": "^0.7.1",
|
||||
"saxes": "^6.0.0",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^4.1.3",
|
||||
"tough-cookie": "^4.1.4",
|
||||
"w3c-xmlserializer": "^5.0.0",
|
||||
"webidl-conversions": "^7.0.0",
|
||||
"whatwg-encoding": "^3.1.1",
|
||||
"whatwg-mimetype": "^4.0.0",
|
||||
"whatwg-url": "^14.0.0",
|
||||
"ws": "^8.16.0",
|
||||
"ws": "^8.18.0",
|
||||
"xml-name-validator": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -9213,6 +9588,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/rrweb-cssom": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz",
|
||||
"integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg=="
|
||||
},
|
||||
"node_modules/jsesc": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
|
||||
|
|
@ -10099,9 +10479,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/nwsapi": {
|
||||
"version": "2.2.10",
|
||||
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.10.tgz",
|
||||
"integrity": "sha512-QK0sRs7MKv0tKe1+5uZIQk/C8XGza4DAnztJG8iD+TpJIORARrCxczA738awHrZoHeTjSSoHqao2teO0dC/gFQ=="
|
||||
"version": "2.2.12",
|
||||
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.12.tgz",
|
||||
"integrity": "sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w=="
|
||||
},
|
||||
"node_modules/oauth-sign": {
|
||||
"version": "0.9.0",
|
||||
|
|
@ -12946,9 +13326,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.17.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz",
|
||||
"integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==",
|
||||
"version": "8.18.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@continuedev/core",
|
||||
"version": "1.0.13",
|
||||
"description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js server. It is written in TypeScript and contains much of the functionality that was previously inside of the legacy Continue Python Server.",
|
||||
"description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js",
|
||||
"scripts": {
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"build:npm": "tsc -p ./tsconfig.npm.json",
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
"lint:fix": "eslint . --ext ts --fix"
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Nate Sesti and Ty Dunn",
|
||||
"author": "Continue Dev, Inc",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.24.7",
|
||||
|
|
@ -18,7 +18,10 @@
|
|||
"@types/follow-redirects": "^1.14.4",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/jquery": "^3.5.29",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@types/pg": "^8.11.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/uuid": "^9.0.7",
|
||||
|
|
@ -28,6 +31,7 @@
|
|||
"eslint": "^8",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
|
|
@ -40,9 +44,6 @@
|
|||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@xenova/transformers": "2.14.0",
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]];
|
||||
"autocomplete/complete": [AutocompleteInput, string[]];
|
||||
"context/addDocs": [SiteIndexingConfig, void];
|
||||
"context/removeDocs": [{ baseUrl: string }, void];
|
||||
"context/removeDocs": [Pick<SiteIndexingConfig, "startUrl">, void];
|
||||
"context/indexDocs": [{ reIndex: boolean }, void];
|
||||
"autocomplete/cancel": [undefined, void];
|
||||
"autocomplete/accept": [{ completionId: string }, void];
|
||||
|
|
|
|||
183
core/test/indexing/DocsService.test.ts
Normal file
183
core/test/indexing/DocsService.test.ts
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
import FileSystemIde from "../../util/filesystem.js";
|
||||
import { ContinueConfig, SiteIndexingConfig } from "../../index.js";
|
||||
import DocsService from "../../indexing/docs/DocsService.js";
|
||||
import { editConfigJson, getConfigJsonPath } from "../../util/paths.js";
|
||||
import { ConfigHandler } from "../../config/ConfigHandler.js";
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
import FreeTrialEmbeddingsProvider from "../../indexing/embeddings/FreeTrialEmbeddingsProvider.js";
|
||||
import preIndexedDocs from "../../indexing/docs/preIndexedDocs.js";
|
||||
|
||||
describe("DocsService Integration Tests", () => {
|
||||
let ide: FileSystemIde;
|
||||
let configHandler: ConfigHandler;
|
||||
let docsService: DocsService;
|
||||
|
||||
const mockSiteConfig: SiteIndexingConfig = {
|
||||
startUrl: "https://amplified.dev/",
|
||||
title: "Test repo",
|
||||
faviconUrl: "https://github.com/favicon.ico",
|
||||
};
|
||||
|
||||
async function clearConfigDir() {
|
||||
const configFolder = path.dirname(getConfigJsonPath());
|
||||
if (fs.existsSync(configFolder)) {
|
||||
fs.rmSync(configFolder, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to reload config explicitly to handle the scenario where the
|
||||
* config file update listeners are not called before we attempt to
|
||||
* use the new config
|
||||
*/
|
||||
async function getReloadedConfig() {
|
||||
await configHandler.reloadConfig();
|
||||
const latestConfig = await configHandler.loadConfig();
|
||||
|
||||
return latestConfig;
|
||||
}
|
||||
|
||||
beforeEach(async () => {
|
||||
await clearConfigDir();
|
||||
|
||||
ide = new FileSystemIde(process.cwd());
|
||||
|
||||
configHandler = new ConfigHandler(
|
||||
ide,
|
||||
Promise.resolve({
|
||||
remoteConfigSyncPeriod: 60,
|
||||
userToken: "",
|
||||
enableControlServerBeta: false,
|
||||
pauseCodebaseIndexOnStart: false,
|
||||
ideSettings: {} as any,
|
||||
enableDebugLogs: false,
|
||||
remoteConfigServerUrl: "",
|
||||
}),
|
||||
async () => {},
|
||||
new ControlPlaneClient(
|
||||
Promise.resolve({
|
||||
accessToken: "",
|
||||
account: {
|
||||
id: "",
|
||||
label: "",
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
docsService = DocsService.createSingleton(configHandler, ide);
|
||||
|
||||
await docsService.isInitialized;
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await clearConfigDir();
|
||||
});
|
||||
|
||||
test("Indexing, retrieval, and deletion of a new documentation site", async () => {
|
||||
const generator = docsService.indexAndAdd(mockSiteConfig);
|
||||
while (!(await generator.next()).done) {}
|
||||
|
||||
let latestConfig = await getReloadedConfig();
|
||||
|
||||
// Sqlite check
|
||||
expect(await docsService.has(mockSiteConfig.startUrl)).toBe(true);
|
||||
|
||||
// config.json check
|
||||
expect(latestConfig.docs).toContainEqual(mockSiteConfig);
|
||||
|
||||
// Lance DB check
|
||||
const embeddingsProvider = await docsService.getEmbeddingsProvider();
|
||||
const [mockVector] = await embeddingsProvider.embed(["test"]);
|
||||
let retrievedChunks = await docsService.retrieveChunks(
|
||||
mockSiteConfig.startUrl,
|
||||
mockVector,
|
||||
5,
|
||||
);
|
||||
|
||||
expect(retrievedChunks.length).toBeGreaterThan(0);
|
||||
|
||||
await docsService.delete(mockSiteConfig.startUrl);
|
||||
|
||||
// Sqlite check
|
||||
expect(await docsService.has(mockSiteConfig.startUrl)).toBe(false);
|
||||
|
||||
// config.json check
|
||||
latestConfig = await getReloadedConfig();
|
||||
expect(latestConfig.docs).not.toContainEqual(
|
||||
expect.objectContaining(mockSiteConfig),
|
||||
);
|
||||
|
||||
// LanceDB check
|
||||
retrievedChunks = await docsService.retrieveChunks(
|
||||
mockSiteConfig.startUrl,
|
||||
mockVector,
|
||||
5,
|
||||
);
|
||||
expect(retrievedChunks.length).toBe(0);
|
||||
});
|
||||
|
||||
test("Reindexes when changing embeddings provider", async () => {
|
||||
const originalEmbeddingsProvider =
|
||||
await docsService.getEmbeddingsProvider();
|
||||
|
||||
// Change embeddings provider
|
||||
editConfigJson((config) => ({
|
||||
...config,
|
||||
embeddingsProvider: {
|
||||
provider: FreeTrialEmbeddingsProvider.providerName,
|
||||
},
|
||||
}));
|
||||
|
||||
await getReloadedConfig();
|
||||
|
||||
const newEmbeddingsProvider = await docsService.getEmbeddingsProvider();
|
||||
|
||||
// Verify reindexing
|
||||
const [originalVector] = await originalEmbeddingsProvider.embed(["test"]);
|
||||
const [newMockVector] = await newEmbeddingsProvider.embed(["test"]);
|
||||
|
||||
expect(originalVector).not.toEqual(newMockVector);
|
||||
});
|
||||
|
||||
test("Handles pulling down and adding pre-indexed docs", async () => {
|
||||
const preIndexedDoc = Object.values(preIndexedDocs)[0];
|
||||
const generator = docsService.indexAndAdd(preIndexedDoc);
|
||||
while (!(await generator.next()).done) {}
|
||||
});
|
||||
|
||||
test("Config synchronization with SQLite", async () => {
|
||||
const generator = docsService.indexAndAdd(mockSiteConfig);
|
||||
while (!(await generator.next()).done) {}
|
||||
|
||||
await getReloadedConfig();
|
||||
|
||||
expect(await docsService.has(mockSiteConfig.startUrl)).toBe(true);
|
||||
|
||||
editConfigJson((config) => {
|
||||
const { docs, ...restConfig } = config;
|
||||
return restConfig;
|
||||
});
|
||||
|
||||
await getReloadedConfig();
|
||||
|
||||
const startTime = Date.now();
|
||||
const maxWaitTimeMs = 10_000;
|
||||
|
||||
while (docsService.isSyncing) {
|
||||
if (Date.now() - startTime > maxWaitTimeMs) {
|
||||
throw new Error(
|
||||
`Timeout: docsService.isSyncing did not complete within within ${maxWaitTimeMs}ms`,
|
||||
);
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
expect(await docsService.has(mockSiteConfig.startUrl)).toBe(false);
|
||||
});
|
||||
});
|
||||
51
core/test/indexing/crawl.test.ts
Normal file
51
core/test/indexing/crawl.test.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { crawlPage, PageData } from "../../indexing/docs/crawl";
|
||||
|
||||
describe("crawlPage - GitHub repository", () => {
|
||||
const repoUrl = new URL(
|
||||
"https://github.com/Patrick-Erichsen/test-github-repo-for-crawling",
|
||||
);
|
||||
const maxDepth = 3;
|
||||
let crawlResults: PageData[];
|
||||
|
||||
beforeAll(async () => {
|
||||
crawlResults = [];
|
||||
for await (const page of crawlPage(repoUrl, maxDepth)) {
|
||||
crawlResults.push(page);
|
||||
}
|
||||
}, 30000);
|
||||
|
||||
test("finds expected markdown files", async () => {
|
||||
expect(crawlResults.some((page) => page.path.endsWith("README.md"))).toBe(
|
||||
true,
|
||||
);
|
||||
|
||||
expect(
|
||||
crawlResults.some((page) => page.path.endsWith("docs-depth-1.md")),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
test("html includes the correct content", async () => {
|
||||
const doc = crawlResults.find((page) =>
|
||||
page.path.endsWith("docs-depth-1.md"),
|
||||
);
|
||||
|
||||
expect(doc?.html.includes("Test body")).toBe(true);
|
||||
expect(doc?.html.includes("Test H2 Header")).toBe(true);
|
||||
});
|
||||
|
||||
// This test is currently failing, `maxDepth` does not appear to be followed right now
|
||||
test.todo(
|
||||
"ignores files past the max depth",
|
||||
// , () => {
|
||||
// expect(
|
||||
// crawlResults.some((page) => page.path.includes("docs-depth-3")),
|
||||
// ).toBe(false);
|
||||
// }
|
||||
);
|
||||
|
||||
test("ignores non-markdown files, e.g. `test.js` at the root", async () => {
|
||||
expect(crawlResults.some((page) => page.path.endsWith("test.js"))).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
|
|
|
|||
|
|
@ -205,8 +205,10 @@ export async function migrate(
|
|||
|
||||
if (!fs.existsSync(migrationPath)) {
|
||||
try {
|
||||
await Promise.resolve(callback());
|
||||
console.log(`Running migration: ${id}`);
|
||||
|
||||
fs.writeFileSync(migrationPath, "");
|
||||
await Promise.resolve(callback());
|
||||
} catch (e) {
|
||||
console.warn(`Migration ${id} failed`, e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ Type "/share" to generate a shareable markdown transcript of your current chat h
|
|||
{
|
||||
"name": "share",
|
||||
"description": "Export the current chat session to markdown",
|
||||
"params": { "ouputDir": "~/.continue/session-transcripts" }
|
||||
"params": { "outputDir": "~/.continue/session-transcripts" }
|
||||
}
|
||||
```
|
||||
|
||||
Use the `ouputDir` parameter to specify where you want to the markdown file to be saved.
|
||||
Use the `outputDir` parameter to specify where you want to the markdown file to be saved.
|
||||
|
||||
### `/cmd`
|
||||
|
||||
|
|
|
|||
BIN
docs/docs/reference/Model Providers/assets/Watsonx1.gif
Normal file
BIN
docs/docs/reference/Model Providers/assets/Watsonx1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
15
docs/docs/reference/Model Providers/watsonx.md
Normal file
15
docs/docs/reference/Model Providers/watsonx.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# WatsonX
|
||||
|
||||
Watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.
|
||||
|
||||
## Setup
|
||||
|
||||
To access the Watsonx models, create an instance in the [IBM cloud](https://cloud.ibm.com) which supports watsonx studio. Then to create a project refer [this](https://www.ibm.com/docs/en/watsonx/saas?topic=projects-creating-project).
|
||||
|
||||
You can set it up in two different ways :
|
||||
1. **Using API** : Create Your IBM cloud API key by referring [this](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key).
|
||||
2. **Using Credentials** : Use your Username and Password to authenticate
|
||||
|
||||
|
||||
## Usage
|
||||

|
||||
|
|
@ -45,6 +45,7 @@ You can run a model on your local computer using:
|
|||
- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples) (OpenAI compatible server)
|
||||
- [IPEX-LLM](../reference/Model%20Providers/ipex_llm.md) (Local LLM on Intel GPU)
|
||||
- [Msty](../reference/Model%20Providers/msty.md)
|
||||
- [WatsonX](../reference/Model%20Providers/watsonx.md)
|
||||
|
||||
### Remote
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "continue-docs",
|
||||
"version": "0.0.0",
|
||||
"author": "Continue Dev, Inc",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
|
|
|||
154
docs/static/schemas/config.json
vendored
154
docs/static/schemas/config.json
vendored
|
|
@ -187,7 +187,8 @@
|
|||
"cloudflare",
|
||||
"deepseek",
|
||||
"azure",
|
||||
"msty"
|
||||
"msty",
|
||||
"watsonx"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -211,7 +212,8 @@
|
|||
"### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)",
|
||||
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
|
||||
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)"
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### WatsonX\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks."
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1185,6 +1187,48 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["watsonx"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"watsonxUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxApiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxZenApiKeyBase64": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxProjectId": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"enum": [
|
||||
"ibm/granite-13b-chat-v2",
|
||||
"ibm/granite-13b-instruct-v2",
|
||||
"mistralai/mistral-large",
|
||||
"meta-llama/llama-3-8b-instruct",
|
||||
"meta-llama/llama-3-70b-instruct"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["watsonxUrl", "watsonxProjectId"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -1427,46 +1471,6 @@
|
|||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"enum": ["docs"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"params": {
|
||||
"properties": {
|
||||
"sites": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["sites"]
|
||||
}
|
||||
},
|
||||
"required": ["params"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
@ -1859,6 +1863,10 @@
|
|||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
},
|
||||
"favicon": {
|
||||
"type": "string",
|
||||
"description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
|
|
@ -1956,18 +1964,6 @@
|
|||
"description": "An optional token to identify the user.",
|
||||
"type": "string"
|
||||
},
|
||||
"dataServerUrl": {
|
||||
"title": "Data Server Url",
|
||||
"description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.",
|
||||
"default": "https://us-west1-autodebug.cloudfunctions.net",
|
||||
"type": "string"
|
||||
},
|
||||
"disableSummaries": {
|
||||
"title": "Disable Summaries",
|
||||
"markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableIndexing": {
|
||||
"title": "Disable Indexing",
|
||||
"markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
|
|
@ -2299,6 +2295,56 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"analytics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["posthog", "logstash"],
|
||||
"description": "The 3rd party analytics provider to use.",
|
||||
"default": "posthog",
|
||||
"markdownEnumDescriptions": [
|
||||
"### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.",
|
||||
"### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL"
|
||||
]
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "The URL to which analytics will be sent"
|
||||
},
|
||||
"clientKey": {
|
||||
"type": "string",
|
||||
"description": "The client key to use for analytics"
|
||||
}
|
||||
},
|
||||
"required": ["provider"],
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["posthog"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": ["clientKey"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["logstash"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": ["url"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"experimental": {
|
||||
"type": "object",
|
||||
"title": "Experimental",
|
||||
|
|
|
|||
|
|
@ -187,7 +187,8 @@
|
|||
"cloudflare",
|
||||
"deepseek",
|
||||
"azure",
|
||||
"msty"
|
||||
"msty",
|
||||
"watsonx"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -211,7 +212,8 @@
|
|||
"### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)",
|
||||
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
|
||||
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)"
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### WatsonX\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks."
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1185,6 +1187,48 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["watsonx"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"watsonxUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxApiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxZenApiKeyBase64": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxProjectId": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"enum": [
|
||||
"ibm/granite-13b-chat-v2",
|
||||
"ibm/granite-13b-instruct-v2",
|
||||
"mistralai/mistral-large",
|
||||
"meta-llama/llama-3-8b-instruct",
|
||||
"meta-llama/llama-3-70b-instruct"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["watsonxUrl", "watsonxProjectId"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -1427,46 +1471,6 @@
|
|||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"enum": ["docs"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"params": {
|
||||
"properties": {
|
||||
"sites": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["sites"]
|
||||
}
|
||||
},
|
||||
"required": ["params"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
@ -1859,6 +1863,10 @@
|
|||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
},
|
||||
"favicon": {
|
||||
"type": "string",
|
||||
"description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
|
|
@ -1956,18 +1964,6 @@
|
|||
"description": "An optional token to identify the user.",
|
||||
"type": "string"
|
||||
},
|
||||
"dataServerUrl": {
|
||||
"title": "Data Server Url",
|
||||
"description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.",
|
||||
"default": "https://us-west1-autodebug.cloudfunctions.net",
|
||||
"type": "string"
|
||||
},
|
||||
"disableSummaries": {
|
||||
"title": "Disable Summaries",
|
||||
"markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableIndexing": {
|
||||
"title": "Disable Indexing",
|
||||
"markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
|
|
@ -1982,7 +1978,7 @@
|
|||
},
|
||||
"embeddingsProvider": {
|
||||
"title": "Embeddings Provider",
|
||||
"markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers).",
|
||||
"markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/features/codebase-embeddings#embeddings-providers).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
|
|
@ -2220,7 +2216,7 @@
|
|||
"tabAutocompleteOptions": {
|
||||
"title": "TabAutocompleteOptions",
|
||||
"type": "object",
|
||||
"markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/walkthroughs/tab-autocomplete#configuration-options).",
|
||||
"markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/features/tab-autocomplete#configuration-options).",
|
||||
"properties": {
|
||||
"disable": {
|
||||
"type": "boolean",
|
||||
|
|
@ -2299,6 +2295,56 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"analytics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["posthog", "logstash"],
|
||||
"description": "The 3rd party analytics provider to use.",
|
||||
"default": "posthog",
|
||||
"markdownEnumDescriptions": [
|
||||
"### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.",
|
||||
"### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL"
|
||||
]
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "The URL to which analytics will be sent"
|
||||
},
|
||||
"clientKey": {
|
||||
"type": "string",
|
||||
"description": "The client key to use for analytics"
|
||||
}
|
||||
},
|
||||
"required": ["provider"],
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["posthog"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": ["clientKey"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["logstash"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": ["url"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"experimental": {
|
||||
"type": "object",
|
||||
"title": "Experimental",
|
||||
|
|
|
|||
|
|
@ -187,7 +187,8 @@
|
|||
"cloudflare",
|
||||
"deepseek",
|
||||
"azure",
|
||||
"msty"
|
||||
"msty",
|
||||
"watsonx"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -211,7 +212,8 @@
|
|||
"### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)",
|
||||
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
|
||||
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)"
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### WatsonX\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks."
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1185,6 +1187,48 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["watsonx"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"watsonxUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxApiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxZenApiKeyBase64": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxProjectId": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"enum": [
|
||||
"ibm/granite-13b-chat-v2",
|
||||
"ibm/granite-13b-instruct-v2",
|
||||
"mistralai/mistral-large",
|
||||
"meta-llama/llama-3-8b-instruct",
|
||||
"meta-llama/llama-3-70b-instruct"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["watsonxUrl", "watsonxProjectId"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -1427,46 +1471,6 @@
|
|||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"enum": ["docs"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"params": {
|
||||
"properties": {
|
||||
"sites": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["sites"]
|
||||
}
|
||||
},
|
||||
"required": ["params"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
@ -1859,6 +1863,10 @@
|
|||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
},
|
||||
"favicon": {
|
||||
"type": "string",
|
||||
"description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL"
|
||||
}
|
||||
},
|
||||
"required": ["title", "startUrl"]
|
||||
|
|
@ -1956,18 +1964,6 @@
|
|||
"description": "An optional token to identify the user.",
|
||||
"type": "string"
|
||||
},
|
||||
"dataServerUrl": {
|
||||
"title": "Data Server Url",
|
||||
"description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.",
|
||||
"default": "https://us-west1-autodebug.cloudfunctions.net",
|
||||
"type": "string"
|
||||
},
|
||||
"disableSummaries": {
|
||||
"title": "Disable Summaries",
|
||||
"markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableIndexing": {
|
||||
"title": "Disable Indexing",
|
||||
"markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
|
|
@ -2299,6 +2295,56 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"analytics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["posthog", "logstash"],
|
||||
"description": "The 3rd party analytics provider to use.",
|
||||
"default": "posthog",
|
||||
"markdownEnumDescriptions": [
|
||||
"### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.",
|
||||
"### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL"
|
||||
]
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "The URL to which analytics will be sent"
|
||||
},
|
||||
"clientKey": {
|
||||
"type": "string",
|
||||
"description": "The client key to use for analytics"
|
||||
}
|
||||
},
|
||||
"required": ["provider"],
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["posthog"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": ["clientKey"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["logstash"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": ["url"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"experimental": {
|
||||
"type": "object",
|
||||
"title": "Experimental",
|
||||
|
|
|
|||
|
|
@ -190,7 +190,8 @@
|
|||
"cloudflare",
|
||||
"deepseek",
|
||||
"azure",
|
||||
"msty"
|
||||
"msty",
|
||||
"watsonx"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -214,7 +215,8 @@
|
|||
"### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)",
|
||||
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
|
||||
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)"
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### WatsonX\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks."
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1312,6 +1314,55 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": [
|
||||
"watsonx"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"provider"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"watsonxUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxApiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxZenApiKeyBase64": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"watsonxProjectId": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"enum": [
|
||||
"ibm/granite-13b-chat-v2",
|
||||
"ibm/granite-13b-instruct-v2",
|
||||
"mistralai/mistral-large",
|
||||
"meta-llama/llama-3-8b-instruct",
|
||||
"meta-llama/llama-3-70b-instruct"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"watsonxUrl",
|
||||
"watsonxProjectId"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -1573,55 +1624,6 @@
|
|||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"enum": [
|
||||
"docs"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"params": {
|
||||
"properties": {
|
||||
"sites": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"startUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"rootUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"maxDepth": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"title",
|
||||
"startUrl"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"sites"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"params"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
@ -2081,6 +2083,10 @@
|
|||
"maxDepth": {
|
||||
"type": "integer",
|
||||
"description": "The maximum depth to crawl the documentation site"
|
||||
},
|
||||
"favicon": {
|
||||
"type": "string",
|
||||
"description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -2181,18 +2187,6 @@
|
|||
"description": "An optional token to identify the user.",
|
||||
"type": "string"
|
||||
},
|
||||
"dataServerUrl": {
|
||||
"title": "Data Server Url",
|
||||
"description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.",
|
||||
"default": "https://us-west1-autodebug.cloudfunctions.net",
|
||||
"type": "string"
|
||||
},
|
||||
"disableSummaries": {
|
||||
"title": "Disable Summaries",
|
||||
"markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableIndexing": {
|
||||
"title": "Disable Indexing",
|
||||
"markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
|
|
@ -2207,7 +2201,7 @@
|
|||
},
|
||||
"embeddingsProvider": {
|
||||
"title": "Embeddings Provider",
|
||||
"markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers).",
|
||||
"markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/features/codebase-embeddings#embeddings-providers).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
|
|
@ -2493,7 +2487,7 @@
|
|||
"tabAutocompleteOptions": {
|
||||
"title": "TabAutocompleteOptions",
|
||||
"type": "object",
|
||||
"markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/walkthroughs/tab-autocomplete#configuration-options).",
|
||||
"markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/features/tab-autocomplete#configuration-options).",
|
||||
"properties": {
|
||||
"disable": {
|
||||
"type": "boolean",
|
||||
|
|
@ -2579,6 +2573,69 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"analytics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"posthog",
|
||||
"logstash"
|
||||
],
|
||||
"description": "The 3rd party analytics provider to use.",
|
||||
"default": "posthog",
|
||||
"markdownEnumDescriptions": [
|
||||
"### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.",
|
||||
"### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL"
|
||||
]
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "The URL to which analytics will be sent"
|
||||
},
|
||||
"clientKey": {
|
||||
"type": "string",
|
||||
"description": "The client key to use for analytics"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"provider"
|
||||
],
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": [
|
||||
"posthog"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"clientKey"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": [
|
||||
"logstash"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"url"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"experimental": {
|
||||
"type": "object",
|
||||
"title": "Experimental",
|
||||
|
|
|
|||
12
extensions/vscode/package-lock.json
generated
12
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.192",
|
||||
"version": "0.9.193",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.192",
|
||||
"version": "0.9.193",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
@ -101,9 +101,6 @@
|
|||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@xenova/transformers": "2.14.0",
|
||||
|
|
@ -156,15 +153,20 @@
|
|||
"@types/follow-redirects": "^1.14.4",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/jquery": "^3.5.29",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@types/pg": "^8.11.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/win-ca": "^3.5.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild": "0.17.19",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"version": "0.9.192",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.193",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export async function getContextProvidersString(
|
|||
}
|
||||
|
||||
return provider.getContextItems("", {
|
||||
config,
|
||||
ide,
|
||||
embeddingsProvider: config.embeddingsProvider,
|
||||
reranker: config.reranker,
|
||||
|
|
|
|||
11
gui/package-lock.json
generated
11
gui/package-lock.json
generated
|
|
@ -94,9 +94,6 @@
|
|||
"@continuedev/llm-info": "^1.0.1",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@xenova/transformers": "2.14.0",
|
||||
|
|
@ -149,15 +146,20 @@
|
|||
"@types/follow-redirects": "^1.14.4",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/jquery": "^3.5.29",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@types/pg": "^8.11.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/win-ca": "^3.5.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild": "0.17.19",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
|
|
@ -5153,6 +5155,7 @@
|
|||
},
|
||||
"../core/node_modules/@types/jsdom": {
|
||||
"version": "21.1.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
|
|
@ -5170,6 +5173,7 @@
|
|||
},
|
||||
"../core/node_modules/@types/mozilla-readability": {
|
||||
"version": "0.2.1",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"../core/node_modules/@types/mustache": {
|
||||
|
|
@ -5206,6 +5210,7 @@
|
|||
},
|
||||
"../core/node_modules/@types/tough-cookie": {
|
||||
"version": "4.0.5",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"../core/node_modules/@types/uuid": {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
"name": "gui",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"author": "Continue Dev, Inc",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
|
|
|||
BIN
gui/public/logos/WatsonX.png
Normal file
BIN
gui/public/logos/WatsonX.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 215 KiB |
BIN
gui/public/logos/ibm.png
Normal file
BIN
gui/public/logos/ibm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
|
|
@ -1,11 +1,11 @@
|
|||
import { SiteIndexingConfig } from "core";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
import React, { useContext, useLayoutEffect, useRef, useState } from "react";
|
||||
import { useContext, useLayoutEffect, useRef, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Button, Input } from "..";
|
||||
import { Button, HelperText, Input, lightGray } from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { SubmenuContextProvidersContext } from "../../context/SubmenuContextProviders";
|
||||
import { setShowDialog } from "../../redux/slices/uiStateSlice";
|
||||
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
const DEFAULT_MAX_DEPTH = 3;
|
||||
|
||||
|
|
@ -15,15 +15,16 @@ function AddDocsDialog() {
|
|||
|
||||
const ref = useRef<HTMLInputElement>(null);
|
||||
|
||||
const [docsUrl, setDocsUrl] = useState("");
|
||||
const [docsTitle, setDocsTitle] = useState("");
|
||||
const [urlValid, setUrlValid] = useState(false);
|
||||
const [title, setTitle] = useState("");
|
||||
const [startUrl, setStartUrl] = useState("");
|
||||
const [rootUrl, setRootUrl] = useState("");
|
||||
const [faviconUrl, setFaviconUrl] = useState("");
|
||||
const [maxDepth, setMaxDepth] = useState<number | string>("");
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { addItem } = useContext(SubmenuContextProvidersContext);
|
||||
|
||||
const isFormValid = docsUrl && docsTitle && urlValid;
|
||||
const isFormValid = startUrl && title;
|
||||
|
||||
useLayoutEffect(() => {
|
||||
setTimeout(() => {
|
||||
|
|
@ -37,34 +38,30 @@ function AddDocsDialog() {
|
|||
e.preventDefault();
|
||||
|
||||
const siteIndexingConfig: SiteIndexingConfig = {
|
||||
startUrl: docsUrl,
|
||||
rootUrl: docsUrl,
|
||||
title: docsTitle,
|
||||
startUrl,
|
||||
rootUrl,
|
||||
title,
|
||||
maxDepth: typeof maxDepth === "string" ? DEFAULT_MAX_DEPTH : maxDepth,
|
||||
faviconUrl: new URL("/favicon.ico", docsUrl).toString(),
|
||||
faviconUrl: new URL("/favicon.ico", startUrl).toString(),
|
||||
};
|
||||
|
||||
ideMessenger.post("context/addDocs", siteIndexingConfig);
|
||||
|
||||
setDocsTitle("");
|
||||
setDocsUrl("");
|
||||
setTitle("");
|
||||
setStartUrl("");
|
||||
setRootUrl("");
|
||||
setMaxDepth("");
|
||||
setFaviconUrl("");
|
||||
|
||||
dispatch(setShowDialog(false));
|
||||
|
||||
addItem("docs", {
|
||||
id: docsUrl,
|
||||
title: docsTitle,
|
||||
description: new URL(docsUrl).hostname,
|
||||
});
|
||||
|
||||
posthog.capture("add_docs", { url: docsUrl });
|
||||
posthog.capture("add_docs_gui", { url: startUrl });
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
<div className="mb-8">
|
||||
<h2>Add Docs</h2>
|
||||
<h1>Add a documentation site</h1>
|
||||
|
||||
<p>
|
||||
Continue pre-indexes many common documentation sites, but if there's
|
||||
|
|
@ -78,49 +75,114 @@ function AddDocsDialog() {
|
|||
</div>
|
||||
|
||||
<form onSubmit={onSubmit} className="flex flex-col space-y-4">
|
||||
<label>
|
||||
URL
|
||||
<Input
|
||||
type="url"
|
||||
placeholder="URL"
|
||||
value={docsUrl}
|
||||
ref={ref}
|
||||
onChange={(e) => {
|
||||
setDocsUrl(e.target.value);
|
||||
setUrlValid(e.target.validity.valid);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Title
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Title"
|
||||
value={docsTitle}
|
||||
onChange={(e) => setDocsTitle(e.target.value)}
|
||||
value={title}
|
||||
ref={ref}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
/>
|
||||
<HelperText>
|
||||
The title that will be displayed to users in the `@docs` submenu
|
||||
</HelperText>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Max Depth [Optional]
|
||||
Start URL
|
||||
<Input
|
||||
type="text"
|
||||
inputMode="numeric"
|
||||
placeholder={`Max depth (Default: ${DEFAULT_MAX_DEPTH})`}
|
||||
title="The maximum search tree depth - where your input url is the root node"
|
||||
value={maxDepth}
|
||||
type="url"
|
||||
placeholder="Start URL"
|
||||
value={startUrl}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
if (value == "") {
|
||||
setMaxDepth("");
|
||||
} else if (!isNaN(+value) && Number(value) > 0) {
|
||||
setMaxDepth(Number(value));
|
||||
}
|
||||
setStartUrl(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<HelperText>
|
||||
The starting location to begin crawling the documentation site
|
||||
</HelperText>
|
||||
</label>
|
||||
|
||||
<div
|
||||
className="cursor-pointer"
|
||||
onClick={() => setIsOpen((prev) => !prev)}
|
||||
>
|
||||
{isOpen ? (
|
||||
<ChevronUpIcon
|
||||
width="1.0em"
|
||||
height="1.0em"
|
||||
style={{ color: lightGray }}
|
||||
></ChevronUpIcon>
|
||||
) : (
|
||||
<ChevronDownIcon
|
||||
width="1.0em"
|
||||
height="1.0em"
|
||||
style={{ color: lightGray }}
|
||||
></ChevronDownIcon>
|
||||
)}
|
||||
<span className="ms-1">Advanced</span>
|
||||
</div>
|
||||
|
||||
{isOpen && (
|
||||
<div className="pt-2">
|
||||
<label>
|
||||
Root URL [Optional]
|
||||
<Input
|
||||
type="url"
|
||||
placeholder="Root URL"
|
||||
value={rootUrl}
|
||||
onChange={(e) => {
|
||||
setRootUrl(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<HelperText>
|
||||
Limits the crawler to pages within the same domain and path as
|
||||
the Root URL
|
||||
</HelperText>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Favicon URL [Optional]
|
||||
<Input
|
||||
type="url"
|
||||
placeholder={`${startUrl}/favicon.ico`}
|
||||
value={faviconUrl}
|
||||
onChange={(e) => {
|
||||
setFaviconUrl(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<HelperText>
|
||||
The URL path to a favicon for the site - by default, it will be
|
||||
`/favicon.ico` path from the Start URL
|
||||
</HelperText>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Max Depth [Optional]
|
||||
<Input
|
||||
type="text"
|
||||
inputMode="numeric"
|
||||
placeholder={`Default: ${DEFAULT_MAX_DEPTH}`}
|
||||
title="The maximum search tree depth - where your input url is the root node"
|
||||
value={maxDepth}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
if (value == "") {
|
||||
setMaxDepth("");
|
||||
} else if (!isNaN(+value) && Number(value) > 0) {
|
||||
setMaxDepth(Number(value));
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<HelperText>
|
||||
Limits the maximum search tree depth of the crawler - 3 by
|
||||
default
|
||||
</HelperText>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button disabled={!isFormValid} type="submit">
|
||||
Submit
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
HandThumbDownIcon,
|
||||
HandThumbUpIcon,
|
||||
TrashIcon,
|
||||
CubeIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { ChatHistoryItem } from "core";
|
||||
import { stripImages } from "core/llm/images";
|
||||
|
|
@ -14,6 +15,7 @@ import {
|
|||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscBackground,
|
||||
vscButtonBackground,
|
||||
vscInputBackground,
|
||||
} from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
|
|
@ -38,25 +40,8 @@ interface StepContainerProps {
|
|||
subtext?: string;
|
||||
}
|
||||
|
||||
// #region styled components
|
||||
|
||||
const ButtonsDiv = styled.div`
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
align-items: center;
|
||||
background-color: ${vscBackground};
|
||||
box-shadow: 1px 1px 10px ${vscBackground};
|
||||
border-radius: ${defaultBorderRadius};
|
||||
z-index: 100;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 16px;
|
||||
height: 0;
|
||||
`;
|
||||
|
||||
const ContentDiv = styled.div<{ isUserInput: boolean; fontSize?: number }>`
|
||||
padding: 2px;
|
||||
padding-right: 0px;
|
||||
padding: 4px 0px 8px 0px;
|
||||
background-color: ${(props) =>
|
||||
props.isUserInput ? vscInputBackground : vscBackground};
|
||||
font-size: ${(props) => props.fontSize || getFontSize()}px;
|
||||
|
|
@ -64,8 +49,6 @@ const ContentDiv = styled.div<{ isUserInput: boolean; fontSize?: number }>`
|
|||
overflow: hidden;
|
||||
`;
|
||||
|
||||
// #endregion
|
||||
|
||||
function StepContainer(props: StepContainerProps) {
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const isUserInput = props.item.message.role === "user";
|
||||
|
|
@ -142,90 +125,99 @@ function StepContainer(props: StepContainerProps) {
|
|||
</ContentDiv>
|
||||
{(isHovered || typeof feedback !== "undefined") && !active && (
|
||||
<div
|
||||
className="flex items-center justify-between absolute -bottom-2 w-full"
|
||||
style={{ zIndex: 200 }}
|
||||
className="flex gap-1 absolute -bottom-2 right-0"
|
||||
style={{
|
||||
zIndex: 200,
|
||||
color: lightGray,
|
||||
fontSize: getFontSize() - 3,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="pl-2"
|
||||
style={{ color: lightGray, fontSize: getFontSize() - 3 }}
|
||||
>
|
||||
{props.subtext ?? ""}
|
||||
</div>
|
||||
<div className="flex items-center gap-2 pr-2">
|
||||
{truncatedEarly && (
|
||||
<HeaderButtonWithText
|
||||
text="Continue generation"
|
||||
onClick={(e) => {
|
||||
props.onContinueGeneration();
|
||||
{props.subtext && (
|
||||
<div className="flex items-center">
|
||||
<CubeIcon className="w-3 h-4 mr-1 flex-shrink-0" />
|
||||
{props.subtext}
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: vscButtonBackground,
|
||||
borderColor: vscButtonBackground,
|
||||
}}
|
||||
>
|
||||
<BarsArrowDownIcon
|
||||
color={lightGray}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
)}
|
||||
|
||||
<CopyButton
|
||||
text={stripImages(props.item.message.content)}
|
||||
color={lightGray}
|
||||
/>
|
||||
className="w-px h-full ml-3 mr-1"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{truncatedEarly && (
|
||||
<HeaderButtonWithText
|
||||
text="Regenerate"
|
||||
text="Continue generation"
|
||||
onClick={(e) => {
|
||||
props.onRetry();
|
||||
props.onContinueGeneration();
|
||||
}}
|
||||
>
|
||||
<ArrowUturnLeftIcon
|
||||
<BarsArrowDownIcon
|
||||
color={lightGray}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
{feedback === false || (
|
||||
<HeaderButtonWithText text="Helpful">
|
||||
<HandThumbUpIcon
|
||||
className={
|
||||
"cursor-pointer hover:text-green-500" +
|
||||
(feedback === true ? " text-green-500" : "")
|
||||
}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
color={lightGray}
|
||||
onClick={() => {
|
||||
sendFeedback(true);
|
||||
}}
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
)}
|
||||
{feedback === true || (
|
||||
<HeaderButtonWithText text="Unhelpful">
|
||||
<HandThumbDownIcon
|
||||
className={
|
||||
"cursor-pointer hover:text-red-500" +
|
||||
(feedback === false ? " text-red-500" : "")
|
||||
}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
color={lightGray}
|
||||
onClick={() => {
|
||||
sendFeedback(false);
|
||||
}}
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
)}
|
||||
<HeaderButtonWithText text="Delete Message">
|
||||
<TrashIcon
|
||||
color={lightGray}
|
||||
)}
|
||||
|
||||
<CopyButton
|
||||
text={stripImages(props.item.message.content)}
|
||||
color={lightGray}
|
||||
/>
|
||||
<HeaderButtonWithText
|
||||
text="Regenerate"
|
||||
onClick={(e) => {
|
||||
props.onRetry();
|
||||
}}
|
||||
>
|
||||
<ArrowUturnLeftIcon
|
||||
color={lightGray}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
{feedback === false || (
|
||||
<HeaderButtonWithText text="Helpful">
|
||||
<HandThumbUpIcon
|
||||
className={
|
||||
"cursor-pointer hover:text-green-500" +
|
||||
(feedback === true ? " text-green-500" : "")
|
||||
}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
color={lightGray}
|
||||
onClick={() => {
|
||||
props.onDelete();
|
||||
sendFeedback(true);
|
||||
}}
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
</div>
|
||||
)}
|
||||
{feedback === true || (
|
||||
<HeaderButtonWithText text="Unhelpful">
|
||||
<HandThumbDownIcon
|
||||
className={
|
||||
"cursor-pointer hover:text-red-500" +
|
||||
(feedback === false ? " text-red-500" : "")
|
||||
}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
color={lightGray}
|
||||
onClick={() => {
|
||||
sendFeedback(false);
|
||||
}}
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
)}
|
||||
<HeaderButtonWithText text="Delete Message">
|
||||
<TrashIcon
|
||||
color={lightGray}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
onClick={() => {
|
||||
props.onDelete();
|
||||
}}
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ export const VSC_THEME_COLOR_VARS = [
|
|||
];
|
||||
|
||||
export const defaultBorderRadius = "5px";
|
||||
export const lightGray = "#646464";
|
||||
export const greenButtonColor = "#1bbe84";
|
||||
export const lightGray = "#999998";
|
||||
export const greenButtonColor = "#189e72";
|
||||
|
||||
export const vscInputBackground = `var(${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45))`;
|
||||
export const vscQuickInputBackground = `var(${VSC_QUICK_INPUT_BACKGROUND_VAR}, ${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45))`;
|
||||
|
|
@ -58,6 +58,8 @@ export const vscBadgeBackground = `var(${VSC_BADGE_BACKGROUND_VAR}, #1bbe84)`;
|
|||
export const vscBadgeForeground = `var(${VSC_BADGE_FOREGROUND_VAR}, #fff)`;
|
||||
export const vscSidebarBorder = `var(${VSC_SIDEBAR_BORDER_VAR}, transparent)`;
|
||||
|
||||
// cececd
|
||||
|
||||
if (typeof document !== "undefined") {
|
||||
for (const colorVar of VSC_THEME_COLOR_VARS) {
|
||||
if (isJetBrains()) {
|
||||
|
|
@ -245,6 +247,12 @@ export const Hr = styled.hr`
|
|||
border: 0.5px solid ${lightGray};
|
||||
`;
|
||||
|
||||
export const HelperText = styled.p`
|
||||
margin-top: 2.5px;
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
color: ${lightGray};
|
||||
`;
|
||||
|
||||
export const Input = styled.input`
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ const IndexingProgressBar = ({
|
|||
<FlexDiv data-tooltip-id="indexingFailed_dot">
|
||||
<StatusDot color={STATUS_COLORS.FAILED}></StatusDot>
|
||||
<div>
|
||||
<StatusHeading>Indexing error! Click to retry</StatusHeading>
|
||||
<StatusHeading>Indexing error - click to retry</StatusHeading>
|
||||
<StatusInfo>{getIndexingErrMsg(indexingState.desc)}</StatusInfo>
|
||||
</div>
|
||||
{tooltipPortalDiv &&
|
||||
|
|
@ -151,7 +151,7 @@ const IndexingProgressBar = ({
|
|||
) : indexingState.status === "loading" ? (
|
||||
<FlexDiv>
|
||||
<StatusDot shouldBlink color={STATUS_COLORS.LOADING}></StatusDot>
|
||||
<StatusHeading>Continue is initializing</StatusHeading>
|
||||
<StatusHeading>Initializing</StatusHeading>
|
||||
</FlexDiv>
|
||||
) : indexingState.status === "done" ? (
|
||||
<FlexDiv data-tooltip-id="indexingDone_dot">
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { getFontSize } from "../../util";
|
||||
import FileIcon from "../FileIcon";
|
||||
import SafeImg from "../SafeImg";
|
||||
|
||||
const ContextItemDiv = styled.div`
|
||||
cursor: pointer;
|
||||
|
|
@ -120,17 +121,27 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => {
|
|||
openContextItem(contextItem);
|
||||
}}
|
||||
>
|
||||
<FileIcon
|
||||
filename={
|
||||
contextItem.description
|
||||
.split(" ")
|
||||
.shift()
|
||||
.split("#")
|
||||
.shift() || ""
|
||||
}
|
||||
height="1.6em"
|
||||
width="1.6em"
|
||||
></FileIcon>
|
||||
{!!contextItem.icon ? (
|
||||
<SafeImg
|
||||
className="flex-shrink-0 pr-2"
|
||||
src={contextItem.icon}
|
||||
height="18em"
|
||||
width="18em"
|
||||
fallback={null}
|
||||
/>
|
||||
) : (
|
||||
<FileIcon
|
||||
filename={
|
||||
contextItem.description
|
||||
.split(" ")
|
||||
.shift()
|
||||
.split("#")
|
||||
.shift() || ""
|
||||
}
|
||||
height="1.6em"
|
||||
width="1.6em"
|
||||
></FileIcon>
|
||||
)}
|
||||
{contextItem.name}
|
||||
</ContextItemDiv>
|
||||
</a>
|
||||
|
|
@ -144,11 +155,21 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => {
|
|||
openContextItem(contextItem);
|
||||
}}
|
||||
>
|
||||
<FileIcon
|
||||
filename={contextItem.description.split(" ").shift()}
|
||||
height="1.6em"
|
||||
width="1.6em"
|
||||
></FileIcon>
|
||||
{!!contextItem.icon ? (
|
||||
<SafeImg
|
||||
className="flex-shrink-0 pr-2"
|
||||
src={contextItem.icon}
|
||||
height="18em"
|
||||
width="18em"
|
||||
fallback={null}
|
||||
/>
|
||||
) : (
|
||||
<FileIcon
|
||||
filename={contextItem.description.split(" ").shift()}
|
||||
height="1.6em"
|
||||
width="1.6em"
|
||||
></FileIcon>
|
||||
)}
|
||||
{contextItem.name}
|
||||
</ContextItemDiv>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -24,22 +24,33 @@ import {
|
|||
import ModelSelect from "../modelSelection/ModelSelect";
|
||||
|
||||
const StyledDiv = styled.div<{ isHidden: boolean }>`
|
||||
padding: 4px 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap-reverse;
|
||||
flex-direction: row-reverse;
|
||||
gap: 1px;
|
||||
background-color: ${vscInputBackground};
|
||||
align-items: center;
|
||||
z-index: 50;
|
||||
font-size: ${getFontSize() - 4}px;
|
||||
cursor: ${props => props.isHidden ? 'default' : 'text'};
|
||||
opacity: ${props => props.isHidden ? 0 : 1};
|
||||
pointer-events: ${props => props.isHidden ? 'none' : 'auto'};
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
cursor: ${(props) => (props.isHidden ? "default" : "text")};
|
||||
opacity: ${(props) => (props.isHidden ? 0 : 1)};
|
||||
pointer-events: ${(props) => (props.isHidden ? "none" : "auto")};
|
||||
|
||||
& > * {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
/* Add a media query to hide the right-hand set of components */
|
||||
@media (max-width: 400px) {
|
||||
& > span:last-child {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledSpan = styled.span`
|
||||
font-size: ${() => `${getFontSize() - 2}px`};
|
||||
color: ${lightGray};
|
||||
`;
|
||||
|
||||
const EnterButton = styled.div<{ offFocus: boolean }>`
|
||||
|
|
@ -87,73 +98,22 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
onClick={props.onClick}
|
||||
id="input-toolbar"
|
||||
>
|
||||
<span className="flex items-center whitespace-nowrap">
|
||||
{props.showNoContext ? (
|
||||
<span
|
||||
style={{
|
||||
color: props.usingCodebase ? vscBadgeBackground : lightGray,
|
||||
backgroundColor: props.usingCodebase
|
||||
? lightGray + "33"
|
||||
: undefined,
|
||||
borderRadius: defaultBorderRadius,
|
||||
padding: "2px 4px",
|
||||
}}
|
||||
>
|
||||
{getAltKeyLabel()} ⏎{" "}
|
||||
{useActiveFile ? "No context" : "Use active file"}
|
||||
</span>
|
||||
) : (
|
||||
<span
|
||||
style={{
|
||||
color: props.usingCodebase ? vscBadgeBackground : lightGray,
|
||||
backgroundColor: props.usingCodebase
|
||||
? lightGray + "33"
|
||||
: undefined,
|
||||
borderRadius: defaultBorderRadius,
|
||||
padding: "2px 4px",
|
||||
}}
|
||||
onClick={(e) => {
|
||||
props.onEnter({
|
||||
useCodebase: true,
|
||||
noContext: !useActiveFile,
|
||||
});
|
||||
}}
|
||||
className={"hover:underline cursor-pointer float-right"}
|
||||
>
|
||||
{getMetaKeyLabel()} ⏎ Use codebase
|
||||
</span>
|
||||
)}
|
||||
<EnterButton
|
||||
offFocus={props.usingCodebase}
|
||||
onClick={(e) => {
|
||||
props.onEnter({
|
||||
useCodebase: isMetaEquivalentKeyPressed(e),
|
||||
noContext: useActiveFile ? e.altKey : !e.altKey,
|
||||
});
|
||||
}}
|
||||
>
|
||||
⏎ Enter
|
||||
</EnterButton>
|
||||
</span>
|
||||
<span className="flex flex-wrap-reverse gap-1 items-center whitespace-nowrap">
|
||||
<span className="flex gap-2 items-center whitespace-nowrap">
|
||||
<ModelSelect />
|
||||
<span
|
||||
style={{
|
||||
color: lightGray,
|
||||
}}
|
||||
<StyledSpan
|
||||
onClick={(e) => {
|
||||
props.onAddContextItem();
|
||||
}}
|
||||
className="hover:underline cursor-pointer"
|
||||
>
|
||||
+ Add Context
|
||||
</span>
|
||||
</StyledSpan>
|
||||
{defaultModel &&
|
||||
modelSupportsImages(
|
||||
defaultModel.provider,
|
||||
defaultModel.model,
|
||||
defaultModel.title,
|
||||
defaultModel.capabilities
|
||||
defaultModel.capabilities,
|
||||
) && (
|
||||
<span
|
||||
className="ml-1 mt-0.5"
|
||||
|
|
@ -193,6 +153,55 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
<span className="flex items-center gap-2 whitespace-nowrap">
|
||||
{props.showNoContext ? (
|
||||
<span
|
||||
style={{
|
||||
color: props.usingCodebase ? vscBadgeBackground : lightGray,
|
||||
backgroundColor: props.usingCodebase
|
||||
? lightGray + "33"
|
||||
: undefined,
|
||||
borderRadius: defaultBorderRadius,
|
||||
padding: "2px 4px",
|
||||
}}
|
||||
>
|
||||
{getAltKeyLabel()} ⏎{" "}
|
||||
{useActiveFile ? "No context" : "Use active file"}
|
||||
</span>
|
||||
) : (
|
||||
<StyledSpan
|
||||
style={{
|
||||
color: props.usingCodebase ? vscBadgeBackground : lightGray,
|
||||
backgroundColor: props.usingCodebase
|
||||
? lightGray + "33"
|
||||
: undefined,
|
||||
borderRadius: defaultBorderRadius,
|
||||
padding: "2px 4px",
|
||||
}}
|
||||
onClick={(e) => {
|
||||
props.onEnter({
|
||||
useCodebase: true,
|
||||
noContext: !useActiveFile,
|
||||
});
|
||||
}}
|
||||
className={"hover:underline cursor-pointer float-right"}
|
||||
>
|
||||
{getMetaKeyLabel()} ⏎ Use codebase
|
||||
</StyledSpan>
|
||||
)}
|
||||
<EnterButton
|
||||
offFocus={props.usingCodebase}
|
||||
onClick={(e) => {
|
||||
props.onEnter({
|
||||
useCodebase: isMetaEquivalentKeyPressed(e),
|
||||
noContext: useActiveFile ? e.altKey : !e.altKey,
|
||||
});
|
||||
}}
|
||||
>
|
||||
⏎ Enter
|
||||
</EnterButton>
|
||||
</span>
|
||||
</StyledDiv>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ function DropdownIcon(props: { className?: string; item: ComboBoxItem }) {
|
|||
props.item.type === "contextProvider"
|
||||
? props.item.id
|
||||
: props.item.type === "slashCommand"
|
||||
? props.item.id
|
||||
: props.item.type;
|
||||
? props.item.id
|
||||
: props.item.type;
|
||||
|
||||
const iconClass = `${props.className} flex-shrink-0`;
|
||||
|
||||
|
|
@ -103,18 +103,16 @@ function DropdownIcon(props: { className?: string; item: ComboBoxItem }) {
|
|||
fallbackIcon = <Icon className={iconClass} height="1.2em" width="1.2em" />;
|
||||
}
|
||||
|
||||
if (false && props.item.iconUrl) {
|
||||
try {
|
||||
return (
|
||||
<SafeImg
|
||||
className="flex-shrink-0 pr-2"
|
||||
src={props.item.iconUrl}
|
||||
height="18em"
|
||||
width="18em"
|
||||
fallback={fallbackIcon}
|
||||
/>
|
||||
);
|
||||
} catch (e) {}
|
||||
if (props.item.icon) {
|
||||
return (
|
||||
<SafeImg
|
||||
className="flex-shrink-0 pr-2"
|
||||
src={props.item.icon}
|
||||
height="18em"
|
||||
width="18em"
|
||||
fallback={fallbackIcon}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return fallbackIcon;
|
||||
|
|
@ -122,9 +120,7 @@ function DropdownIcon(props: { className?: string; item: ComboBoxItem }) {
|
|||
|
||||
const ItemsDiv = styled.div`
|
||||
border-radius: ${defaultBorderRadius};
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(0, 0, 0, 0.05),
|
||||
0px 10px 20px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1);
|
||||
font-size: 0.9rem;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import Image from "@tiptap/extension-image";
|
|||
import Paragraph from "@tiptap/extension-paragraph";
|
||||
import Placeholder from "@tiptap/extension-placeholder";
|
||||
import Text from "@tiptap/extension-text";
|
||||
import { Plugin } from "@tiptap/pm/state";
|
||||
import { Editor, EditorContent, JSONContent, useEditor } from "@tiptap/react";
|
||||
import {Plugin} from "@tiptap/pm/state"
|
||||
import {
|
||||
ContextItemWithId,
|
||||
ContextProviderDescription,
|
||||
|
|
@ -14,6 +14,7 @@ import {
|
|||
} from "core";
|
||||
import { modelSupportsImages } from "core/llm/autodetect";
|
||||
import { getBasename, getRelativePath } from "core/util";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import styled from "styled-components";
|
||||
|
|
@ -55,12 +56,11 @@ import {
|
|||
getSlashCommandDropdownOptions,
|
||||
} from "./getSuggestion";
|
||||
import { ComboBoxItem } from "./types";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
|
||||
const InputBoxDiv = styled.div`
|
||||
resize: none;
|
||||
|
||||
padding: 8px;
|
||||
padding: 12px;
|
||||
padding-bottom: 4px;
|
||||
font-family: inherit;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
|
|
@ -264,30 +264,36 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
Image.extend({
|
||||
addProseMirrorPlugins() {
|
||||
const plugin = new Plugin({
|
||||
props: {
|
||||
handleDOMEvents: {
|
||||
paste(view, event) {
|
||||
const items = event.clipboardData.items;
|
||||
for (const item of items) {
|
||||
const file = item.getAsFile()
|
||||
file &&
|
||||
modelSupportsImages(defaultModel.provider, defaultModel.model, defaultModel.title, defaultModel.capabilities) &&
|
||||
props: {
|
||||
handleDOMEvents: {
|
||||
paste(view, event) {
|
||||
const items = event.clipboardData.items;
|
||||
for (const item of items) {
|
||||
const file = item.getAsFile();
|
||||
file &&
|
||||
modelSupportsImages(
|
||||
defaultModel.provider,
|
||||
defaultModel.model,
|
||||
defaultModel.title,
|
||||
defaultModel.capabilities,
|
||||
) &&
|
||||
handleImageFile(file).then((resp) => {
|
||||
if (!resp) return
|
||||
const [img, dataUrl] = resp
|
||||
if (!resp) return;
|
||||
const [img, dataUrl] = resp;
|
||||
const { schema } = view.state;
|
||||
const node = schema.nodes.image.create({ src: dataUrl });
|
||||
const node = schema.nodes.image.create({
|
||||
src: dataUrl,
|
||||
});
|
||||
const tr = view.state.tr.insert(0, node);
|
||||
view.dispatch(tr);
|
||||
});
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
return [plugin]
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
return [plugin];
|
||||
},
|
||||
}),
|
||||
Placeholder.configure({
|
||||
placeholder: () =>
|
||||
|
|
@ -796,7 +802,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
defaultModel.provider,
|
||||
defaultModel.model,
|
||||
defaultModel.title,
|
||||
defaultModel.capabilities
|
||||
defaultModel.capabilities,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
|
|
@ -845,7 +851,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
defaultModel.provider,
|
||||
defaultModel.model,
|
||||
defaultModel.title,
|
||||
defaultModel.capabilities
|
||||
defaultModel.capabilities,
|
||||
) && (
|
||||
<>
|
||||
<HoverDiv></HoverDiv>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ function getSubActionsForSubmenuItem(
|
|||
label: "Open in new tab",
|
||||
icon: "trash",
|
||||
action: () => {
|
||||
ideMessenger.request("context/removeDocs", { baseUrl: item.id });
|
||||
ideMessenger.request("context/removeDocs", { startUrl: item.id });
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
@ -156,6 +156,7 @@ export function getContextProviderDropdownOptions(
|
|||
label: result.title,
|
||||
type: result.providerTitle as ComboBoxItemType,
|
||||
query: result.id,
|
||||
icon: result.icon,
|
||||
};
|
||||
});
|
||||
} else if (
|
||||
|
|
|
|||
2
gui/src/components/mainInput/types.d.ts
vendored
2
gui/src/components/mainInput/types.d.ts
vendored
|
|
@ -23,7 +23,7 @@ export interface ComboBoxItem {
|
|||
contextProvider?: ContextProviderDescription;
|
||||
query?: string;
|
||||
label?: string;
|
||||
iconUrl?: string;
|
||||
icon?: string;
|
||||
action?: () => void;
|
||||
subActions?: ComboBoxSubAction[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ const StyledListboxButton = styled(Listbox.Button)`
|
|||
gap: 2px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: ${() => `${getFontSize() - 3}px`};
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
background: transparent;
|
||||
color: ${() => lightGray};
|
||||
color: ${lightGray};
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
import _ from "lodash";
|
||||
import { useCallback, useContext, useEffect, useState } from "react";
|
||||
import React, { useCallback, useContext, useEffect, useState } from "react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
|
|
@ -14,6 +14,7 @@ import {
|
|||
import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview";
|
||||
import ModelCard from "../../components/modelSelection/ModelCard";
|
||||
import ModelProviderTag from "../../components/modelSelection/ModelProviderTag";
|
||||
import Toggle from "../../components/modelSelection/Toggle";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { setDefaultModel } from "../../redux/slices/stateSlice";
|
||||
|
|
@ -64,12 +65,35 @@ function ConfigureProvider() {
|
|||
undefined,
|
||||
);
|
||||
|
||||
// different authentication flow is required for watsonx. This state helps to determine which flow to use for authentication
|
||||
const [watsonxAuthenticate, setWatsonxAuthenticate] = React.useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (providerName) {
|
||||
setModelInfo(providers[providerName]);
|
||||
}
|
||||
}, [providerName]);
|
||||
|
||||
const handleContinue = () => {
|
||||
if (!modelInfo) return;
|
||||
|
||||
let formParams: any = {};
|
||||
for (const d of modelInfo.collectInputFor || []) {
|
||||
const val = formMethods.watch(d.key);
|
||||
if (val === "" || val === undefined || val === null) continue;
|
||||
formParams = updatedObj(formParams, {
|
||||
[d.key]: d.inputType === "text" ? val : parseFloat(val),
|
||||
});
|
||||
}
|
||||
const model = {
|
||||
...formParams,
|
||||
provider: modelInfo.provider,
|
||||
};
|
||||
ideMessenger.post("config/addModel", { model });
|
||||
dispatch(setDefaultModel({ title: model.title, force: true }));
|
||||
navigate("/");
|
||||
};
|
||||
|
||||
const disableModelCards = useCallback(() => {
|
||||
return (
|
||||
modelInfo?.collectInputFor?.some((d) => {
|
||||
|
|
@ -82,6 +106,17 @@ function ConfigureProvider() {
|
|||
);
|
||||
}, [modelInfo, formMethods]);
|
||||
|
||||
const enablecardsForApikey = useCallback(() => {
|
||||
return modelInfo?.collectInputFor
|
||||
?.filter((d) => d.isWatsonxAuthenticatedByApiKey)
|
||||
.some((d) => !formMethods.watch(d.key));
|
||||
}, [modelInfo, formMethods]);
|
||||
const enablecardsForCredentials = useCallback(() => {
|
||||
return modelInfo?.collectInputFor
|
||||
?.filter((d) => d.isWatsonxAuthenticatedByCredentials)
|
||||
.some((d) => !formMethods.watch(d.key));
|
||||
}, [modelInfo, formMethods]);
|
||||
|
||||
return (
|
||||
<FormProvider {...formMethods}>
|
||||
<div className="overflow-y-scroll">
|
||||
|
|
@ -126,31 +161,112 @@ function ConfigureProvider() {
|
|||
/>
|
||||
<br />
|
||||
|
||||
{(modelInfo?.collectInputFor?.filter((d) => d.required).length || 0) >
|
||||
0 && (
|
||||
{/* The WatsonX Authentication coukd be done by two different ways
|
||||
1 ==> Using Api key
|
||||
2 ==> Using Credentials */}
|
||||
{providerName === "watsonx" ? (
|
||||
<>
|
||||
<h3 className="mb-2">Enter required parameters</h3>
|
||||
<div className="col-span-full py-4">
|
||||
<Toggle
|
||||
selected={watsonxAuthenticate}
|
||||
optionOne={"Authenticate by API key"}
|
||||
optionTwo={"Authenticate by crendentials"}
|
||||
onClick={() => {
|
||||
setWatsonxAuthenticate((prev) => !prev);
|
||||
}}
|
||||
></Toggle>
|
||||
</div>
|
||||
{watsonxAuthenticate ? (
|
||||
<>
|
||||
{(modelInfo?.collectInputFor?.filter((d) => d.required)
|
||||
.length || 0) > 0 && (
|
||||
<>
|
||||
<h3 className="mb-2">Enter required parameters</h3>
|
||||
|
||||
{modelInfo?.collectInputFor
|
||||
?.filter((d) => d.required)
|
||||
.map((d, idx) => (
|
||||
<div key={idx} className="mb-2">
|
||||
<label htmlFor={d.key}>{d.label}</label>
|
||||
<Input
|
||||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="border-2 border-gray-200 rounded-md p-2 m-2"
|
||||
placeholder={d.label}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
step={d.step}
|
||||
{...formMethods.register(d.key, {
|
||||
required: true,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
{modelInfo?.collectInputFor
|
||||
.filter((d) => d.isWatsonxAuthenticatedByApiKey)
|
||||
.map((d, idx) => (
|
||||
<div key={idx} className="mb-2">
|
||||
<label htmlFor={d.key}>{d.label}</label>
|
||||
<Input
|
||||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="border-2 border-gray-200 rounded-md p-2 m-2"
|
||||
placeholder={d.placeholder}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
step={d.step}
|
||||
{...formMethods.register(d.key, {
|
||||
required: false,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{(modelInfo?.collectInputFor?.filter((d) => d.required)
|
||||
.length || 0) > 0 && (
|
||||
<>
|
||||
<h3 className="mb-2">Enter required parameters</h3>
|
||||
|
||||
{modelInfo?.collectInputFor
|
||||
.filter((d) => d.isWatsonxAuthenticatedByCredentials)
|
||||
.map((d, idx) => (
|
||||
<div key={idx} className="mb-2">
|
||||
<label htmlFor={d.key}>{d.label}</label>
|
||||
<Input
|
||||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="border-2 border-gray-200 rounded-md p-2 m-2"
|
||||
placeholder={d.placeholder}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
step={d.step}
|
||||
{...formMethods.register(d.key, {
|
||||
required: true,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{(modelInfo?.collectInputFor?.filter((d) => d.required).length ||
|
||||
0) > 0 && (
|
||||
<>
|
||||
<h3 className="mb-2">Enter required parameters</h3>
|
||||
|
||||
{modelInfo?.collectInputFor
|
||||
?.filter((d) => d.required)
|
||||
.map((d, idx) => (
|
||||
<div key={idx} className="mb-2">
|
||||
<label htmlFor={d.key}>{d.label}</label>
|
||||
<Input
|
||||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="border-2 border-gray-200 rounded-md p-2 m-2"
|
||||
placeholder={d.placeholder}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
step={d.step}
|
||||
{...formMethods.register(d.key, {
|
||||
required: true,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
|
|
@ -160,8 +276,9 @@ function ConfigureProvider() {
|
|||
<summary className="mb-2 cursor-pointer">
|
||||
<b>Advanced (optional)</b>
|
||||
</summary>
|
||||
|
||||
{modelInfo?.collectInputFor?.map((d, idx) => {
|
||||
// Check the attribute is only for Watson X
|
||||
if (d.isWatsonxAttribute) return null;
|
||||
if (d.required) return null;
|
||||
return (
|
||||
<div key={idx}>
|
||||
|
|
@ -170,7 +287,7 @@ function ConfigureProvider() {
|
|||
type={d.inputType}
|
||||
id={d.key}
|
||||
className="border-2 border-gray-200 rounded-md p-2 m-2"
|
||||
placeholder={d.label}
|
||||
placeholder={d.placeholder}
|
||||
defaultValue={d.defaultValue}
|
||||
min={d.min}
|
||||
max={d.max}
|
||||
|
|
@ -192,7 +309,11 @@ function ConfigureProvider() {
|
|||
return (
|
||||
<ModelCard
|
||||
key={idx}
|
||||
disabled={disableModelCards()}
|
||||
disabled={
|
||||
disableModelCards() &&
|
||||
enablecardsForApikey() &&
|
||||
enablecardsForCredentials()
|
||||
}
|
||||
title={pkg.title}
|
||||
description={pkg.description}
|
||||
tags={pkg.tags}
|
||||
|
|
@ -200,7 +321,12 @@ function ConfigureProvider() {
|
|||
icon={pkg.icon || modelInfo.icon}
|
||||
dimensions={pkg.dimensions}
|
||||
onClick={(e, dimensionChoices) => {
|
||||
if (disableModelCards()) return;
|
||||
if (
|
||||
disableModelCards() &&
|
||||
enablecardsForApikey() &&
|
||||
enablecardsForCredentials()
|
||||
)
|
||||
return;
|
||||
let formParams: any = {};
|
||||
for (const d of modelInfo.collectInputFor || []) {
|
||||
const val = formMethods.watch(d.key);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ export interface PackageDimension {
|
|||
description: string;
|
||||
options: { [key: string]: { [key: string]: any } };
|
||||
}
|
||||
|
||||
export interface ModelPackage {
|
||||
title: string;
|
||||
icon?: string;
|
||||
|
|
@ -362,6 +361,44 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
],
|
||||
isOpenSource: true,
|
||||
},
|
||||
graniteCodeOpenSource: {
|
||||
title: "Granite Code",
|
||||
description:
|
||||
"The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.",
|
||||
params: {
|
||||
model: "granite-code",
|
||||
contextLength: 20_000,
|
||||
title: "Granite Code",
|
||||
systemMessage: `You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup, etc) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.`,
|
||||
},
|
||||
providerOptions: ["ollama", "lmstudio", "llama.cpp", "replicate"],
|
||||
icon: "ibm.png",
|
||||
isOpenSource: true,
|
||||
dimensions: [
|
||||
{
|
||||
name: "Parameter Count",
|
||||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"3b": {
|
||||
model: "granite-code-3b",
|
||||
title: "Granite Code 3B",
|
||||
},
|
||||
"8b": {
|
||||
model: "granite-code-8b",
|
||||
title: "Granite Code 8B",
|
||||
},
|
||||
"20b": {
|
||||
model: "granite-code-20b",
|
||||
title: "Granite Code 20B",
|
||||
},
|
||||
"34b": {
|
||||
model: "granite-code-34b",
|
||||
title: "Granite Code 34B",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
wizardCoder: {
|
||||
title: "WizardCoder",
|
||||
description:
|
||||
|
|
@ -684,6 +721,75 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
icon: "anthropic.png",
|
||||
isOpenSource: false,
|
||||
},
|
||||
graniteChat: {
|
||||
title: "WatsonX - Granite Chat",
|
||||
description:
|
||||
"The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.",
|
||||
params: {
|
||||
model: "ibm/granite-13b-chat-v2",
|
||||
contextLength: 20_000,
|
||||
title: "Granite Chat",
|
||||
},
|
||||
providerOptions: ["watsonx"],
|
||||
icon: "",
|
||||
isOpenSource: false,
|
||||
},
|
||||
graniteCode: {
|
||||
title: "WatsonX - Granite Code",
|
||||
description:
|
||||
"The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.",
|
||||
params: {
|
||||
model: "ibm/granite-13b-instruct-v2",
|
||||
contextLength: 20_000,
|
||||
title: "Granite Code",
|
||||
systemMessage: `You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup, etc) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.`,
|
||||
},
|
||||
providerOptions: ["watsonx"],
|
||||
icon: "WatsonX.png",
|
||||
isOpenSource: false,
|
||||
},
|
||||
MistralLarge: {
|
||||
title: "WatsonX - Mistral",
|
||||
description:
|
||||
"Mistral Large, the most advanced Large Language Model (LLM) developed by Mistral Al, is an exceptionally powerful model.",
|
||||
params: {
|
||||
model: "mistralai/mistral-large",
|
||||
contextLength: 20_000,
|
||||
title: "WatsonX - Mistral",
|
||||
},
|
||||
providerOptions: ["watsonx"],
|
||||
icon: "mistral.png",
|
||||
isOpenSource: false,
|
||||
},
|
||||
MetaLlama3: {
|
||||
title: "Meta Llama 3",
|
||||
description:
|
||||
"Llama 3 is an auto-regressive language model that uses an optimized transformer architecture.",
|
||||
params: {
|
||||
title: "Meta-llama3-8b",
|
||||
model: "meta-llama/llama-3-8b-instruct",
|
||||
contextLength: 20_000,
|
||||
},
|
||||
icon: "meta.png",
|
||||
dimensions: [
|
||||
{
|
||||
name: "Parameter Count",
|
||||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"8b": {
|
||||
model: "meta-llama/llama-3-8b-instruct",
|
||||
title: "Meta-llama3-8b",
|
||||
},
|
||||
"70b": {
|
||||
model: "meta-llama/llama-3-70b-instruct",
|
||||
title: "Meta-llama3-70b",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
providerOptions: ["watsonx"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
AUTODETECT: {
|
||||
title: "Autodetect",
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@ export interface InputDescriptor {
|
|||
required?: boolean;
|
||||
description?: string;
|
||||
[key: string]: any;
|
||||
// the following are used only for WatsonX provider
|
||||
// these attributes are used to determine whether the input is used in Api Authentication or Credentials section
|
||||
isWatsonxAuthenticatedByApiKey?: boolean;
|
||||
isWatsonxAuthenticatedByCredentials?: boolean;
|
||||
isWatsonxAttribute?: boolean;
|
||||
}
|
||||
|
||||
export interface ProviderInfo {
|
||||
|
|
@ -476,6 +481,82 @@ After it's up and running, you can start using Continue.`,
|
|||
...openSourceModels,
|
||||
],
|
||||
},
|
||||
watsonx: {
|
||||
title: "WatsonX",
|
||||
provider: "watsonx",
|
||||
refPage: "watsonX",
|
||||
description:
|
||||
"Explore foundation models from IBM and other third-parties depending on your use case.",
|
||||
longDescription: `Watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.`,
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "watsonxUrl",
|
||||
label: "WatsonX URL",
|
||||
placeholder: "http://<region>.dataplatform.cloud.ibm.com",
|
||||
required: true,
|
||||
isWatsonxAuthenticatedByApiKey: true,
|
||||
isWatsonxAuthenticatedByCredentials: true,
|
||||
},
|
||||
{
|
||||
inputType: "text",
|
||||
key: "watsonxApiKey",
|
||||
label: "WatsonX API Key",
|
||||
placeholder: "Enter your API key",
|
||||
required: true,
|
||||
isWatsonxAuthenticatedByApiKey: true,
|
||||
},
|
||||
{
|
||||
inputType: "text",
|
||||
key: "watsonxProjectId",
|
||||
label: "WatsonX Project Id",
|
||||
placeholder: "Enter your project Id",
|
||||
required: true,
|
||||
isWatsonxAuthenticatedByApiKey: true,
|
||||
isWatsonxAuthenticatedByCredentials: true,
|
||||
},
|
||||
{
|
||||
inputType: "text",
|
||||
key: "watsonxUsername",
|
||||
label: "WatsonX Username",
|
||||
placeholder: "Enter your Username",
|
||||
required: true,
|
||||
isWatsonxAuthenticatedByCredentials: true,
|
||||
},
|
||||
{
|
||||
inputType: "text",
|
||||
key: "watsonxPassword",
|
||||
label: "WatsonX Password",
|
||||
placeholder: "Enter your password",
|
||||
required: true,
|
||||
isWatsonxAuthenticatedByCredentials: true,
|
||||
},
|
||||
{
|
||||
inputType: "text",
|
||||
key: "title",
|
||||
label: "Model name",
|
||||
placeholder: "Granite 13B Chat v2",
|
||||
isWatsonxAttribute: true,
|
||||
},
|
||||
{
|
||||
inputType: "text",
|
||||
key: "model",
|
||||
label: "Model Id",
|
||||
placeholder: "ibm/granite-13b-chat-v2",
|
||||
isWatsonxAttribute: true,
|
||||
},
|
||||
|
||||
...completionParamsInputsConfigs,
|
||||
],
|
||||
icon: "WatsonX.png",
|
||||
tags: [ModelProviderTags.RequiresApiKey],
|
||||
packages: [
|
||||
models.graniteCode,
|
||||
models.graniteChat,
|
||||
models.MistralLarge,
|
||||
models.MetaLlama3,
|
||||
],
|
||||
},
|
||||
"free-trial": {
|
||||
title: "Continue limited free trial",
|
||||
provider: "free-trial",
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ const StopButton = styled.div`
|
|||
`;
|
||||
|
||||
const StepsDiv = styled.div`
|
||||
padding-bottom: 8px;
|
||||
position: relative;
|
||||
background-color: transparent;
|
||||
|
||||
|
|
@ -510,26 +511,30 @@ function GUI() {
|
|||
<br />
|
||||
</>
|
||||
) : state.history.length > 0 ? (
|
||||
<NewSessionButton
|
||||
onClick={() => {
|
||||
saveSession();
|
||||
}}
|
||||
className="mr-auto"
|
||||
>
|
||||
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"})
|
||||
</NewSessionButton>
|
||||
<div className="mt-2">
|
||||
<NewSessionButton
|
||||
onClick={() => {
|
||||
saveSession();
|
||||
}}
|
||||
className="mr-auto"
|
||||
>
|
||||
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"})
|
||||
</NewSessionButton>{" "}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{getLastSessionId() ? (
|
||||
<NewSessionButton
|
||||
onClick={async () => {
|
||||
loadLastSession();
|
||||
}}
|
||||
className="mr-auto flex items-center gap-1"
|
||||
>
|
||||
<ArrowLeftIcon width="11px" height="11px" />
|
||||
Last Session
|
||||
</NewSessionButton>
|
||||
<div className="mt-2">
|
||||
<NewSessionButton
|
||||
onClick={async () => {
|
||||
loadLastSession();
|
||||
}}
|
||||
className="mr-auto flex items-center gap-2"
|
||||
>
|
||||
<ArrowLeftIcon width="11px" height="11px" />
|
||||
Last Session
|
||||
</NewSessionButton>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{!!showTutorialCard && (
|
||||
|
|
@ -549,7 +554,7 @@ function GUI() {
|
|||
</TopGuiDiv>
|
||||
{active && (
|
||||
<StopButton
|
||||
className="mt-auto"
|
||||
className="mt-auto mb-4"
|
||||
onClick={() => {
|
||||
dispatch(setInactive());
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue