🐛 useEffect, config, and chunking fixes
This commit is contained in:
parent
d3aa289f0c
commit
0871f64503
5 changed files with 40 additions and 25 deletions
|
|
@ -575,7 +575,7 @@ class IdeProtocolClient {
|
|||
}
|
||||
|
||||
async readFile(filepath: string): Promise<string> {
|
||||
const MAX_BYTES = 500000; // 0.5MB - socket.io has a 1MB limit, but seems to die a bit above 0.5MB
|
||||
const MAX_BYTES = 100000; // 0.1MB - socket.io has a 1MB limit, but seems to die a around 0.5MB
|
||||
let contents: string | undefined;
|
||||
if (typeof contents === "undefined") {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -671,9 +671,9 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
};
|
||||
}, []);
|
||||
|
||||
const persistSession = useCallback(() => {
|
||||
const persistSession = () => {
|
||||
client?.persistSession(sessionState, workspacePaths[0] || "");
|
||||
}, [client, sessionState, workspacePaths]);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!inputRef.current || !props.isMainInput) {
|
||||
|
|
@ -704,7 +704,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
return () => {
|
||||
window.removeEventListener("message", handler);
|
||||
};
|
||||
}, [inputRef.current, props.isMainInput, persistSession]);
|
||||
}, [inputRef.current, props.isMainInput]);
|
||||
|
||||
const deleteButtonDivRef = React.useRef<HTMLDivElement>(null);
|
||||
const stickyDropdownHeaderDiv = React.useRef<HTMLDivElement>(null);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from .context import ContextProvider
|
|||
from .main import ContextProviderDescription, Policy, SlashCommandDescription, Step
|
||||
from .models import Models
|
||||
from ..libs.util.telemetry import posthog_logger
|
||||
from ..libs.util.logging import logger
|
||||
|
||||
|
||||
class SlashCommand(BaseModel):
|
||||
|
|
@ -159,32 +160,32 @@ class ContinueConfig(BaseModel):
|
|||
return max(0.0, min(1.0, v))
|
||||
|
||||
@staticmethod
|
||||
def from_filepath(filepath: str) -> "ContinueConfig":
|
||||
def from_filepath(filepath: str, retry: bool = True) -> "ContinueConfig":
|
||||
# Use importlib to load the config file config.py at the given path
|
||||
import importlib.util
|
||||
try:
|
||||
import importlib.util
|
||||
|
||||
spec = importlib.util.spec_from_file_location("config", filepath)
|
||||
config = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(config)
|
||||
spec = importlib.util.spec_from_file_location("config", filepath)
|
||||
config = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(config)
|
||||
|
||||
return config.config
|
||||
return config.config
|
||||
except ModuleNotFoundError as e:
|
||||
# Check if the module was "continuedev.src"
|
||||
if retry and e.name == "continuedev.src":
|
||||
convertConfigImports(shorten=True)
|
||||
return ContinueConfig.from_filepath(filepath, retry=False)
|
||||
else:
|
||||
logger.critical(f"Failed to load config.py: {e}")
|
||||
except Exception as e:
|
||||
logger.critical(f"Failed to load config.py: {e}")
|
||||
|
||||
return ContinueConfig()
|
||||
|
||||
@staticmethod
|
||||
def load_default(retry: bool = True) -> "ContinueConfig":
|
||||
try:
|
||||
path = getConfigFilePath()
|
||||
config = ContinueConfig.from_filepath(path)
|
||||
|
||||
return config
|
||||
except ModuleNotFoundError as e:
|
||||
if not retry:
|
||||
raise e
|
||||
# Check if the module was "continuedev.src"
|
||||
if e.name == "continuedev.src":
|
||||
convertConfigImports(shorten=True)
|
||||
return ContinueConfig.load_default(retry=False)
|
||||
else:
|
||||
raise e
|
||||
def load_default() -> "ContinueConfig":
|
||||
path = getConfigFilePath()
|
||||
return ContinueConfig.from_filepath(path)
|
||||
|
||||
def get_slash_command_descriptions(self) -> List[SlashCommandDescription]:
|
||||
custom_commands = (
|
||||
|
|
|
|||
|
|
@ -40,6 +40,19 @@ FILE_IGNORE_PATTERNS = [
|
|||
"*.dylib",
|
||||
"*.ncb",
|
||||
"*.sdf",
|
||||
"*.woff",
|
||||
"*.woff2",
|
||||
"*.eot",
|
||||
"*.cur",
|
||||
"*.avi",
|
||||
"*.mpg",
|
||||
"*.mpeg",
|
||||
"*.mov",
|
||||
"*.mp3",
|
||||
"*.mp4",
|
||||
"*.mkv",
|
||||
"*.mkv",
|
||||
"*.webm",
|
||||
]
|
||||
|
||||
MAX_SIZE_IN_CHARS = 50_000
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ def migrateConfigFile(existing: str) -> Optional[str]:
|
|||
.replace("TextGenUI", "TextGenWebUI")
|
||||
.replace("text_gen_interface", "text_gen_webui")
|
||||
.replace(".steps.chroma", ".steps.codebase")
|
||||
.replace("\xa0", " ")
|
||||
)
|
||||
if migrated != existing:
|
||||
return migrated
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue