Refactoring

This commit is contained in:
Mark Goltsman
2024-10-20 12:26:33 -04:00
parent 139ca3f235
commit f5ff74288f
5 changed files with 72 additions and 32 deletions

16
main.py
View File

@@ -2,9 +2,23 @@
from config import API_KEY
from openai import OpenAI
from fileFormatConverter import convert_file
import requests
def load_homeworks(urls):
for url in urls: # Send a GET request to the URL
with requests.get(url, stream=True) as response:
response.raise_for_status() # Raise an error for bad responses
# Open a local file with write-binary mode
with open(f'file_{urls.index(url)}', 'wb') as f:
# Write the content of the response to the file in chunks
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
return f
# Example usage
def main():
def create_subtasks_for_homework():
#inputFileName = input("enter input file name with extension (supported types: pdf, docx): ")
# outputFileName = input("enter output file name without extension:")

21
package-lock.json generated
View File

@@ -2330,12 +2330,6 @@
"dev": true,
"license": "ISC"
},
"node_modules/fontfaceobserver": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/fontfaceobserver/-/fontfaceobserver-2.3.0.tgz",
"integrity": "sha512-6FPvD/IVyT4ZlNe7Wcn5Fb/4ChigpucKYSvD6a+0iMoLn2inpo711eyIcKjmDtE5XNcgAkSH9uN/nfAeZzHEfg==",
"license": "BSD-2-Clause"
},
"node_modules/for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
@@ -2407,6 +2401,21 @@
}
}
},
"node_modules/form-data": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
"dev": true,
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",

View File

@@ -12,10 +12,11 @@
"framer": "^2.4.1",
"next": "14.2.15",
"react": "^18",
"react-circular-progressbar": "^2.1.0",
"react-dom": "^18"
"react-dom": "^18",
"next": "14.2.15"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
@@ -23,6 +24,7 @@
"eslint-config-next": "14.2.15",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
"eslint": "^8",
"eslint-config-next": "14.2.15"
}
}

View File

@@ -1,3 +1,4 @@
openai
pdfplumber
python-docx
requests

View File

@@ -1,4 +1,4 @@
"use client"
"use client";
import arrow from "../../img/arrow.png";
import gradient from "../../img/gradient.png";
@@ -7,25 +7,39 @@ import { useState } from "react";
import { Time } from "@/app/landing/time";
export default function Landing() {
const [clicked, setClicked] = useState(false);
const [clicked1, setClicked1] = useState(false);
return (
clicked ?
return clicked1 ? (
<Time />
:
<div onMouseDown={() => setClicked(true)} className="flex-grow flex flex-col">
) : (
<div
onMouseDown={() => setClicked1(true)}
className="flex-grow flex flex-col"
>
<div className="my-auto">
<div unselectable="on" className="select-none text-5xl text-center font-bold">
<div
unselectable="on"
className="select-none text-5xl text-center font-bold"
>
Swipe to start grinding
</div>
<Image draggable={false} unselectable={"on"} className="mx-auto mt-10" width={65} alt="arrow"
src={arrow} />
<Image
draggable={false}
unselectable={"on"}
className="mx-auto mt-10"
width={65}
alt="arrow"
src={arrow}
/>
</div>
<Image className="absolute bottom-0 z-[-999] w-full h-[200px] opacity-60 pointer-events-none"
alt="" draggable={false} unselectable={"on"}
<Image
className="absolute bottom-0 z-[-999] w-full h-[200px] opacity-60 pointer-events-none"
alt=""
draggable={false}
unselectable={"on"}
width={window.innerWidth}
src={gradient}
/>
</div>
)
);
}