providers

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package providers defines the Provider interface and common types for embed providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DifyProvider

type DifyProvider struct{}

DifyProvider implements the Provider interface for Dify AI chat.

func NewDify

func NewDify() *DifyProvider

NewDify creates a new Dify provider instance.

func (*DifyProvider) Description

func (p *DifyProvider) Description() string

Description returns the provider description.

func (*DifyProvider) ID

func (p *DifyProvider) ID() string

ID returns the provider identifier.

func (*DifyProvider) Name

func (p *DifyProvider) Name() string

Name returns the display name.

func (*DifyProvider) RenderBody

func (p *DifyProvider) RenderBody(settings map[string]string) template.HTML

RenderBody returns the custom Dify chat widget.

func (*DifyProvider) RenderHead

func (p *DifyProvider) RenderHead(_ map[string]string) template.HTML

RenderHead returns HTML for the <head> section.

func (*DifyProvider) SettingsSchema

func (p *DifyProvider) SettingsSchema() []SettingField

SettingsSchema returns the configuration fields for Dify.

func (*DifyProvider) Validate

func (p *DifyProvider) Validate(settings map[string]string) error

Validate validates the Dify settings.

type Provider

type Provider interface {
	// ID returns the unique identifier for the provider (e.g., "dify", "youtube")
	ID() string

	// Name returns the display name for the provider
	Name() string

	// Description returns a brief description of the provider
	Description() string

	// SettingsSchema returns the configuration fields for the provider
	SettingsSchema() []SettingField

	// Validate validates the provider settings
	// Returns nil if valid, or an error describing the issue
	Validate(settings map[string]string) error

	// RenderHead returns HTML to inject in the <head> section
	RenderHead(settings map[string]string) template.HTML

	// RenderBody returns HTML to inject before </body>
	RenderBody(settings map[string]string) template.HTML
}

Provider defines the interface for embed providers. Each provider implements a specific third-party service integration.

type SelectOption

type SelectOption struct {
	Value string
	Label string
}

SelectOption represents an option for select fields.

type SettingField

type SettingField struct {
	// ID is the unique identifier for the field (used in JSON storage)
	ID string

	// Name is the display name for the field
	Name string

	// Description provides additional context for the field
	Description string

	// Type is the field type: "text", "textarea", "url", "color", "select", "checkbox"
	Type string

	// Options are the available choices for "select" type fields
	Options []SelectOption

	// Required indicates if the field must have a value when enabled
	Required bool

	// Default is the default value for the field
	Default string

	// Placeholder is the placeholder text for input fields
	Placeholder string
}

SettingField defines a configuration field for a provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL