- internal/advisor/context.go: BuildContext assembles compact NetBox summary (item count, category breakdown, recent 20 items) - Caches result under sync.Mutex for defaultTTL=60s - Stale cache returned on NetBox error rather than propagating failure - internal/ai/types.go: add Tier3 TierConfig field to AIConfig (required by AdvisorHandler for OpenRouter Claude Opus access)
39 lines
2 KiB
Go
39 lines
2 KiB
Go
package ai
|
||
|
||
// IntakeRequest carries 1-3 photos (base64-encoded data URLs) for AI analysis.
|
||
type IntakeRequest struct {
|
||
PhotosBase64 []string // "data:image/jpeg;base64,..."
|
||
JobID string // UUID for tracing
|
||
}
|
||
|
||
// IntakeResult is the structured output from any AI tier's photo analysis.
|
||
// The model is instructed to return this JSON shape verbatim.
|
||
type IntakeResult struct {
|
||
SerialNumber string `json:"serial_number"`
|
||
Model string `json:"model"`
|
||
Manufacturer string `json:"manufacturer"`
|
||
Category string `json:"category"` // compute | networking | storage | cable | peripheral | component | unknown
|
||
Specs map[string]string `json:"specs"`
|
||
SuggestedTags []string `json:"suggested_tags"`
|
||
AINotes string `json:"ai_notes"`
|
||
Confidence float64 `json:"confidence"` // 0.0–1.0 self-reported
|
||
ConfidenceNote string `json:"confidence_note"` // reason if < threshold
|
||
}
|
||
|
||
// TierConfig holds provider configuration for one AI tier.
|
||
type TierConfig struct {
|
||
BaseURL string `json:"base_url" mapstructure:"base_url"`
|
||
APIKey string `json:"api_key" mapstructure:"api_key"`
|
||
Model string `json:"model" mapstructure:"model"`
|
||
TimeoutSeconds int `json:"timeout_seconds" mapstructure:"timeout_seconds"`
|
||
}
|
||
|
||
// AIConfig holds all AI tier configurations and orchestration settings.
|
||
type AIConfig struct {
|
||
Tier1 TierConfig `json:"tier1" mapstructure:"tier1"`
|
||
Tier2 TierConfig `json:"tier2" mapstructure:"tier2"`
|
||
Tier3 TierConfig `json:"tier3" mapstructure:"tier3"`
|
||
ConfidenceThreshold float64 `json:"confidence_threshold" mapstructure:"confidence_threshold"`
|
||
QuickAddEnabled bool `json:"quick_add_enabled" mapstructure:"quick_add_enabled"`
|
||
QuickAddThreshold float64 `json:"quick_add_threshold" mapstructure:"quick_add_threshold"`
|
||
}
|