Documentation
¶
Overview ¶
templ: version: v0.3.977
templ: version: v0.3.977
templ: version: v0.3.977
Index ¶
- func AIChat(props Props) templ.Component
- func ActionBar(props ActionBarProps) templ.Component
- func AssignRow(props AssignRowProps) templ.Component
- func AssistantMessage(props ...AssistantMessageProps) templ.Component
- func AssistantMessageWithContent(content templ.Component) templ.Component
- func AssistantText(text string) templ.Component
- func MessagesID(chatID string) string
- func QuickReplies(props QuickRepliesProps) templ.Component
- func ReadSignals(chatID string, r *http.Request, dest *AIChatSignals) error
- func ResponseCard(props ResponseCardProps) templ.Component
- func Typing(props TypingProps) templ.Component
- func UserMessage(props UserMessageProps) templ.Component
- type AIChatSignals
- type ActionBarProps
- type AssignRowProps
- type AssistantMessageProps
- type CardTag
- type ChatSender
- func (c *ChatSender) Append(component templ.Component) error
- func (c *ChatSender) AssistantMessage(content templ.Component) error
- func (c *ChatSender) AssistantText(text string) error
- func (c *ChatSender) HideTyping() error
- func (c *ChatSender) ShowTyping() error
- func (c *ChatSender) UserMessage(text string) error
- type Member
- type Props
- type QuickRepliesProps
- type QuickReply
- type ResponseCardProps
- type TypingProps
- type UserMessageProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AIChat ¶
AIChat renders a conversational AI chat widget. Collapsed: sparkle icon + placeholder + keyboard shortcut. Expanded: scrollable message area + reply input.
func ActionBar ¶
func ActionBar(props ActionBarProps) templ.Component
ActionBar renders a primary button + discard button row.
func AssignRow ¶
func AssignRow(props AssignRowProps) templ.Component
AssignRow renders an "Assign:" label with avatar chips.
func AssistantMessage ¶
func AssistantMessage(props ...AssistantMessageProps) templ.Component
AssistantMessage renders a light bubble with sparkle avatar, left-aligned (AI response). Takes children for content (text, cards, quick replies, etc.).
func AssistantMessageWithContent ¶
AssistantMessageWithContent renders an assistant message wrapping a templ component. Use this from Go code (e.g. SSE handlers) where { children... } isn't available.
func AssistantText ¶
AssistantText renders a text bubble inside an AssistantMessage.
func MessagesID ¶
MessagesID returns the ID of the messages container for SSE targeting.
func QuickReplies ¶
func QuickReplies(props QuickRepliesProps) templ.Component
QuickReplies renders a row of bordered buttons below an AI message.
func ReadSignals ¶
func ReadSignals(chatID string, r *http.Request, dest *AIChatSignals) error
ReadSignals reads the AI chat's namespaced signals from the request.
func ResponseCard ¶
func ResponseCard(props ResponseCardProps) templ.Component
ResponseCard renders a bordered card inside an assistant message. Takes children for action rows (AssignRow, ActionBar).
func Typing ¶
func Typing(props TypingProps) templ.Component
Typing renders a sparkle avatar with animated dots (AI is thinking).
func UserMessage ¶
func UserMessage(props UserMessageProps) templ.Component
UserMessage renders a dark pill bubble, right-aligned (user's message).
Types ¶
type AIChatSignals ¶
type AIChatSignals struct {
Open bool `json:"open"` // collapsed vs expanded
Input string `json:"input"` // current input text
}
AIChatSignals holds the reactive state for the AI chat.
type ActionBarProps ¶
type ActionBarProps struct {
PrimaryLabel string // e.g. "Add to inbox ✦"
PrimaryURL string // POST endpoint for primary action
DiscardURL string // POST endpoint for discard
}
ActionBarProps configures the action bar at the bottom of a response card.
type AssignRowProps ¶
type AssignRowProps struct {
Members []Member
}
AssignRowProps configures the assign row.
type AssistantMessageProps ¶
AssistantMessageProps configures an assistant message.
type CardTag ¶
type CardTag struct {
Label string
Variant string // "" (default/outline) | "warning" | "success" | "info" | "error"
}
CardTag represents a category badge on a response card.
type ChatSender ¶
type ChatSender struct {
// contains filtered or unexported fields
}
ChatSender provides SSE operations scoped to a specific AI chat instance.
func Chat ¶
func Chat(sse *datastar.ServerSentEventGenerator, chatID string) *ChatSender
Chat returns a ChatSender scoped to the given chat ID. All operations target the chat's messages container.
chat := aichat.Chat(sse, "my-chat")
chat.UserMessage("Hello")
chat.ShowTyping()
chat.HideTyping()
chat.AssistantText("Hi there!")
func (*ChatSender) Append ¶
func (c *ChatSender) Append(component templ.Component) error
Append appends any templ component to the messages area.
func (*ChatSender) AssistantMessage ¶
func (c *ChatSender) AssistantMessage(content templ.Component) error
AssistantMessage appends an assistant message wrapping a templ component.
func (*ChatSender) AssistantText ¶
func (c *ChatSender) AssistantText(text string) error
AssistantText appends a simple text response from the assistant.
func (*ChatSender) HideTyping ¶
func (c *ChatSender) HideTyping() error
HideTyping removes the typing indicator.
func (*ChatSender) ShowTyping ¶
func (c *ChatSender) ShowTyping() error
ShowTyping appends a typing indicator.
func (*ChatSender) UserMessage ¶
func (c *ChatSender) UserMessage(text string) error
UserMessage appends a user message bubble.
type Member ¶
type Member struct {
Initials string // e.g. "ME", "SA"
Name string // display name
Color string // Tailwind bg color class (e.g. "bg-success", "bg-secondary")
Active bool // currently selected
}
Member represents a team/family member for assignment.
type Props ¶
type Props struct {
ID string
Class string
Attributes templ.Attributes
Placeholder string // collapsed placeholder (default "Tell your butler something...")
ReplyPlaceholder string // reply input placeholder (default "Type a reply...")
SubmitURL string // POST endpoint for user messages
Shortcut string // keyboard shortcut hint (default "⌘K")
InputSlot templ.Component // optional: replaces default input row (e.g. embedded CommandBar)
}
Props configures the AI chat component.
type QuickRepliesProps ¶
type QuickRepliesProps struct {
ID string
SubmitURL string // POST endpoint — value is sent via signals
ChatID string // parent AIChat ID to set input signal before posting
Options []QuickReply
}
QuickRepliesProps configures quick-reply buttons.
type QuickReply ¶
QuickReply represents a single quick-reply option.
type ResponseCardProps ¶
type ResponseCardProps struct {
ID string
Class string
Title string // bold heading (e.g. "Buy football boots for Max")
Description string // AI explanation text
Tags []CardTag
}
ResponseCardProps configures a rich AI response card.
type TypingProps ¶
type TypingProps struct {
ID string
}
TypingProps configures the typing indicator.
type UserMessageProps ¶
UserMessageProps configures a user message bubble.