diff options
Diffstat (limited to 'continuedev/src')
| -rw-r--r-- | continuedev/src/.gitignore | 4 | ||||
| -rw-r--r-- | continuedev/src/continuedev/libs/llm/openai.py | 7 | ||||
| -rw-r--r-- | continuedev/src/continuedev/libs/util/paths.py | 21 | ||||
| -rw-r--r-- | continuedev/src/continuedev/plugins/recipes/AddTransformRecipe/steps.py | 4 | ||||
| -rw-r--r-- | continuedev/src/continuedev/plugins/recipes/DDtoBQRecipe/steps.py | 3 | ||||
| -rw-r--r-- | continuedev/src/continuedev/plugins/steps/draft/migration.py | 30 | ||||
| -rw-r--r-- | continuedev/src/run.py | 4 | 
7 files changed, 29 insertions, 44 deletions
diff --git a/continuedev/src/.gitignore b/continuedev/src/.gitignore new file mode 100644 index 00000000..7137bb08 --- /dev/null +++ b/continuedev/src/.gitignore @@ -0,0 +1,4 @@ +main.build +main.dist +run.build +run.dist
\ No newline at end of file diff --git a/continuedev/src/continuedev/libs/llm/openai.py b/continuedev/src/continuedev/libs/llm/openai.py index fce6e8ab..9591e824 100644 --- a/continuedev/src/continuedev/libs/llm/openai.py +++ b/continuedev/src/continuedev/libs/llm/openai.py @@ -28,12 +28,6 @@ MAX_TOKENS_FOR_MODEL = {  } -class AzureInfo(BaseModel): -    endpoint: str -    engine: str -    api_version: str - -  class OpenAI(LLM):      model: str      openai_server_info: Optional[OpenAIServerInfo] = None @@ -42,7 +36,6 @@ class OpenAI(LLM):      requires_write_log = True      system_message: Optional[str] = None -    azure_info: Optional[AzureInfo] = None      write_log: Optional[Callable[[str], None]] = None      api_key: str = None diff --git a/continuedev/src/continuedev/libs/util/paths.py b/continuedev/src/continuedev/libs/util/paths.py index b08b0949..a033d6dd 100644 --- a/continuedev/src/continuedev/libs/util/paths.py +++ b/continuedev/src/continuedev/libs/util/paths.py @@ -1,8 +1,20 @@  import os - +import sys  from ..constants.main import CONTINUE_SESSIONS_FOLDER, CONTINUE_GLOBAL_FOLDER, CONTINUE_SERVER_FOLDER +def find_data_file(filename): +    if getattr(sys, 'frozen', False): +        # The application is frozen +        datadir = os.path.dirname(sys.executable) +    else: +        # The application is not frozen +        # Change this bit to match where you store your data files: +        datadir = os.path.dirname(__file__) + +    return os.path.join(datadir, filename) + +  def getGlobalFolderPath():      path = os.path.join(os.path.expanduser("~"), CONTINUE_GLOBAL_FOLDER)      os.makedirs(path, exist_ok=True) @@ -28,10 +40,9 @@ def getSessionFilePath(session_id: str):  def getDefaultConfigFile() -> str: -    current_path = os.path.dirname(os.path.realpath(__file__)) -    config_path = os.path.join( -        current_path, "..", "constants", "default_config.py.txt") -    with open(config_path, 'r') as f: +    default_config_path = find_data_file(os.path.join( +        "..", "constants", "default_config.py.txt")) +    with open(default_config_path, 'r') as f:          return f.read() diff --git a/continuedev/src/continuedev/plugins/recipes/AddTransformRecipe/steps.py b/continuedev/src/continuedev/plugins/recipes/AddTransformRecipe/steps.py index 8c6446da..e589fc36 100644 --- a/continuedev/src/continuedev/plugins/recipes/AddTransformRecipe/steps.py +++ b/continuedev/src/continuedev/plugins/recipes/AddTransformRecipe/steps.py @@ -1,7 +1,9 @@  import os  from textwrap import dedent +  from ....plugins.steps.core.core import MessageStep +from ....libs.util.paths import find_data_file  from ....core.sdk import Models  from ....core.main import Step  from ....core.sdk import ContinueSDK @@ -54,7 +56,7 @@ class AddTransformStep(Step):                  - Load the data into a local DuckDB instance                  - Open up a Streamlit app for you to view the data"""), name="Write transformation function")) -        with open(os.path.join(os.path.dirname(__file__), 'dlt_transform_docs.md')) as f: +        with open(find_data_file('dlt_transform_docs.md')) as f:              dlt_transform_docs = f.read()          prompt = dedent(f"""\ diff --git a/continuedev/src/continuedev/plugins/recipes/DDtoBQRecipe/steps.py b/continuedev/src/continuedev/plugins/recipes/DDtoBQRecipe/steps.py index 767936b8..14972142 100644 --- a/continuedev/src/continuedev/plugins/recipes/DDtoBQRecipe/steps.py +++ b/continuedev/src/continuedev/plugins/recipes/DDtoBQRecipe/steps.py @@ -6,6 +6,7 @@ from ....plugins.steps.core.core import MessageStep  from ....core.sdk import Models  from ....core.main import Step  from ....core.sdk import ContinueSDK +from ....libs.util.paths import find_data_file  AI_ASSISTED_STRING = "(✨ AI-Assisted ✨)" @@ -72,7 +73,7 @@ class LoadDataStep(Step):          output = await sdk.run('.env/bin/python3 chess_pipeline.py', name="Load data to BigQuery", description="Running `.env/bin/python3 chess_pipeline.py` to load data to Google BigQuery")          if "Traceback" in output or "SyntaxError" in output: -            with open(os.path.join(os.path.dirname(__file__), "dlt_duckdb_to_bigquery_docs.md"), "r") as f: +            with open(find_data_file("dlt_duckdb_to_bigquery_docs.md"), "r") as f:                  docs = f.read()              output = "Traceback" + output.split("Traceback")[-1] diff --git a/continuedev/src/continuedev/plugins/steps/draft/migration.py b/continuedev/src/continuedev/plugins/steps/draft/migration.py deleted file mode 100644 index c38f54dc..00000000 --- a/continuedev/src/continuedev/plugins/steps/draft/migration.py +++ /dev/null @@ -1,30 +0,0 @@ -# When an edit is made to an existing class or a new sqlalchemy class is created, -# this should be kicked off. - -from ....core.main import Step - - -class MigrationStep(Step): -    name: str = "Create and run an alembic migration." - -    edited_file: str - -    async def run(self, sdk): -        recent_edits = await sdk.ide.get_recent_edits(self.edited_file) -        recent_edits_string = "\n\n".join( -            map(lambda x: x.to_string(), recent_edits)) -        description = await sdk.models.medium.complete(f"{recent_edits_string}\n\nGenerate a short description of the migration made in the above changes:\n") -        await sdk.run([ -            "cd libs", -            "poetry run alembic revision --autogenerate -m " + description, -        ]) -        migration_file = f"libs/alembic/versions/{?}.py" -        contents = await sdk.ide.readFile(migration_file) -        await sdk.run_step(EditCodeStep( -            range_in_files=[RangeInFile.from_entire_file(migration_file, contents)], -            prompt=f"Here are the changes made to the sqlalchemy classes:\n\n{recent_edits_string}\n\nThis is the generated migration file:\n\n{{code}}\n\nReview the migration file to make sure it correctly reflects the changes made to the sqlalchemy classes.", -        )) -        await sdk.run([ -            "cd libs", -            "poetry run alembic upgrade head", -        ]) diff --git a/continuedev/src/run.py b/continuedev/src/run.py new file mode 100644 index 00000000..089cc54d --- /dev/null +++ b/continuedev/src/run.py @@ -0,0 +1,4 @@ +from continuedev.server.main import run_server + +if __name__ == "__main__": +    run_server()  | 
