Documentation
¶
Index ¶
- Constants
- func ExtractResultURLs(body []byte) ([]string, error)
- type ChatMessage
- type Client
- func (c *Client) Chat(ctx context.Context, modelID string, apiFormat string, messages []ChatMessage, ...) (string, error)
- func (c *Client) Download(ctx context.Context, url, path string) error
- func (c *Client) GetTask(ctx context.Context, taskID string) ([]byte, error)
- func (c *Client) ListModels(ctx context.Context) ([]GatewayModel, error)
- func (c *Client) MediaEndpoint(path string) string
- func (c *Client) PollTask(ctx context.Context, taskID string, interval, maxSeconds int) ([]byte, error)
- func (c *Client) SubmitTask(ctx context.Context, endpoint, modelID string, inputData map[string]any) (string, error)
- func (c *Client) UploadFile(ctx context.Context, name, localPath string) (string, error)
- type ErrorDetail
- type Feature
- type GatewayError
- type GatewayModel
- type ModelListResponse
Constants ¶
View Source
const ( GatewayBase = "https://console.echojoy.cn/gateway" FileService = "https://file.echojoy.cn" // MaxUploadBytes matches the guaranteed single-file capacity of the // pre-signed cloud-storage upload path. MaxUploadBytes int64 = 1024 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func ExtractResultURLs ¶
ExtractResultURLs returns media URLs from a Gateway task envelope. Gateway providers use slightly different result shapes, so URLs are collected from conventional URL-named fields recursively and de-duplicated in encounter order.
Types ¶
type ChatMessage ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewWithBaseURL ¶
NewWithBaseURL creates a client for an alternate Gateway endpoint. It keeps HTTP integration tests isolated and is also useful for self-hosted gateways.
func NewWithEndpoints ¶
NewWithEndpoints creates a client with explicit Gateway and file-service URLs. It exists for self-hosted deployments and HTTP integration tests.
func (*Client) ListModels ¶
func (c *Client) ListModels(ctx context.Context) ([]GatewayModel, error)
func (*Client) MediaEndpoint ¶
func (*Client) SubmitTask ¶
type ErrorDetail ¶
func ErrorDetails ¶
func ErrorDetails(err error) ErrorDetail
ErrorDetails exposes only safe, user-actionable upstream error fields.
type GatewayError ¶
type GatewayError struct {
Status int
ErrorDetail
}
func (*GatewayError) Error ¶
func (e *GatewayError) Error() string
type GatewayModel ¶
type GatewayModel struct {
ID string `json:"id"`
Object string `json:"object"`
ModelType string `json:"model_type"`
ModelID string `json:"model_id"`
DisplayName string `json:"display_name"`
APIFormat string `json:"api_format,omitempty"`
InputSchema json.RawMessage `json:"input_schema,omitempty"`
FeatureTypes map[string]Feature `json:"feature_types,omitempty"`
}
type ModelListResponse ¶
type ModelListResponse struct {
Object string `json:"object"`
Data []GatewayModel `json:"data"`
HasMore bool `json:"has_more"`
}
Click to show internal directories.
Click to hide internal directories.