Files
sm-golem-plugin/admin.go
Jakub Zych c93e2d9142 feat: AI models admin, settings import, Anthropic adapter and the rest of AIService
- golem15_golem_models (encrypted write-only api_key) with its cabana list
  and form under golem15.golem.access_settings, and the Settings lookups
  (Models, DefaultModel with PHP's position-0 quirk, Vision, Image, File,
  ByName), every one Trusted
- golem:import-settings copies the WinterCMS golem_settings repeater once
- AnthropicAdapter; SendStream, SendFile/SendFilePath/SendFileReader,
  SendWithModel, SendToImageModel, SendToVisionModel, GenerateImage, Ask
- PromptFactory; README documents the config keys, the environment
  variable, the command and the admin screen
2026-10-03 23:09:02 +02:00

58 lines
1.7 KiB
Go

package golem
import (
"embed"
"io/fs"
"git.golem15.com/golem15/sm-golem-plugin/controllers"
"git.golem15.com/golem15/summercms/modules/pact"
)
//go:embed controllers/aimodels/config_list.yaml controllers/aimodels/config_form.yaml models/ai_model/fields.yaml models/ai_model/columns.yaml
var adminFS embed.FS
var (
_ pact.AdminAssets = (*Plugin)(nil)
_ pact.HasAdminControllers = (*Plugin)(nil)
_ pact.HasPermissions = (*Plugin)(nil)
_ pact.HasNavigation = (*Plugin)(nil)
)
// AdminFS is the admin YAML of the AI models screen.
func (p *Plugin) AdminFS() fs.FS { return adminFS }
// AdminControllers is the AI models list and form.
func (p *Plugin) AdminControllers() []pact.AdminController {
return controllers.AdminControllers()
}
// Permissions is golem15.golem.access_settings (WinterCMS registers it
// for the developer and publisher roles).
func (*Plugin) Permissions() []pact.Permission {
return []pact.Permission{{
Code: controllers.PermissionAccessSettings,
Tab: "golem15.golem::lang.plugin.name",
Label: "golem15.golem::lang.permissions.access_settings",
Roles: []string{"developer", "publisher"},
}}
}
// Navigation is the Golem menu with its AI models side entry.
func (*Plugin) Navigation() []pact.NavigationItem {
return []pact.NavigationItem{{
Code: "golem",
Label: "golem15.golem::lang.plugin.name",
Icon: "bot",
Permissions: []string{"golem15.golem.*"},
Order: 500,
Controller: "golem15.golem.models",
SideMenu: []pact.NavigationItem{{
Code: "models",
Label: "golem15.golem::lang.settings.models",
Icon: "cpu",
Permissions: []string{controllers.PermissionAccessSettings},
Controller: "golem15.golem.models",
}},
}}
}