type error fix

This commit is contained in:
Dax Raad
2025-05-29 11:58:40 -04:00
parent 48f81fe4d3
commit 80597cd3fd
28 changed files with 76 additions and 230 deletions

View File

@@ -238,7 +238,7 @@
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/provider"
"$ref": "#/components/schemas/Provider.Info"
}
}
}
@@ -740,7 +740,7 @@
"title"
]
},
"provider": {
"Provider.Info": {
"type": "object",
"properties": {
"options": {
@@ -750,7 +750,7 @@
"models": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/model"
"$ref": "#/components/schemas/Provider.Model"
}
}
},
@@ -758,7 +758,7 @@
"models"
]
},
"model": {
"Provider.Model": {
"type": "object",
"properties": {
"name": {

View File

@@ -170,8 +170,14 @@ type MessageToolInvocationToolResult struct {
ToolName string `json:"toolName"`
}
// Model defines model for model.
type Model struct {
// ProviderInfo defines model for Provider.Info.
type ProviderInfo struct {
Models map[string]ProviderModel `json:"models"`
Options *map[string]interface{} `json:"options,omitempty"`
}
// ProviderModel defines model for Provider.Model.
type ProviderModel struct {
Attachment bool `json:"attachment"`
ContextWindow float32 `json:"contextWindow"`
Cost struct {
@@ -185,12 +191,6 @@ type Model struct {
Reasoning *bool `json:"reasoning,omitempty"`
}
// Provider defines model for provider.
type Provider struct {
Models map[string]Model `json:"models"`
Options *map[string]interface{} `json:"options,omitempty"`
}
// SessionInfo defines model for session.info.
type SessionInfo struct {
Id string `json:"id"`
@@ -1329,7 +1329,7 @@ func (r GetEventResponse) StatusCode() int {
type PostProviderListResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]Provider
JSON200 *map[string]ProviderInfo
}
// Status returns HTTPResponse.Status
@@ -1625,7 +1625,7 @@ func ParsePostProviderListResponse(rsp *http.Response) (*PostProviderListRespons
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]Provider
var dest map[string]ProviderInfo
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}