- Updated .env.example to include new configuration options for the UltiAI branding and API endpoints. - Enhanced Nginx configuration to support new API routes for the MCP and WebSocket connections. - Introduced sub-filters for branding adjustments in Nginx responses. - Added new JavaScript patch for API endpoint adjustments. - Implemented tests for new API functionalities and improved error handling in the AI gateway.
88 lines
3.0 KiB
Go
88 lines
3.0 KiB
Go
package ai
|
|
|
|
import "time"
|
|
|
|
type ModelCatalogEntry struct {
|
|
ModelID string `json:"model_id"`
|
|
Label string `json:"label"`
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
type AssistantPolicy struct {
|
|
Enabled bool `json:"enabled"`
|
|
OpenWebUIInternalURL string `json:"openwebui_internal_url"`
|
|
PublicPath string `json:"public_path"`
|
|
EmbedDefaultTemporary bool `json:"embed_default_temporary"`
|
|
DefaultModel string `json:"default_model"`
|
|
EnabledTools []string `json:"enabled_tools"`
|
|
ChatSyncEnabled bool `json:"chat_sync_enabled"`
|
|
ChatNCPath string `json:"chat_nc_path"`
|
|
Models []ModelCatalogEntry `json:"models,omitempty"`
|
|
}
|
|
|
|
type QuotaLimits struct {
|
|
RequestsPerDay int `json:"llm_requests_per_day"`
|
|
TokensPerMonth int64 `json:"llm_tokens_per_month"`
|
|
}
|
|
|
|
type QuotaStatus struct {
|
|
RequestsUsedToday int `json:"requests_used_today"`
|
|
RequestsLimit int `json:"requests_limit"`
|
|
TokensUsedMonth int64 `json:"tokens_used_month"`
|
|
TokensLimit int64 `json:"tokens_limit"`
|
|
RequestsRemaining int `json:"requests_remaining"`
|
|
TokensRemaining int64 `json:"tokens_remaining"`
|
|
}
|
|
|
|
type ChatMessage struct {
|
|
Role string `json:"role"`
|
|
Content string `json:"content,omitempty"`
|
|
ToolCalls []any `json:"tool_calls,omitempty"`
|
|
Attachments []any `json:"attachments,omitempty"`
|
|
}
|
|
|
|
type ChatMeta struct {
|
|
Model string `json:"model,omitempty"`
|
|
TokensUsed int64 `json:"tokens_used,omitempty"`
|
|
Context string `json:"context,omitempty"`
|
|
}
|
|
|
|
type ChatRecord struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Source string `json:"source"`
|
|
OpenWebUIChatID string `json:"openwebui_chat_id,omitempty"`
|
|
Messages []ChatMessage `json:"messages"`
|
|
Meta ChatMeta `json:"meta"`
|
|
}
|
|
|
|
type ChatListItem struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Source string `json:"source"`
|
|
}
|
|
|
|
type SessionContext struct {
|
|
App string `json:"app"`
|
|
Temporary bool `json:"temporary"`
|
|
MessageID string `json:"message_id,omitempty"`
|
|
AccountID string `json:"account_id,omitempty"`
|
|
DrivePath string `json:"drive_path,omitempty"`
|
|
FileID string `json:"file_id,omitempty"`
|
|
ContactID string `json:"contact_id,omitempty"`
|
|
Subject string `json:"subject,omitempty"`
|
|
Snippet string `json:"snippet,omitempty"`
|
|
}
|
|
|
|
type SessionResponse struct {
|
|
SessionID string `json:"session_id"`
|
|
EmbedURL string `json:"embed_url"`
|
|
TokenSecret string `json:"token_secret,omitempty"`
|
|
Temporary bool `json:"temporary"`
|
|
MCPURL string `json:"mcp_url,omitempty"`
|
|
EnabledTools []string `json:"enabled_tools,omitempty"`
|
|
}
|