mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-14 01:02:32 +00:00
refactor(api): standardize DTOs and update swagger
Decouple API contract from internal models by introducing dedicated DTOs for requests and responses. - Add Response DTOs for all resources (API Keys, Bindings, Models, Namespaces, etc.) - Update Swagger annotations to use DTOs with field examples instead of internal models - Refactor handlers to bind and return DTO structures - Consolidate request/response definitions in the dto package
This commit is contained in:
@@ -1,14 +1,34 @@
|
||||
package dto
|
||||
|
||||
// ModelDTO is used for create/update of model capabilities.
|
||||
type ModelDTO struct {
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
ContextWindow int `json:"context_window"`
|
||||
CostPerToken float64 `json:"cost_per_token"`
|
||||
SupportsVision bool `json:"supports_vision"`
|
||||
SupportsFunctions bool `json:"supports_functions"`
|
||||
SupportsToolChoice bool `json:"supports_tool_choice"`
|
||||
SupportsFIM bool `json:"supports_fim"`
|
||||
MaxOutputTokens int `json:"max_output_tokens"`
|
||||
import "time"
|
||||
|
||||
// ModelResponse represents a model in API responses.
|
||||
// @Description Model response
|
||||
type ModelResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Name string `json:"name" example:"gpt-4"`
|
||||
Kind string `json:"kind" example:"chat"`
|
||||
ContextWindow int `json:"context_window" example:"128000"`
|
||||
CostPerToken float64 `json:"cost_per_token" example:"0.00003"`
|
||||
SupportsVision bool `json:"supports_vision" example:"true"`
|
||||
SupportsFunctions bool `json:"supports_functions" example:"true"`
|
||||
SupportsToolChoice bool `json:"supports_tool_choice" example:"true"`
|
||||
SupportsFIM bool `json:"supports_fim" example:"false"`
|
||||
MaxOutputTokens int `json:"max_output_tokens" example:"4096"`
|
||||
}
|
||||
|
||||
// ModelDTO is used for create/update of model capabilities.
|
||||
// @Description Model create/update request
|
||||
type ModelDTO struct {
|
||||
Name string `json:"name" example:"gpt-4"`
|
||||
Kind string `json:"kind" example:"chat"`
|
||||
ContextWindow int `json:"context_window" example:"128000"`
|
||||
CostPerToken float64 `json:"cost_per_token" example:"0.00003"`
|
||||
SupportsVision bool `json:"supports_vision" example:"true"`
|
||||
SupportsFunctions bool `json:"supports_functions" example:"true"`
|
||||
SupportsToolChoice bool `json:"supports_tool_choice" example:"true"`
|
||||
SupportsFIM bool `json:"supports_fim" example:"false"`
|
||||
MaxOutputTokens int `json:"max_output_tokens" example:"4096"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user