fix: 🐛 number of bug fixes

This commit is contained in:
Nate Sesti 2023-09-02 11:27:30 -07:00
parent 45bd553536
commit b9bdf5894c
4 changed files with 15 additions and 7 deletions

View file

@ -52,7 +52,7 @@ class HuggingFaceTGI(LLM):
) as client_session:
async with client_session.post(
f"{self.server_url}",
json={"inputs": prompt, **self._transform_args(args)},
json={"inputs": prompt, **args},
) as resp:
async for line in resp.content.iter_any():
if line:

View file

@ -87,7 +87,7 @@ class LlamaCpp(LLM):
f"{self.server_url}/completion",
json={
"prompt": prompt,
**self._transform_args(args),
**args,
},
headers={"Content-Type": "application/json"},
) as resp:
@ -107,7 +107,7 @@ class LlamaCpp(LLM):
self.model,
messages,
self.context_length,
args["max_tokens"],
args["n_predict"] if "n_predict" in args else 1024,
None,
functions=args.get("functions", None),
system_message=self.system_message,
@ -123,7 +123,7 @@ class LlamaCpp(LLM):
) as client_session:
async with client_session.post(
f"{self.server_url}/completion",
json={"prompt": prompt, **self._transform_args(args)},
json={"prompt": prompt, **args},
headers=headers,
) as resp:
async for line in resp.content:
@ -170,7 +170,7 @@ class LlamaCpp(LLM):
) as client_session:
async with client_session.post(
f"{self.server_url}/completion",
json={"prompt": prompt, **self._transform_args(args)},
json={"prompt": prompt, **args},
headers={"Content-Type": "application/json"},
) as resp:
json_resp = await resp.json()

View file

@ -123,7 +123,7 @@ class FileContextProvider(ContextProvider):
)
async def provide_context_items(self, workspace_dir: str) -> List[ContextItem]:
contents = await self.sdk.ide.listDirectoryContents(workspace_dir, True)
contents = await self.sdk.ide.listDirectoryContents(workspace_dir, False)
if contents is None:
return []

View file

@ -72,7 +72,8 @@ class IdeProtocolClient {
this.handleMessage(messageType, data, messenger).catch((err) => {
vscode.window
.showErrorMessage(
"Error handling message from Continue server: " + err.message,
`Error handling message (${messageType}) from Continue server: ` +
err.message,
"View Logs"
)
.then((selection) => {
@ -613,6 +614,13 @@ class IdeProtocolClient {
let contents: string | undefined;
if (typeof contents === "undefined") {
try {
const fileStats = await vscode.workspace.fs.stat(
uriFromFilePath(filepath)
);
if (fileStats.size > 1000000) {
return "";
}
contents = await vscode.workspace.fs
.readFile(uriFromFilePath(filepath))
.then((bytes) => new TextDecoder().decode(bytes));