agent fix

This commit is contained in:
2026-09-24 12:36:33 +05:30
parent 294fb8ab93
commit bb14445e21
10 changed files with 661 additions and 15 deletions

View File

@@ -47,7 +47,7 @@ type Facade struct {
// it may be nil if catalogue env vars are not configured, in which case
// catalogue endpoints will error at query time rather than at startup.
// embedder may be nil too: scan-to-order then matches on words alone.
func NewFacade(db *gorm.DB, catalogueDB *gorm.DB, embedder utils.Embedder, chat utils.Chat, agentsDir string) *Facade {
func NewFacade(db *gorm.DB, catalogueDB *gorm.DB, embedder utils.Embedder, chat utils.Chat, agentsDir, assistantWhy string) *Facade {
// User Module
userRepo := repositories.NewUserRepository(db)
@@ -182,6 +182,11 @@ func NewFacade(db *gorm.DB, catalogueDB *gorm.DB, embedder utils.Embedder, chat
log.Printf("assistant: %d agents loaded %v", len(agents), services.AgentNames(agents))
assistantService := services.NewAssistantService(toolRegistry, chat, agents)
// Why there is no model, if there is not. Passed through so /assistant/status
// can name the missing variable instead of just saying no.
if setter, ok := assistantService.(interface{ SetUnavailableReason(string) }); ok && chat == nil {
setter.SetUnavailableReason(assistantWhy)
}
assistantController := controllers.NewAssistantController(assistantService)
// The second door. Same registry, same agents, same session — see