File size: 1,234 Bytes
8a7ffa1
8c1a9c9
 
 
 
 
 
 
 
8a7ffa1
8c1a9c9
 
 
 
 
8a7ffa1
 
 
 
 
 
8c1a9c9
 
 
 
8a7ffa1
8c1a9c9
8a7ffa1
8c1a9c9
 
 
 
 
 
 
 
8a7ffa1
8c1a9c9
 
e4cd3fb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from flask import Flask, render_template, request, session, redirect, url_for
import os
from flask_session import Session

app = Flask(__name__)
app.secret_key = 'supersecretkey'
app.config['SESSION_TYPE'] = 'filesystem'
Session(app)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/chat', methods=['GET', 'POST'])
def chat():
    # Simulate chat history
    if 'chat_history' not in session:
        session['chat_history'] = []

    if 'project_tree' not in session:
        session['project_tree'] = ['main.py', 'requirements.txt', 'templates/index.html']

    ai_reply = ''
    if request.method == 'POST':
        user_message = request.form.get('user_message')
        ai_reply = "Simulated AI response to: " + user_message

        session['chat_history'].append({'user': user_message, 'ai': ai_reply})

    return render_template('chat.html',
                           chat_history=session.get('chat_history', []),
                           project_tree=session.get('project_tree', []),
                           ai_reply=ai_reply)

@app.route('/download_project')
def download_project():
    return "Simulated download"

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=7860)