diff options
-rw-r--r-- | continuedev/src/continuedev/core/context.py | 52 | ||||
-rw-r--r-- | continuedev/src/continuedev/plugins/context_providers/highlighted_code.py | 3 | ||||
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 7 | ||||
-rw-r--r-- | extension/react-app/src/components/TextDialog.tsx | 37 | ||||
-rw-r--r-- | extension/src/debugPanel.ts | 1 | ||||
-rw-r--r-- | extension/src/diffs.ts | 56 |
7 files changed, 92 insertions, 68 deletions
diff --git a/continuedev/src/continuedev/core/context.py b/continuedev/src/continuedev/core/context.py index 7d302656..4a141830 100644 --- a/continuedev/src/continuedev/core/context.py +++ b/continuedev/src/continuedev/core/context.py @@ -50,22 +50,23 @@ class ContextProvider(BaseModel): """ return [ChatMessage(role="user", content=f"{item.description.name}: {item.description.description}\n\n{item.content}", summary=item.description.description) for item in await self.get_selected_items()] - async def get_item(self, id: ContextItemId, query: str, search_client: Client) -> ContextItem: + async def get_item(self, id: ContextItemId, query: str) -> ContextItem: """ Returns the ContextItem with the given id. Default implementation uses the search index to get the item. """ - result = await search_client.index( - SEARCH_INDEX_NAME).get_document(id.to_string()) - return ContextItem( - description=ContextItemDescription( - name=result["name"], - description=result["description"], - id=id - ), - content=result["content"] - ) + async with Client('http://localhost:7700') as search_client: + result = await search_client.index( + SEARCH_INDEX_NAME).get_document(id.to_string()) + return ContextItem( + description=ContextItemDescription( + name=result["name"], + description=result["description"], + id=id + ), + content=result["content"] + ) async def delete_context_with_ids(self, ids: List[ContextItemId]): """ @@ -85,7 +86,7 @@ class ContextProvider(BaseModel): """ self.selected_items = [] - async def add_context_item(self, id: ContextItemId, query: str, search_client: Client): + async def add_context_item(self, id: ContextItemId, query: str): """ Adds the given ContextItem to the list of ContextItems. @@ -99,7 +100,7 @@ class ContextProvider(BaseModel): if item.description.id.item_id == id.item_id: return - new_item = await self.get_item(id, query, search_client) + new_item = await self.get_item(id, query) self.selected_items.append(new_item) @@ -126,10 +127,7 @@ class ContextManager: """ return sum([await provider.get_chat_messages() for provider in self.context_providers.values()], []) - search_client: Client - - def __init__(self, context_providers: List[ContextProvider], search_client: Client): - self.search_client = search_client + def __init__(self, context_providers: List[ContextProvider]): self.context_providers = { prov.title: prov for prov in context_providers} self.provider_titles = { @@ -137,14 +135,15 @@ class ContextManager: @classmethod async def create(cls, context_providers: List[ContextProvider]): - search_client = Client('http://localhost:7700') - health = await search_client.health() - if not health.status == "available": - print("MeiliSearch not running, avoiding any dependent context providers") - context_providers = list( - filter(lambda cp: cp.title == "code", context_providers)) + async with Client('http://localhost:7700') as search_client: + health = await search_client.health() + if not health.status == "available": + print( + "MeiliSearch not running, avoiding any dependent context providers") + context_providers = list( + filter(lambda cp: cp.title == "code", context_providers)) - return cls(context_providers, search_client) + return cls(context_providers) async def load_index(self): for _, provider in self.context_providers.items(): @@ -159,7 +158,8 @@ class ContextManager: for item in context_items ] if len(documents) > 0: - await self.search_client.index(SEARCH_INDEX_NAME).add_documents(documents) + async with Client('http://localhost:7700') as search_client: + await search_client.index(SEARCH_INDEX_NAME).add_documents(documents) # def compile_chat_messages(self, max_tokens: int) -> List[Dict]: # """ @@ -176,7 +176,7 @@ class ContextManager: raise ValueError( f"Context provider with title {id.provider_title} not found") - await self.context_providers[id.provider_title].add_context_item(id, query, self.search_client) + await self.context_providers[id.provider_title].add_context_item(id, query) async def delete_context_with_ids(self, ids: List[str]): """ diff --git a/continuedev/src/continuedev/plugins/context_providers/highlighted_code.py b/continuedev/src/continuedev/plugins/context_providers/highlighted_code.py index 426c0804..86c5b7ab 100644 --- a/continuedev/src/continuedev/plugins/context_providers/highlighted_code.py +++ b/continuedev/src/continuedev/plugins/context_providers/highlighted_code.py @@ -1,7 +1,6 @@ import os from typing import Any, Dict, List -from meilisearch_python_async import Client from ...core.main import ChatMessage from ...models.filesystem import RangeInFile, RangeInFileWithContents from ...core.context import ContextItem, ContextItemDescription, ContextItemId @@ -187,5 +186,5 @@ class HighlightedCodeContextProvider(BaseModel): for hr in self.highlighted_ranges: hr.item.editing = hr.item.description.id.to_string() in ids - async def add_context_item(self, id: ContextItemId, query: str, search_client: Client, prev: List[ContextItem] = None) -> List[ContextItem]: + async def add_context_item(self, id: ContextItemId, query: str, prev: List[ContextItem] = None) -> List[ContextItem]: raise NotImplementedError() diff --git a/extension/package-lock.json b/extension/package-lock.json index 67b8a099..0c48d378 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.204", + "version": "0.0.206", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.204", + "version": "0.0.206", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 00a7b54c..919bf357 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "The open-source coding autopilot", - "version": "0.0.204", + "version": "0.0.206", "publisher": "Continue", "engines": { "vscode": "^1.67.0" @@ -53,11 +53,6 @@ "type": "string", "default": null, "description": "The OpenAI API key to use for code generation." - }, - "continue.dataSwitch": { - "type": "boolean", - "default": false, - "description": "If true, collect data on accepted and rejected suggestions." } } }, diff --git a/extension/react-app/src/components/TextDialog.tsx b/extension/react-app/src/components/TextDialog.tsx index 7d8e9920..43051a04 100644 --- a/extension/react-app/src/components/TextDialog.tsx +++ b/extension/react-app/src/components/TextDialog.tsx @@ -81,7 +81,42 @@ const TextDialog = (props: { }} > <Dialog> - <ReactMarkdown>{props.message || ""}</ReactMarkdown> + {props.message?.includes("Continue uses GPT-4") ? ( + <div> + <p> + Continue uses GPT-4 by default, but works with any model. If + you'd like to keep your code completely private, there are few + options: + </p> + + <p> + Run a local model with ggml:{" "} + <a + href="https://github.com/continuedev/ggml-server-example" + target="_blank" + > + 5 minute quickstart + </a> + </p> + + <p> + Use Azure OpenAI service, which is GDPR and HIPAA compliant: + <a + href="https://continue.dev/docs/customization#azure-openai-service" + target="_blank" + > + Tutorial + </a> + </p> + + <p> + If you already have an LLM deployed on your own infrastructure, + or would like to do so, please contact us at hi@continue.dev. + </p> + </div> + ) : ( + <ReactMarkdown>{props.message || ""}</ReactMarkdown> + )} {props.entryOn && ( <> <TextArea diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index 6dcb588a..ece362f5 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -95,6 +95,7 @@ export function setupDebugPanel( panel.webview.options = { enableScripts: true, localResourceRoots: [vscode.Uri.joinPath(extensionUri, "react-app/dist")], + enableCommandUris: true, }; const nonce = getNonce(); diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index 1130a06a..efaf7626 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -273,40 +273,34 @@ class DiffManager { export const diffManager = new DiffManager(); function recordAcceptReject(accepted: boolean, diffInfo: DiffInfo) { - const collectOn = vscode.workspace - .getConfiguration("continue") - .get<boolean>("dataSwitch"); + const devDataDir = devDataPath(); + const suggestionsPath = path.join(devDataDir, "suggestions.json"); - if (collectOn) { - const devDataDir = devDataPath(); - const suggestionsPath = path.join(devDataDir, "suggestions.json"); + // Initialize suggestions list + let suggestions = []; - // Initialize suggestions list - let suggestions = []; - - // Check if suggestions.json exists - if (fs.existsSync(suggestionsPath)) { - const rawData = fs.readFileSync(suggestionsPath, "utf-8"); - suggestions = JSON.parse(rawData); - } - - // Add the new suggestion to the list - suggestions.push({ - accepted, - timestamp: Date.now(), - suggestion: diffInfo.originalFilepath, - }); - - // Send the suggestion to the server - // ideProtocolClient.sendAcceptRejectSuggestion(accepted); - - // Write the updated suggestions back to the file - fs.writeFileSync( - suggestionsPath, - JSON.stringify(suggestions, null, 4), - "utf-8" - ); + // Check if suggestions.json exists + if (fs.existsSync(suggestionsPath)) { + const rawData = fs.readFileSync(suggestionsPath, "utf-8"); + suggestions = JSON.parse(rawData); } + + // Add the new suggestion to the list + suggestions.push({ + accepted, + timestamp: Date.now(), + suggestion: diffInfo.originalFilepath, + }); + + // Send the suggestion to the server + // ideProtocolClient.sendAcceptRejectSuggestion(accepted); + + // Write the updated suggestions back to the file + fs.writeFileSync( + suggestionsPath, + JSON.stringify(suggestions, null, 4), + "utf-8" + ); } export async function acceptDiffCommand(newFilepath?: string) { |