okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

nekomimi.petfeat(paperclips): let the model resolve a vent it fixed, with a notee2ba50e

main
1.1 KiB40 linesraw
1from __future__ import annotations
2
3from typing import cast
4
5from albedo_api import Host, PythonApi
6
7host: Host
8
9
10async def vent(topic: str, message: str, suggestion: str = "", title: str = "") -> dict:
11    """Record one complaint for the user to review in /paperclips."""
12    return cast(
13        dict,
14        await host(
15            "paperclips.vent",
16            {
17                "topic": topic,
18                "message": message,
19                "suggestion": suggestion,
20                "title": title,
21            },
22        ),
23    )
24
25
26async def vents(limit: int = 20) -> list[dict]:
27    """Recent vents from every session, newest first."""
28    return cast(list[dict], await host("paperclips.list", {"limit": limit}))
29
30
31async def resolve_vent(id: int, note: str) -> dict:
32    """Close an open or acknowledged vent your change fixed; `note` says what
33    fixed it, and the user sees it on the vent."""
34    return cast(dict, await host("paperclips.resolve", {"id": id, "note": note}))
35
36
37def setup(api: PythonApi) -> dict[str, object]:
38    global host
39    host = api.host
40    return {"vent": vent, "vents": vents, "resolve_vent": resolve_vent}