Changeset 0.18.0 (#79)

This commit is contained in:
2026-02-28 18:24:19 +00:00
parent 12e316c234
commit e4a943b03e
48 changed files with 3999 additions and 1398 deletions

View File

@@ -219,6 +219,10 @@ type Persona struct {
// Loaded from persona_knowledge_bases, not stored in personas table
KBIDs []string `json:"kb_ids,omitempty" db:"-"`
// Memory configuration (v0.18.0)
MemoryEnabled bool `json:"memory_enabled" db:"memory_enabled"`
MemoryExtractionPrompt *string `json:"memory_extraction_prompt,omitempty" db:"memory_extraction_prompt"`
}
type PersonaPatch struct {
@@ -235,6 +239,8 @@ type PersonaPatch struct {
TopP *float64 `json:"top_p,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
IsShared *bool `json:"is_shared,omitempty"`
MemoryEnabled *bool `json:"memory_enabled,omitempty"`
MemoryExtractionPrompt *string `json:"memory_extraction_prompt,omitempty"`
}
// =========================================

View File

@@ -0,0 +1,48 @@
// ── models_memory.go ────────────────────────
// Memory model for v0.18.0 — add these types to models/models.go
// (or keep as a separate file in the models package)
package models
import "time"
// ── Memory Scope Constants ──────────────────
const (
MemoryScopeUser = "user" // personal facts, persists across all conversations
MemoryScopePersona = "persona" // shared across all users of a Persona
MemoryScopePersonaUser = "persona_user" // per-user within a Persona context
)
// ── Memory Status Constants ─────────────────
const (
MemoryStatusActive = "active"
MemoryStatusPendingReview = "pending_review"
MemoryStatusArchived = "archived"
)
// Memory represents a single fact or preference persisted across conversations.
type Memory struct {
ID string `json:"id" db:"id"`
Scope string `json:"scope" db:"scope"`
OwnerID string `json:"owner_id" db:"owner_id"`
UserID *string `json:"user_id,omitempty" db:"user_id"`
Key string `json:"key" db:"key"`
Value string `json:"value" db:"value"`
SourceChannelID *string `json:"source_channel_id,omitempty" db:"source_channel_id"`
Confidence float64 `json:"confidence" db:"confidence"`
Status string `json:"status" db:"status"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
// MemoryFilter specifies which memories to retrieve.
type MemoryFilter struct {
Scope string // required: user, persona, persona_user
OwnerID string // required: user_id or persona_id
UserID *string // only for persona_user scope
Status string // default: "active"
Query string // optional: keyword filter on key+value
Limit int // max results (default 50)
}

View File

@@ -0,0 +1,18 @@
// ── models_memory_persona.go ────────────────
// Phase 2 additions to the Persona struct.
//
// Add these fields to the Persona struct in models/models.go
// (after the KBIDs field):
//
// MemoryEnabled bool `json:"memory_enabled" db:"memory_enabled"`
// MemoryExtractionPrompt *string `json:"memory_extraction_prompt,omitempty" db:"memory_extraction_prompt"`
//
// Add to PersonaPatch:
//
// MemoryEnabled *bool `json:"memory_enabled,omitempty"`
// MemoryExtractionPrompt *string `json:"memory_extraction_prompt,omitempty"`
//
// This file exists purely as documentation — the actual fields
// must be added to the existing structs in models.go.
package models