Skip to content

Commit

Permalink
refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
jbabcanec committed May 10, 2024
1 parent 28a5f57 commit 0588ae0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 40 deletions.
37 changes: 0 additions & 37 deletions data/repo_metadata/chat_history.txt
Original file line number Diff line number Diff line change
@@ -1,37 +0,0 @@
1. You: give me the first code block in the main script|1. Bot: #main.py

import csv
import sys
from PyQt5.QtWidgets import QApplication, QMessageBox

from init_questions import InitQuestions
from gps_panel import GPSPanel
from final_checklist import FinalChecklist
from send_to_ai import GPTTurboProcessor

class MainController:
def __init__(self, app):
self.app = app

# Read the API key from credentials.txt
with open('credentials.txt', 'r') as file:
api_key = file.read().strip()

self.gpt_processor = GPTTurboProcessor(api_key) # API key is read from credentials.txt

# Initialize userInputs before creating other instances
self.userInputs = {}

self.init_questions = InitQuestions(self)
self.gps_panel = GPSPanel(self)
self.final_checklist = FinalChecklist(self) # Create an instance of FinalChecklist

# Connect signals to handlers
self.init_questions.nextClicked.connect(self.collectDataAndShowGPSPanel)
self.gps_panel.nextClicked.connect(self.collectDataAndShowFinalChecklist)
self.final_checklist.nextClicked.connect(self.finishOrNextPanel) # Assuming you have another panel or a finish method

# Variables to store user inputs
self.userInputs = {}
2. You: how much does the sun weigh|2. Bot: The first code block in the main script is the import of necessary libraries and the initialization of the MainController class. This includes importing PyQt5, init_questions.py, gps_panel.py, final_checklist.py, and send_to_ai.py.
3. You: what does this repo generally do|3. Bot: This repository contains code for an itinerary builder called DayMaker, which uses the GPT-4 API to generate a detailed hour-by-hour itinerary. It collects user input, processes it with external libraries, and displays the generated itinerary to the user.
25 changes: 22 additions & 3 deletions ui/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,29 @@ def show_map(self):
print("Show map clicked")
self.queryButton.setEnabled(True) # Enable query button after showing map

def check_for_default_repository(self):
"""Automatically set the repository folder to the first available one."""
data_directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../data")
repos = [d for d in os.listdir(data_directory) if os.path.isdir(os.path.join(data_directory, d)) and '_repo' in d]
if repos:
self.current_repository_folder = os.path.join(data_directory, repos[0])
print(f"Automatically selected repository directory: {self.current_repository_folder}")
self.analyzeButton.setEnabled(True)
self.mapButton.setEnabled(True)
else:
print("No default repository folder found.")
self.current_repository_folder = None

def query_repository(self):
# Pass the current_repository_folder to the QueryDialog
self.queryDialog = QueryDialog(self, self.current_repository_folder)
self.queryDialog.show()
# Ensure there's a repository folder before querying
if not self.current_repository_folder:
self.check_for_default_repository() # Check again in case it wasn't set during initialization

if self.current_repository_folder:
self.queryDialog = QueryDialog(self, self.current_repository_folder)
self.queryDialog.show()
else:
QtWidgets.QMessageBox.warning(self, "No Repository", "Please upload or clone a repository first.")

if __name__ == "__main__":
import sys
Expand Down
Binary file modified ui/__pycache__/MainWindow.cpython-311.pyc
Binary file not shown.

0 comments on commit 0588ae0

Please sign in to comment.