#!/usr/bin/env python3
"""
Oracle RAG Flask App - Lightweight web interface
Deploy to 192.168.0.147: gunicorn -w 4 app:app -b 0.0.0.0:8000
"""
from flask import Flask, request, jsonify, render_template_string
import os
app = Flask(__name__)
HTML = """
Oracle RAG Chat
🔮 Oracle RAG Chat
"""
@app.route('/')
def home():
return render_template_string(HTML)
@app.route('/api/ask', methods=['POST'])
def ask():
data = request.json
question = data.get('question', '').strip()
if not question:
return jsonify({'error': 'Please provide a question'})
# TODO: Connect to Oracle RAG
return jsonify({
'question': question,
'answer': f"""🤖 **Answer**
This is a placeholder response. Configure Oracle RAG to enable full functionality.
**Your question:** {question}
**Status:** Waiting for Oracle RAG setup
To enable:
1. Run ingestion pipeline (doc_ingest_jobs)
2. Create RAG procedures (rag_ask, rag_top_chunks)
3. Set environment variables for Oracle connection
"""
})
@app.route('/api/health')
def health():
return jsonify({'status': 'ok', 'service': 'oracle-rag-flask'})
if __name__ == '__main__':
port = int(os.environ.get('PORT', 8000))
app.run(host='0.0.0.0', port=port, debug=False)