Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940package daemon
import ( "context" "encoding/json" "fmt" "net/url")
// Model is one entry of a provider's model listing. Only the id is certain;// the catalog may know the rest, and older daemons answer ids alone.type Model struct { ID string `json:"id"` // Efforts are the reasoning levels a session accepts, lowest first. Efforts []string `json:"efforts,omitempty"` Context int `json:"context,omitempty"` // MaxContext is the window a raised cap gives, when the provider offers // more than Context; Raised says the user raised it. MaxContext int `json:"maxContext,omitempty"` Raised bool `json:"raised,omitempty"` Output int `json:"output,omitempty"` Input []string `json:"input,omitempty"`}
func (m *Model) UnmarshalJSON(data []byte) error { var id string if json.Unmarshal(data, &id) == nil { *m = Model{ID: id} return nil } type fields Model return json.Unmarshal(data, (*fields)(m))}
// ListModels reads the models a provider extension lists for endpoint.func ListModels(ctx context.Context, conn *Connection, extension, endpoint string) ([]Model, error) { path := fmt.Sprintf("/models/%s?endpoint=%s&details=1", url.PathEscape(extension), url.QueryEscape(endpoint)) return Request[[]Model](ctx, conn, path, nil)}