Sure, I can help you with that. Here's a simple chat website using Python, HTML, and JavaScript that meets your requirements. Please note that this is just a starting point, and you'll need to modify the code to suit your specific needs.

Backend (Python):

First, you need to install some Python packages:

Flask (for creating the web server)
PyMongo (for connecting to MongoDB)
You can install these packages using pip:

Copy code
pip install Flask PyMongo
Then, create a new Python file called "app.py" with the following code:

python
Copy code
from flask import Flask, render_template, request, redirect, url_for, session
from pymongo import MongoClient

app = Flask(__name__)
app.secret_key = 'your_secret_key_here'

# MongoDB configuration
client = MongoClient('mongodb://localhost:27017/')
db = client['chatdb']

# Routes
@app.route('/')
def index():
    if 'username' not in session:
        return redirect(url_for('login'))
    return render_template('index.html')

@app.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        session['username'] = request.form['username']
        return redirect(url_for('index'))
    return render_template('login.html')

@app.route('/logout')
def logout():
    session.pop('username', None)
    return redirect(url_for('login'))

@app.route('/messages', methods=['GET', 'POST'])
def messages():
    if 'username' not in session:
        return redirect(url_for('login'))

    # Get target_username from the URL parameter
    target_username = request.args.get('target_username')

    # Get messages from the database
    messages = []
    if target_username:
        messages = db.messages.find({
            '$or': [
                {'src_username': session['username'], 'dst_username': target_username},
                {'src_username': target_username, 'dst_username': session['username']}
            ]
        }).sort('date_time')

    if request.method == 'POST':
        # Save message to the database
        message = {
            'src_username': session['username'],
            'dst_username': target_username,
            'date_time': datetime.datetime.now(),
            'message': request.form['message']
        }
        db.messages.insert_one(message)

    return render_template('messages.html', target_username=target_username, messages=messages)

if __name__ == '__main__':
    app.run(debug=True)
This code defines a Flask web server with three routes: "/", "/login", and "/messages". The "/" route redirects to the "/login" route if the user is not logged in, otherwise it renders the "index.html" template. The "/login" route handles the login form, sets the "username" session variable, and redirects to the "/" route. The "/logout" route removes the "username" session variable and redirects to the "/login" route. The "/messages" route handles the chat messages, retrieves the messages from the MongoDB database based on the "src_username" and "dst_username" fields, and saves new messages to the database.

Frontend (HTML and JavaScript):

Create a new folder called "templates" and two HTML files inside it: "login.html" and "index.html". Then, create a new folder called "static" and two JavaScript files inside it: "index.js" and "messages.js". Here's the code for each file:
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence