mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-20 15:34:23 +01:00
linting
This commit is contained in:
@@ -135,7 +135,9 @@ def execute_command(
|
|||||||
return f"Error: {str(e)}"
|
return f"Error: {str(e)}"
|
||||||
|
|
||||||
|
|
||||||
@command("get_text_summary", "Get text summary", '"url": "<url>", "question": "<question>"')
|
@command(
|
||||||
|
"get_text_summary", "Get text summary", '"url": "<url>", "question": "<question>"'
|
||||||
|
)
|
||||||
def get_text_summary(url: str, question: str) -> str:
|
def get_text_summary(url: str, question: str) -> str:
|
||||||
"""Return the results of a Google search
|
"""Return the results of a Google search
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class Command:
|
|||||||
name: str,
|
name: str,
|
||||||
description: str,
|
description: str,
|
||||||
method: Callable[..., Any],
|
method: Callable[..., Any],
|
||||||
signature: str = '',
|
signature: str = "",
|
||||||
enabled: bool = True,
|
enabled: bool = True,
|
||||||
disabled_reason: Optional[str] = None,
|
disabled_reason: Optional[str] = None,
|
||||||
):
|
):
|
||||||
@@ -126,7 +126,7 @@ class CommandRegistry:
|
|||||||
def command(
|
def command(
|
||||||
name: str,
|
name: str,
|
||||||
description: str,
|
description: str,
|
||||||
signature: str = '',
|
signature: str = "",
|
||||||
enabled: bool = True,
|
enabled: bool = True,
|
||||||
disabled_reason: Optional[str] = None,
|
disabled_reason: Optional[str] = None,
|
||||||
) -> Callable[..., Any]:
|
) -> Callable[..., Any]:
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import requests
|
|||||||
from colorama import Back, Fore
|
from colorama import Back, Fore
|
||||||
from requests.adapters import HTTPAdapter, Retry
|
from requests.adapters import HTTPAdapter, Retry
|
||||||
|
|
||||||
from autogpt.config import Config
|
|
||||||
from autogpt.commands.command import command
|
from autogpt.commands.command import command
|
||||||
|
from autogpt.config import Config
|
||||||
from autogpt.spinner import Spinner
|
from autogpt.spinner import Spinner
|
||||||
from autogpt.utils import readable_file_size
|
from autogpt.utils import readable_file_size
|
||||||
from autogpt.workspace import WORKSPACE_PATH, path_in_workspace
|
from autogpt.workspace import WORKSPACE_PATH, path_in_workspace
|
||||||
@@ -163,7 +163,9 @@ def write_to_file(filename: str, text: str) -> str:
|
|||||||
return f"Error: {str(e)}"
|
return f"Error: {str(e)}"
|
||||||
|
|
||||||
|
|
||||||
@command("append_to_file", "Append to file", '"filename": "<filename>", "text": "<text>"')
|
@command(
|
||||||
|
"append_to_file", "Append to file", '"filename": "<filename>", "text": "<text>"'
|
||||||
|
)
|
||||||
def append_to_file(filename: str, text: str, shouldLog: bool = True) -> str:
|
def append_to_file(filename: str, text: str, shouldLog: bool = True) -> str:
|
||||||
"""Append text to a file
|
"""Append text to a file
|
||||||
|
|
||||||
@@ -235,8 +237,13 @@ def search_files(directory: str) -> list[str]:
|
|||||||
return found_files
|
return found_files
|
||||||
|
|
||||||
|
|
||||||
|
@command(
|
||||||
@command("download_file", "Search Files", '"url": "<url>", "filename": "<filename>"', CFG.allow_downloads, "Error: You do not have user authorization to download files locally.")
|
"download_file",
|
||||||
|
"Search Files",
|
||||||
|
'"url": "<url>", "filename": "<filename>"',
|
||||||
|
CFG.allow_downloads,
|
||||||
|
"Error: You do not have user authorization to download files locally.",
|
||||||
|
)
|
||||||
def download_file(url, filename):
|
def download_file(url, filename):
|
||||||
"""Downloads a file
|
"""Downloads a file
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class AIConfig:
|
|||||||
self.prompt_generator = None
|
self.prompt_generator = None
|
||||||
self.command_registry = None
|
self.command_registry = None
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(config_file: str = SAVE_FILE) -> "AIConfig":
|
def load(config_file: str = SAVE_FILE) -> "AIConfig":
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ def build_default_prompt_generator() -> PromptGenerator:
|
|||||||
"Every command has a cost, so be smart and efficient. Aim to complete tasks in"
|
"Every command has a cost, so be smart and efficient. Aim to complete tasks in"
|
||||||
" the least number of steps."
|
" the least number of steps."
|
||||||
)
|
)
|
||||||
prompt_generator.add_performance_evaluation(
|
prompt_generator.add_performance_evaluation("Write all code to a file.")
|
||||||
"Write all code to a file."
|
|
||||||
)
|
|
||||||
return prompt_generator
|
return prompt_generator
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user