wip: refactoring tui

This commit is contained in:
adamdottv
2025-05-30 15:34:22 -05:00
parent f5e2c596d4
commit c69c9327da
13 changed files with 244 additions and 263 deletions

View File

@@ -280,8 +280,8 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Provider.Info"
}
}
@@ -818,24 +818,35 @@
"Provider.Info": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"options": {
"type": "object",
"additionalProperties": {}
},
"models": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Provider.Model"
}
}
},
"required": [
"id",
"name",
"models"
]
},
"Provider.Model": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
@@ -876,6 +887,7 @@
}
},
"required": [
"id",
"cost",
"contextWindow",
"attachment"

View File

@@ -173,8 +173,10 @@ type MessageToolInvocationToolResult struct {
// ProviderInfo defines model for Provider.Info.
type ProviderInfo struct {
Models map[string]ProviderModel `json:"models"`
Options *map[string]interface{} `json:"options,omitempty"`
Id string `json:"id"`
Models []ProviderModel `json:"models"`
Name string `json:"name"`
Options *map[string]interface{} `json:"options,omitempty"`
}
// ProviderModel defines model for Provider.Model.
@@ -187,6 +189,7 @@ type ProviderModel struct {
Output float32 `json:"output"`
OutputCached float32 `json:"outputCached"`
} `json:"cost"`
Id string `json:"id"`
MaxOutputTokens *float32 `json:"maxOutputTokens,omitempty"`
Name *string `json:"name,omitempty"`
Reasoning *bool `json:"reasoning,omitempty"`
@@ -1421,7 +1424,7 @@ func (r GetEventResponse) StatusCode() int {
type PostProviderListResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]ProviderInfo
JSON200 *[]ProviderInfo
}
// Status returns HTTPResponse.Status
@@ -1756,7 +1759,7 @@ func ParsePostProviderListResponse(rsp *http.Response) (*PostProviderListRespons
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]ProviderInfo
var dest []ProviderInfo
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}