okami.mom/albedo

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

Aly Raffauffeat(api)!: migrate daemon and clients to protocol 361c43ca

main
939 B25 linesraw
1package tui
2
3import (
4	"albedo/cli/internal/testwire"
5	"encoding/json"
6	"net/http"
7)
8
9const generationA = testwire.GenerationA
10
11var protocolSession = testwire.Session
12
13func writeSessionChange(w http.ResponseWriter, id, model, provider string) {
14	session := protocolSession(id, generationA, 0)
15	session["model"] = model
16	session["provider_profile"] = provider
17	config := session["configuration_resource"].(map[string]any)
18	v := config["value"].(map[string]any)
19	v["model"] = model
20	v["provider_profile"] = provider
21	_ = json.NewEncoder(w).Encode(map[string]any{"resource": config, "session": session, "move": nil})
22}
23func protocolEntry(id, kind, text string, position int64) map[string]any {
24	return map[string]any{"id": id, "position": position, "kind": kind, "created_at": nil, "input_id": nil, "turn_id": nil, "content_complete": true, "content": []any{map[string]any{"kind": "text", "text": text}}, "tool": nil, "checkpoint_id": nil}
25}