Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
improved welcome screen, with version reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
yanniedog committed Feb 1, 2024
1 parent 68a3256 commit d605b4a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ crewai-autocrew-202*.*
*.log
*.ini
.vscode/settings.json
test.py
test.py

config.ini
12 changes: 8 additions & 4 deletions autocrew.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# filename: autocrew.py
#####################################################################################################################
AUTOCREW_VERSION = "3.0.0"
AUTOCREW_VERSION = "3.0.1"

# Please do not edit this file directly
# Please modify the config file, "config.ini"
Expand Down Expand Up @@ -235,6 +235,8 @@ def update_config_file_with_params(config_dict, write_to_file=False):
with open('config.ini', 'w') as configfile:
config.write(configfile)
logging.info("Updated the config.ini file with new settings.")



def pull_ollama_model(model_name):
"""Pull the specified Ollama model using the ollama pull command."""
Expand Down Expand Up @@ -313,14 +315,16 @@ def handle_ranking(args, autocrew, truncated_overall_goal, csv_file_paths):
sys.exit(1)

def generate_startup_message(latest_version, version_message):
startup_message = (f"\nAutoCrew version: {AUTOCREW_VERSION}\n" +
f"{version_message}\n\n" +
startup_message = ("\nWelcome to AutoCrew!\n" +
"Use the -? or -h command line options to display help information.\n" +
"Settings can be modified within \"config.ini\". Scripts are saved in the \"scripts\" subdirectory.\n" +
"If you experience any errors, please create an issue on Github and attach \"autocrew.log\":\n" +
"https://github.com/yanniedog/autocrew/issues/new\n")
"https://github.com/yanniedog/autocrew/issues/new\n" +
f"\nAutoCrew version: {AUTOCREW_VERSION}\n" +
f"{version_message}\n")
return startup_message


def parse_arguments():
parser = argparse.ArgumentParser(
description=(
Expand Down
23 changes: 17 additions & 6 deletions welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import csv
import sys
import textwrap
from autocrew import check_latest_version, generate_startup_message

from logging_config import flush_log_handlers
from logging_config import setup_logging
from core import AutoCrew
Expand Down Expand Up @@ -106,11 +108,12 @@ def run_autocrew_script(num_alternative_crews, overall_goal, rank_crews):
# Start the subprocess and get the output in real-time
with subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as process:
print_ranking_csv_needed = False
for line in process.stdout:
print(line, end='')
logging.debug(line.strip()) # Log to file
if "See here for details:" in line:
print_ranking_csv_needed = True
if process.stdout is not None:
for line in process.stdout:
print(line, end='')
logging.debug(line.strip()) # Log to file
if "See here for details:" in line:
print_ranking_csv_needed = True

# Check the return code to determine if the subprocess was successful
if process.returncode != 0:
Expand Down Expand Up @@ -330,7 +333,15 @@ def main():
setup_logging()
config = configparser.ConfigParser()
config.read('config.ini')
log_initial_config(config) # Log the initial config settings
log_initial_config(config)

# Check for the latest version and generate startup message
latest_version, version_message = check_latest_version()
startup_message = generate_startup_message(latest_version, version_message)
logging.info(startup_message)

# Rest of your existing code...


overall_goal = get_input("Please specify your overall goal: ")

Expand Down

0 comments on commit d605b4a

Please sign in to comment.