Files
sm-golem-plugin/plugin.go
Jakub Zych cd3f0f6c1c feat: golem15.golem plugin with the OpenAI-compatible adapter and AIService.Send
- Prompt, Payload and AIResponse value objects ported from Golem15.Golem
- OpenAIAdapter: chat completions mapping with PHP's response_format,
  max_completion_tokens and reasoning_effort rules
- AIService.Send through fetchguard (TrustedMode for operator models,
  PublicOnlyMode otherwise) with PHP's failure messages
- config defaults for the SSRF allowlist and the AI timeout, lang, README
2026-10-03 22:41:49 +02:00

61 lines
1.5 KiB
Go

// Package golem is the golem15.golem plugin: the shared AI layer of
// SummerCMS applications. It ports the WinterCMS Golem15.Golem plugin's AI
// service (provider adapters for the Anthropic Messages API and the
// OpenAI-compatible chat completions API, prompts, image generation, file
// uploads, streaming) and its SSRF guard.
package golem
import (
"embed"
"io/fs"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/pact"
"git.golem15.com/golem15/summercms/modules/party"
)
var (
_ party.Plugin = (*Plugin)(nil)
_ pact.HasConfig = (*Plugin)(nil)
_ pact.HasLang = (*Plugin)(nil)
)
//go:embed config
var configFS embed.FS
//go:embed lang
var langFS embed.FS
// Plugin is the golem15.golem plugin.
type Plugin struct {
app *backpack.App
}
// ID is the plugin ID, also its config and lang namespace.
func (p *Plugin) ID() string { return "golem15.golem" }
// Requires is empty: the plugin depends on no other plugin.
func (p *Plugin) Requires() []string { return nil }
// Register keeps the application.
func (p *Plugin) Register(app *backpack.App) error {
p.app = app
return nil
}
// Boot keeps the application.
func (p *Plugin) Boot(app *backpack.App) error {
p.app = app
return nil
}
// ConfigFS ships config/config.yaml, merged under golem15.golem.*.
func (p *Plugin) ConfigFS() fs.FS { return configFS }
// LangFS ships the golem15.golem lang namespace.
func (p *Plugin) LangFS() fs.FS { return langFS }
func init() {
party.Register(&Plugin{})
}