This is my code

```
import os
from flask import Flask, request, jsonify, session, send_file
from flask_cors import CORS
from werkzeug.utils import secure_filename
from langchain_openai import ChatOpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
from langchain_core.runnables.base import RunnableSequence
from langchain_openai import OpenAI
from dotenv import load_dotenv
import docx
import io
import zipfile
from datetime import datetime

load_dotenv()

app = Flask(__name__)
CORS(app)

app.config['UPLOAD_FOLDER'] = './uploads'
app.secret_key = 'supersecretkey'

if not os.path.exists(app.config['UPLOAD_FOLDER']):
    os.makedirs(app.config['UPLOAD_FOLDER'])

OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')

if not OPENAI_API_KEY:
    raise ValueError("Please set the OPENAI_API_KEY environment variable.")

llm = ChatOpenAI(api_key=OPENAI_API_KEY, model_name="gpt-4o-mini")

prompt_template = PromptTemplate(    
    input_variables=["document", "instructions"],    
    template="""    
    Document: {document}    

    Instructions: {instructions}    

    Based on the document and instructions provided, generate the required content. And you are not allowed to have any special characters in the output.    
    """
)

llm_chain = RunnableSequence(
    prompt_template,
    llm
)

temp_storage = {}
def read_docx(file_path):
    doc = docx.Document(file_path)
    full_text = []
    for para in doc.paragraphs:
        full_text.append(para.text)
    return '\n'.join(full_text)

# Route 1: Upload up to five Word files
@app.route('/upload', methods=['POST'])
def upload_files():
    if 'files' not in request.files:
        return jsonify({"error": "No files part in the request"}), 400

    files = request.files.getlist('files')
    if len(files) > 5:
        return jsonify({"error": "You can only upload up to 5 files"}), 400

    filenames = []
    for file in files:
        if file.filename == '':
            return jsonify({"error": "No selected file"}), 400

        filename = secure_filename(file.filename)
        filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
        file.save(filepath)
        filenames.append(filename)
    # Store uploaded filenames in session
    session['uploaded_files'] = filenames

    return jsonify({"message": "Files uploaded successfully", "files": filenames}), 200

# Route 2: Review uploaded documents
@app.route('/review', methods=['POST'])
def review_documents():
    # Get the instructions and comparison flag from the request
    data = request.json
    filenames = data.get("files", session.get('uploaded_files'))
    instructions = data.get("instructions")
    compare = data.get("compare", False)

    if not instructions:
        return jsonify({"error": "Instructions are required"}), 400

    if not filenames:
        return jsonify({"error": "No uploaded files found"}), 400

    documents = []
    for filename in filenames:
        filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
        document_text = read_docx(filepath)  # Assuming `read_docx` reads the .docx file content
        documents.append(document_text)

    response = []

    # If comparison is enabled, combine documents
    if compare:
        combined_document = "\n\n---\n\n".join(documents)
        ai_response = llm_chain.invoke({"document": combined_document, "instructions": instructions})
        response = ai_response.content
    else:
        for doc in documents:
            ai_response = llm_chain.invoke({"document": doc, "instructions": instructions})
            response.append(ai_response.content)

    # Store the processed_content in session for download
    session['processed_content'] = response if isinstance(response, list) else [response]
    temp_storage['processed_content'] = response if isinstance(response, list) else [response]
    return jsonify({"processed_content": response}), 200

# Route 3: Download the processed content as a zipped Word file
@app.route('/download', methods=['GET'])
def download_file():
    processed_content = temp_storage.get('processed_content')
    
    if not processed_content:
        return jsonify({"error": "No processed content available for download"}), 400

    # Create a Word document in memory
    doc = docx.Document()
    for content in processed_content:
        doc.add_paragraph(content)
    
    doc_io = io.BytesIO()
    doc.save(doc_io)
    doc_io.seek(0)

    # Create a zip file in memory
    zip_io = io.BytesIO()
    with zipfile.ZipFile(zip_io, mode='w', compression=zipfile.ZIP_DEFLATED) as zip_file:
        # Naming the Word file with a timestamp to ensure uniqueness
        timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
        doc_filename = f"processed_content_{timestamp}.docx"
        zip_file.writestr(doc_filename, doc_io.read())
    zip_io.seek(0)

    return send_file(
        zip_io,
        mimetype='application/zip',
        as_attachment=True,
        download_name='processed_content.zip'
    )

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=5000, debug=True)
```

I want you to handle this code forany errors. for example: In the first API the user should be able to upload only one file and should of docx format.