okami.mom/albedo

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

Aly Raffaufrefactor(config): share model and effort changesf0fd5bd

main
592 B16 linesraw
1%% Invoke the real registered command state seam without booting a kernel.
2-module(albedo_session_configure_probe).
3-export([model/4, effort/2]).
4
5model(Id, Model, Provider, Effort) ->
6    answer(albedo_commands:call(Id, {model_select, Model, optional(Provider), optional(Effort)})).
7
8effort(Id, Level) -> answer(albedo_commands:call(Id, {effort_select, Level})).
9
10optional(null) -> none;
11optional(Value) -> {some, Value}.
12
13answer({ok, Value}) ->
14    Json = 'gleam@json':to_string(Value),
15    json:encode(#{ok => json:decode(Json)});
16answer({error, Error}) -> json:encode(#{error => Error}).