You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
3.6 KiB
133 lines
3.6 KiB
syntax = "v1"
|
|
|
|
// ========== AI Chat Types ==========
|
|
|
|
type (
|
|
AIChatMessage {
|
|
Role string `json:"role"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
AIChatCompletionRequest {
|
|
Model string `json:"model"`
|
|
Messages []AIChatMessage `json:"messages"`
|
|
Stream bool `json:"stream,optional"`
|
|
MaxTokens int `json:"max_tokens,optional"`
|
|
Temperature float64 `json:"temperature,optional"`
|
|
ConversationId int64 `json:"conversation_id,optional,string"`
|
|
}
|
|
|
|
AIChatCompletionChoice {
|
|
Index int `json:"index"`
|
|
FinishReason string `json:"finish_reason"`
|
|
Message AIChatMessage `json:"message"`
|
|
}
|
|
|
|
AIChatCompletionUsage {
|
|
PromptTokens int `json:"prompt_tokens"`
|
|
CompletionTokens int `json:"completion_tokens"`
|
|
TotalTokens int `json:"total_tokens"`
|
|
}
|
|
|
|
AIChatCompletionResponse {
|
|
Id string `json:"id"`
|
|
Object string `json:"object"`
|
|
Model string `json:"model"`
|
|
Choices []AIChatCompletionChoice `json:"choices"`
|
|
Usage AIChatCompletionUsage `json:"usage"`
|
|
}
|
|
)
|
|
|
|
// ========== Conversation Types ==========
|
|
|
|
type (
|
|
AIConversationInfo {
|
|
Id int64 `json:"id,string"`
|
|
Title string `json:"title"`
|
|
ModelId string `json:"modelId"`
|
|
ProviderId int64 `json:"providerId,string"`
|
|
TotalTokens int64 `json:"totalTokens"`
|
|
TotalCost float64 `json:"totalCost"`
|
|
IsArchived bool `json:"isArchived"`
|
|
CreatedAt string `json:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt"`
|
|
}
|
|
|
|
AIMessageInfo {
|
|
Id int64 `json:"id,string"`
|
|
ConversationId int64 `json:"conversationId,string"`
|
|
Role string `json:"role"`
|
|
Content string `json:"content"`
|
|
TokenCount int `json:"tokenCount"`
|
|
Cost float64 `json:"cost"`
|
|
ModelId string `json:"modelId"`
|
|
LatencyMs int `json:"latencyMs"`
|
|
CreatedAt string `json:"createdAt"`
|
|
}
|
|
|
|
AIConversationListRequest {
|
|
Page int64 `form:"page,optional,default=1"`
|
|
PageSize int64 `form:"pageSize,optional,default=20"`
|
|
}
|
|
|
|
AIConversationListResponse {
|
|
List []AIConversationInfo `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
|
|
AIConversationCreateRequest {
|
|
Title string `json:"title,optional"`
|
|
ModelId string `json:"modelId,optional"`
|
|
}
|
|
|
|
AIConversationGetRequest {
|
|
Id int64 `path:"id"`
|
|
}
|
|
|
|
AIConversationDetailResponse {
|
|
Conversation AIConversationInfo `json:"conversation"`
|
|
Messages []AIMessageInfo `json:"messages"`
|
|
}
|
|
|
|
AIConversationUpdateRequest {
|
|
Id int64 `path:"id"`
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
AIConversationDeleteRequest {
|
|
Id int64 `path:"id"`
|
|
}
|
|
)
|
|
|
|
// ========== Model Types ==========
|
|
|
|
type (
|
|
AIModelInfo {
|
|
Id int64 `json:"id,string"`
|
|
ProviderId int64 `json:"providerId,string"`
|
|
ProviderName string `json:"providerName"`
|
|
ModelId string `json:"modelId"`
|
|
DisplayName string `json:"displayName"`
|
|
InputPrice float64 `json:"inputPrice"`
|
|
OutputPrice float64 `json:"outputPrice"`
|
|
MaxTokens int `json:"maxTokens"`
|
|
ContextWindow int `json:"contextWindow"`
|
|
SupportsStream bool `json:"supportsStream"`
|
|
SupportsVision bool `json:"supportsVision"`
|
|
}
|
|
|
|
AIModelListResponse {
|
|
List []AIModelInfo `json:"list"`
|
|
}
|
|
)
|
|
|
|
// ========== Quota Types ==========
|
|
|
|
type (
|
|
AIQuotaInfo {
|
|
Balance float64 `json:"balance"`
|
|
TotalRecharged float64 `json:"totalRecharged"`
|
|
TotalConsumed float64 `json:"totalConsumed"`
|
|
FrozenAmount float64 `json:"frozenAmount"`
|
|
}
|
|
)
|
|
|