NavyDevilDoc commited on
Commit
7f02724
·
verified ·
1 Parent(s): de87550

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +10 -8
src/app.py CHANGED
@@ -336,25 +336,27 @@ with tab2:
336
  with col_a:
337
  chunk_strategy = st.selectbox(
338
  "Chunking Strategy",
339
- ["paragraph", "token", "page"],
340
- help="Paragraph: Standard. Token: Dense text. Page: Forms.",
341
  key="chunk_selector"
342
  )
343
 
344
  if st.button("📥 Add to Knowledge Base", type="primary"):
345
  with st.spinner("Ingesting..."):
346
- # Use Admin or User Key for Vision
347
- key = st.session_state.get("user_openai_key") or OPENAI_KEY
348
 
349
- ok, msg = rag_engine.process_and_add_document(
350
- temp_path, st.session_state.username, chunk_strategy, # Pass selected strategy
351
- use_vision=use_vision, api_key=key
 
352
  )
353
 
354
  if ok:
355
  tracker.upload_user_db(st.session_state.username) # Auto-Sync
356
  st.success(msg)
357
- else: st.error(msg)
 
358
 
359
  # 2. SUMMARIZE
360
  with col_b:
 
336
  with col_a:
337
  chunk_strategy = st.selectbox(
338
  "Chunking Strategy",
339
+ ["paragraph", "token"], # Removed 'page' as it is not implemented in new engine yet
340
+ help="Paragraph: Standard. Token: Dense text.",
341
  key="chunk_selector"
342
  )
343
 
344
  if st.button("📥 Add to Knowledge Base", type="primary"):
345
  with st.spinner("Ingesting..."):
346
+ # Note: New engine uses internal Tesseract OCR, not GPT-4o Vision
347
+ # so we don't pass vision flags or keys here anymore.
348
 
349
+ ok, msg = rag_engine.ingest_file(
350
+ file_path=temp_path,
351
+ username=st.session_state.username,
352
+ strategy=chunk_strategy
353
  )
354
 
355
  if ok:
356
  tracker.upload_user_db(st.session_state.username) # Auto-Sync
357
  st.success(msg)
358
+ else:
359
+ st.error(msg))
360
 
361
  # 2. SUMMARIZE
362
  with col_b: