INNER CODE UNIT · Python

add_config

grumpyp/aixplora · backend/main.py:91

def add_config(config: Config):
    db = Database().get_session()
    res = db.execute(text(
        "INSERT INTO config (openai_api_key, model, embeddings_model, posthog_id) VALUES (:api_key, :model, :embeddingsmodel, :posthog_id)"),
                     {"api_key": config.apiKey, "model": config.model, "embeddingsmodel": config.embeddingsModel,
                      "posthog_id": str(uuid.uuid4())})
    db.commit()
    return config


@app.get("/files/")
def get_files(request: Request):
    apikey = request.headers.get("apikey", False)
    email = request.headers.get("email", False)
    if apikey and email:
        # TODO: Check with Cloud API URL
        headers = {"apikey": apikey, "email": email}
        files = requests.get("https://api.aixplora.app/api/files/", headers=headers)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…