Add AI agent decision memory layer with pgvector similarity search
- models/agentdecision.go: AgentDecision GORM model (context/decision as jsonb, reasoning as text) - migrations/migrate.go: AutoMigrate AgentDecision then ALTER TABLE to add vector(1536) column and CREATE ivfflat index via raw SQL - controllers/agentDecisionController.go: CreateAgentDecision, FindSimilarDecisions (cosine distance), UpdateDecisionOutcome - routes/routes.go: three routes under /api/v1/internal (InternalKeyAuth applied at group level) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
15
models/agentdecision.go
Normal file
15
models/agentdecision.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type AgentDecision struct {
|
||||
ID uint64 `gorm:"primaryKey"`
|
||||
DecisionType string `gorm:"size:50;index"`
|
||||
BookingID *uint64 `gorm:"index"`
|
||||
Context string `gorm:"type:jsonb"`
|
||||
Decision string `gorm:"type:jsonb"`
|
||||
Reasoning string `gorm:"type:text"`
|
||||
Outcome *string `gorm:"size:30;index"`
|
||||
OutcomeRecordedAt *time.Time
|
||||
CreatedAt time.Time
|
||||
}
|
||||
Reference in New Issue
Block a user