59 lines
1.3 KiB
Python
59 lines
1.3 KiB
Python
from chromadb import HttpClient
|
|
from quart import Quart, jsonify, request
|
|
from tortoise.contrib.quart import register_tortoise
|
|
|
|
app = Quart(__name__)
|
|
|
|
TORTOISE_CONFIG = {
|
|
"connections": {
|
|
"default": f"postgresql://postgres:password@localhost?statusColor=&env=local&name=simbarag&tLSMode=0&usePrivateKey=false&safeModeLevel=0&advancedSafeModeLevel=0&driverVersion=0&showSystemSchemas=0&driverVersion=0&lazyload=False"
|
|
},
|
|
"apps": {
|
|
"models": {
|
|
"models": [
|
|
"blueprints.conversation.models",
|
|
"blueprints.users.models",
|
|
"aerich.models",
|
|
]
|
|
},
|
|
},
|
|
}
|
|
|
|
chroma_client = HttpClient(host="localhost", port=8333)
|
|
chroma_client.heartbeat()
|
|
|
|
register_tortoise(
|
|
app,
|
|
config=TORTOISE_CONFIG,
|
|
generate_schemas=False, # Disabled - using Aerich for migrations
|
|
)
|
|
|
|
|
|
@app.route("/api/query")
|
|
async def query():
|
|
data = await request.get_json()
|
|
return jsonify("asdf")
|
|
|
|
|
|
@app.route("/api/index")
|
|
async def index():
|
|
"""
|
|
This function adds the corpus of text attached to the ChromaDB library
|
|
"""
|
|
|
|
return ""
|
|
|
|
|
|
@app.route("/api/index/paperless/all")
|
|
async def reindex_all_documents():
|
|
return ""
|
|
|
|
|
|
@app.route("/api/index/paperless/single", methods=["POST"])
|
|
async def index_single_document():
|
|
return ""
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|