This commit is contained in:
Dax Raad
2025-05-29 11:38:55 -04:00
parent a96c2ce65c
commit 48f81fe4d3
5 changed files with 118 additions and 154 deletions

View File

@@ -33,7 +33,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Session.Info"
"$ref": "#/components/schemas/session.info"
}
}
}
@@ -52,7 +52,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Session.Info"
"$ref": "#/components/schemas/session.info"
}
}
}
@@ -129,23 +129,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^ses"
},
"shareID": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"id",
"title"
]
"$ref": "#/components/schemas/session.info"
}
}
}
@@ -254,7 +238,7 @@
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Provider.Info"
"$ref": "#/components/schemas/provider"
}
}
}
@@ -724,23 +708,7 @@
"type": "object",
"properties": {
"info": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^ses"
},
"shareID": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"id",
"title"
]
"$ref": "#/components/schemas/session.info"
}
},
"required": [
@@ -753,7 +721,7 @@
"properties"
]
},
"Session.Info": {
"session.info": {
"type": "object",
"properties": {
"id": {
@@ -772,7 +740,7 @@
"title"
]
},
"Provider.Info": {
"provider": {
"type": "object",
"properties": {
"options": {
@@ -782,58 +750,61 @@
"models": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"cost": {
"type": "object",
"properties": {
"input": {
"type": "number"
},
"inputCached": {
"type": "number"
},
"output": {
"type": "number"
},
"outputCached": {
"type": "number"
}
},
"required": [
"input",
"inputCached",
"output",
"outputCached"
]
},
"contextWindow": {
"type": "number"
},
"maxTokens": {
"type": "number"
},
"attachment": {
"type": "boolean"
},
"reasoning": {
"type": "boolean"
}
},
"required": [
"cost",
"contextWindow",
"attachment"
]
"$ref": "#/components/schemas/model"
}
}
},
"required": [
"models"
]
},
"model": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"cost": {
"type": "object",
"properties": {
"input": {
"type": "number"
},
"inputCached": {
"type": "number"
},
"output": {
"type": "number"
},
"outputCached": {
"type": "number"
}
},
"required": [
"input",
"inputCached",
"output",
"outputCached"
]
},
"contextWindow": {
"type": "number"
},
"maxTokens": {
"type": "number"
},
"attachment": {
"type": "boolean"
},
"reasoning": {
"type": "boolean"
}
},
"required": [
"cost",
"contextWindow",
"attachment"
]
}
}
}

View File

@@ -49,11 +49,7 @@ type EventMessageUpdated struct {
// EventSessionUpdated defines model for Event.session.updated.
type EventSessionUpdated struct {
Properties struct {
Info struct {
Id string `json:"id"`
ShareID *string `json:"shareID,omitempty"`
Title string `json:"title"`
} `json:"info"`
Info SessionInfo `json:"info"`
} `json:"properties"`
Type string `json:"type"`
}
@@ -174,25 +170,28 @@ type MessageToolInvocationToolResult struct {
ToolName string `json:"toolName"`
}
// ProviderInfo defines model for Provider.Info.
type ProviderInfo struct {
Models map[string]struct {
Attachment bool `json:"attachment"`
ContextWindow float32 `json:"contextWindow"`
Cost struct {
Input float32 `json:"input"`
InputCached float32 `json:"inputCached"`
Output float32 `json:"output"`
OutputCached float32 `json:"outputCached"`
} `json:"cost"`
MaxTokens *float32 `json:"maxTokens,omitempty"`
Name *string `json:"name,omitempty"`
Reasoning *bool `json:"reasoning,omitempty"`
} `json:"models"`
// Model defines model for model.
type Model struct {
Attachment bool `json:"attachment"`
ContextWindow float32 `json:"contextWindow"`
Cost struct {
Input float32 `json:"input"`
InputCached float32 `json:"inputCached"`
Output float32 `json:"output"`
OutputCached float32 `json:"outputCached"`
} `json:"cost"`
MaxTokens *float32 `json:"maxTokens,omitempty"`
Name *string `json:"name,omitempty"`
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.
// SessionInfo defines model for session.info.
type SessionInfo struct {
Id string `json:"id"`
ShareID *string `json:"shareID,omitempty"`
@@ -1330,7 +1329,7 @@ func (r GetEventResponse) StatusCode() int {
type PostProviderListResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]ProviderInfo
JSON200 *map[string]Provider
}
// Status returns HTTPResponse.Status
@@ -1418,11 +1417,7 @@ func (r PostSessionCreateResponse) StatusCode() int {
type PostSessionListResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *[]struct {
Id string `json:"id"`
ShareID *string `json:"shareID,omitempty"`
Title string `json:"title"`
}
JSON200 *[]SessionInfo
}
// Status returns HTTPResponse.Status
@@ -1630,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]ProviderInfo
var dest map[string]Provider
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
@@ -1734,11 +1729,7 @@ func ParsePostSessionListResponse(rsp *http.Response) (*PostSessionListResponse,
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest []struct {
Id string `json:"id"`
ShareID *string `json:"shareID,omitempty"`
Title string `json:"title"`
}
var dest []SessionInfo
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}