WebashalarForML commited on
Commit
eaf6118
·
verified ·
1 Parent(s): 299b861

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -42,6 +42,7 @@ os.makedirs(VECTOR_DB_FOLDER, exist_ok=True)
42
 
43
  # Global variables
44
  CHROMA_PATH = None
 
45
  #TABLE_PATH = None
46
 
47
  #System prompt
@@ -95,14 +96,12 @@ def chat():
95
  global CHROMA_PATH
96
  #global TABLE_PATH
97
 
98
- old_db = session.get('old_db', None)
99
- print(f"Selected DB: {CHROMA_PATH}")
100
 
101
- # if old_db != None:
102
- # if CHROMA_PATH != old_db:
103
- # session['history'] = []
104
-
105
- #print("sessionhist1",session['history'])
106
 
107
  if request.method == 'POST':
108
  query_text = request.form['query_text']
@@ -159,9 +158,9 @@ def chat():
159
  session.modified = True
160
  print("sessionhist2",session['history'])
161
 
162
- return render_template('chat.html', query_text=query_text, answer=data, history=session['history'],old_db=CHROMA_PATH)
163
 
164
- return render_template('chat.html', history=session['history'], old_db=CHROMA_PATH)
165
 
166
  @app.route('/create-db', methods=['GET', 'POST'])
167
  def create_db():
 
42
 
43
  # Global variables
44
  CHROMA_PATH = None
45
+ TEMP_PATH = None
46
  #TABLE_PATH = None
47
 
48
  #System prompt
 
96
  global CHROMA_PATH
97
  #global TABLE_PATH
98
 
99
+ #old_db = session.get('old_db', None)
100
+ #print(f"Selected DB: {CHROMA_PATH}")
101
 
102
+ if TEMP_PATH != None and TEMP_PATH != CHROMA_PATH:
103
+ session['history'] = []
104
+ else: TEMP_PATH=CHROMA_PATH
 
 
105
 
106
  if request.method == 'POST':
107
  query_text = request.form['query_text']
 
158
  session.modified = True
159
  print("sessionhist2",session['history'])
160
 
161
+ return render_template('chat.html', query_text=query_text, answer=data, history=session['history'])
162
 
163
+ return render_template('chat.html', history=session['history'])
164
 
165
  @app.route('/create-db', methods=['GET', 'POST'])
166
  def create_db():