refactor: 🏷️ make HighlightedCodeContextProvider a subclass of ContextProvider
This commit is contained in:
parent
9a9b7aae31
commit
1e81182e7a
2 changed files with 13 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List
|
|||
|
||||
from ...core.main import ChatMessage
|
||||
from ...models.filesystem import RangeInFile, RangeInFileWithContents
|
||||
from ...core.context import ContextItem, ContextItemDescription, ContextItemId
|
||||
from ...core.context import ContextItem, ContextItemDescription, ContextItemId, ContextProvider
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ class HighlightedRangeContextItem(BaseModel):
|
|||
item: ContextItem
|
||||
|
||||
|
||||
class HighlightedCodeContextProvider(BaseModel):
|
||||
class HighlightedCodeContextProvider(ContextProvider):
|
||||
"""
|
||||
The ContextProvider class is a plugin that lets you provide new information to the LLM by typing '@'.
|
||||
When you type '@', the context provider will be asked to populate a list of options.
|
||||
|
|
@ -99,6 +99,15 @@ class HighlightedCodeContextProvider(BaseModel):
|
|||
async def provide_context_items(self) -> List[ContextItem]:
|
||||
return []
|
||||
|
||||
async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
|
||||
raise NotImplementedError()
|
||||
|
||||
async def clear_context(self):
|
||||
self.highlighted_ranges = []
|
||||
self.adding_highlighted_code = False
|
||||
self.should_get_fallback_context_item = True
|
||||
self.last_added_fallback = False
|
||||
|
||||
async def delete_context_with_ids(self, ids: List[ContextItemId]) -> List[ContextItem]:
|
||||
indices_to_delete = [
|
||||
int(id.item_id) for id in ids
|
||||
|
|
|
|||
|
|
@ -470,7 +470,6 @@ export async function startContinuePythonServer() {
|
|||
shell: true,
|
||||
});
|
||||
child.stderr.on("data", (data: any) => {
|
||||
console.log(`stdout: ${data}`);
|
||||
if (
|
||||
data.includes("Uvicorn running on") || // Successfully started the server
|
||||
data.includes("only one usage of each socket address") || // [windows] The server is already running (probably a simultaneously opened VS Code window)
|
||||
|
|
@ -480,6 +479,8 @@ export async function startContinuePythonServer() {
|
|||
resolve(null);
|
||||
} else if (data.includes("ERROR") || data.includes("Traceback")) {
|
||||
console.log("Error starting Continue python server: ", data);
|
||||
} else {
|
||||
console.log(`stdout: ${data}`);
|
||||
}
|
||||
});
|
||||
child.on("error", (error: any) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue