SPB Git

Repository Public

ai.py 1.5 KB 40 lines python

1#!/usr/bin/env python32# SP Notes Core3# File: Scripts/recorders/ai.py4# Description: Records what the FOUNDATION scratch server answers on the AI routes: the 2.x model catalogue (no creator / route5#              fields there) and the absence of the AI-workstream routes (404). Nothing here calls a model.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9import os10import sys11import time12import urllib.parse1314sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))15from spn_recorder import Recorder, new_id  # noqa: E402161718def text(value):19    return {"type": "paragraph", "content": [{"type": "text", "text": value}]}202122def now():23    return time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()) + ".%03dZ" % int((time.time() % 1) * 1000)242526def q(value):27    return urllib.parse.quote(value, safe="")282930r = Recorder("ai")31page = r.call("POST", "/api/pages", {"id": new_id(), "title": "Fixture · ia", "section": "notes",32                                      "content": {"type": "doc", "content": [text("Une phrase pour le zoom.")]}}).json33r.call("GET", "/api/ai/models", save="models")34r.call("GET", "/api/pages/%s/zoom/ai?cachedOnly=1" % page["id"], save="zoom-ai-missing-route")35r.call("GET", "/api/audio/" + new_id(), save="audio-missing-route")36r.call("GET", "/api/databases/%s/ai/config" % new_id(), save="database-ai-config-missing-route")37r.call("GET", "/api/databases/%s/ai/runs" % new_id(), save="database-ai-runs-missing-route")38r.purge_pages([page["id"]])39r.finish()40
Files main
Menu

Theme