🚸 add python path to global vscode settings
This commit is contained in:
parent
ba0c8052e8
commit
dd95670e40
2 changed files with 24 additions and 2 deletions
|
|
@ -42,7 +42,7 @@ function addPythonPathForConfig() {
|
|||
const pathToAdd = extensionContext?.extensionPath;
|
||||
if (analysisPaths && pathToAdd && !analysisPaths.includes(pathToAdd)) {
|
||||
analysisPaths.push(pathToAdd);
|
||||
pythonConfig.update("analysis.extraPaths", analysisPaths);
|
||||
pythonConfig.update("analysis.extraPaths", analysisPaths, vscode.ConfigurationTarget.Global);
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
@ -51,7 +51,7 @@ function addPythonPathForConfig() {
|
|||
!autoCompletePaths.includes(pathToAdd)
|
||||
) {
|
||||
autoCompletePaths.push(pathToAdd);
|
||||
pythonConfig.update("autoComplete.extraPaths", autoCompletePaths);
|
||||
pythonConfig.update("autoComplete.extraPaths", autoCompletePaths, vscode.ConfigurationTarget.Global);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import ssl
|
||||
from textwrap import dedent
|
||||
from time import time
|
||||
from typing import Any, Callable, Coroutine, Dict, Generator, List, Optional, Union
|
||||
|
||||
import aiohttp
|
||||
|
|
@ -428,15 +429,36 @@ Settings:
|
|||
completion = ""
|
||||
|
||||
# Use the template_messages function if it exists and do a raw completion
|
||||
ti = time()
|
||||
tf = None
|
||||
if self.template_messages is None:
|
||||
async for chunk in self._stream_chat(messages=messages, options=options):
|
||||
yield chunk
|
||||
if "content" in chunk:
|
||||
completion += chunk["content"]
|
||||
if tf is None:
|
||||
tf = time()
|
||||
ttft = tf - ti
|
||||
posthog_logger.capture_event("time_to_first_token", {
|
||||
"model": self.model,
|
||||
"model_class": self.__class__.__name__,
|
||||
"time": ttft,
|
||||
"tokens": self.count_tokens(sum(m["content"] for m in messages))
|
||||
})
|
||||
|
||||
else:
|
||||
async for chunk in self._stream_complete(prompt=prompt, options=options):
|
||||
yield {"role": "assistant", "content": chunk}
|
||||
completion += chunk
|
||||
if tf is None:
|
||||
tf = time()
|
||||
ttft = tf - ti
|
||||
posthog_logger.capture_event("time_to_first_token", {
|
||||
"model": self.model,
|
||||
"model_class": self.__class__.__name__,
|
||||
"time": ttft,
|
||||
"tokens": self.count_tokens(prompt)
|
||||
})
|
||||
|
||||
# if log:
|
||||
# self.write_log(f"Completion: \n\n{completion}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue